added factory test

main
Philipp3107 2023-01-10 01:24:59 +01:00
parent 3bb8482a5a
commit bba1010e65
1 changed files with 13 additions and 11 deletions

View File

@ -1,10 +1,11 @@
package tests; package tests;
import domain.Robot;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import src.domain.C3PO; import domain.C3PO;
import src.domain.Factory; import domain.Factory;
import src.domain.RobotType; import domain.RobotType;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
@ -14,26 +15,27 @@ class FactoryTest {
@BeforeEach @BeforeEach
void setup(){ void setup(){
f = new Factory(); f = new Factory();
} f.buildNewRobot("herbi", RobotType.C3PO);
@Test f.buildNewRobot("Herta", RobotType.R2D2);
void robotListToCollection() {
} }
@Test @Test
void getRobotList() { void getRobotList() {
assertEquals(2, f.getRobotList().length);
f.buildNewRobot("Herbi3", RobotType.C3PO);
assertEquals(3, f.getRobotList().length);
} }
@Test @Test
void buildNewRobot() { void buildNewRobot() {
asserEquals(true, f.buildNewRobot("herbi", RobotType.R2D2)); boolean test = f.buildNewRobot("herbi", RobotType.R2D2);
assertEquals(true, test);
} }
@Test @Test
void getRobotOfList() { void getRobotOfList() {
String[] test = new String[0]; Robot r = f.getRobotOfList(0);
assertEquals(test, f.getRobotList()); assertEquals( "herbi",r.getName());
} }
} }