2023-10-10 21:22:33 +02:00
|
|
|
/*
|
|
|
|
============================================================
|
|
|
|
This is the "BlockeintragTest" file from Author: Philipp Kotte
|
|
|
|
written on: 10 / 10 / 2023 at: 21:17
|
|
|
|
============================================================
|
|
|
|
*/
|
|
|
|
package Test.Domain.Block;
|
|
|
|
|
2023-11-05 20:40:16 +01:00
|
|
|
import Domain.Block.Blockeintrag;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import static junit.framework.TestCase.assertEquals;
|
|
|
|
import static org.junit.Assert.assertThrows;
|
2023-11-07 09:54:07 +01:00
|
|
|
import static org.junit.Assert.assertTrue;
|
2023-11-05 20:40:16 +01:00
|
|
|
|
2023-10-10 21:22:33 +02:00
|
|
|
public class BlockeintragTest {
|
2023-11-05 20:40:16 +01:00
|
|
|
@Test
|
2023-11-07 09:54:07 +01:00
|
|
|
public void getPunkteTest(){
|
|
|
|
Blockeintrag eintrag = new Blockeintrag(20,0,null);
|
|
|
|
assertTrue((eintrag.getPunkte() == 20));
|
|
|
|
eintrag.setPunkte(30);
|
|
|
|
assertTrue((eintrag.getPunkte() == 30));
|
|
|
|
eintrag.setPunkte(40);
|
|
|
|
assertTrue((eintrag.getPunkte()== 40));
|
2023-11-05 20:40:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
2023-11-07 09:54:07 +01:00
|
|
|
public void getStiche() {
|
|
|
|
Blockeintrag eintrag = new Blockeintrag(30,1,null);
|
|
|
|
assertEquals(1, eintrag.getStiche());
|
|
|
|
eintrag.setStiche(2);
|
|
|
|
assertEquals(2, eintrag.getStiche());
|
|
|
|
eintrag.setStiche(3);
|
|
|
|
assertEquals(3, eintrag.getStiche());
|
2023-11-05 20:40:16 +01:00
|
|
|
}
|
2023-10-10 21:22:33 +02:00
|
|
|
|
2023-11-05 20:40:16 +01:00
|
|
|
//Exception Test hier schreiben
|
2023-11-07 10:31:04 +01:00
|
|
|
@Test
|
2023-11-05 20:40:16 +01:00
|
|
|
public void testNegativeStiche() throws Exception {
|
2023-11-07 09:54:07 +01:00
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Blockeintrag(50, -3, null));
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Blockeintrag(30,-1, null));
|
|
|
|
assertThrows(IllegalArgumentException.class, () -> new Blockeintrag(10, -4, null));
|
2023-11-05 20:40:16 +01:00
|
|
|
}
|
2023-10-10 21:22:33 +02:00
|
|
|
}
|