Merge branch 'main' of https://github.com/Philipp3107/Robto_Factory_PR
commit
b9608f1cdd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -11,7 +11,6 @@ public class Factory implements Serializable {
|
|||
private int r2d2ID = 10000;
|
||||
|
||||
public Factory(){
|
||||
|
||||
}
|
||||
/**
|
||||
* @return Collection<Robot></Robot>
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue