CedricNew 2023-01-10 01:41:48 +01:00
commit b9608f1cdd
7 changed files with 19 additions and 5 deletions

View File

@ -11,7 +11,6 @@ public class Factory implements Serializable {
private int r2d2ID = 10000;
public Factory(){
}
/**
* @return Collection<Robot></Robot>

View File

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