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;
|
private int r2d2ID = 10000;
|
||||||
|
|
||||||
public Factory(){
|
public Factory(){
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return Collection<Robot></Robot>
|
* @return Collection<Robot></Robot>
|
||||||
|
|
|
@ -1,26 +1,41 @@
|
||||||
package tests;
|
package tests;
|
||||||
|
|
||||||
|
import domain.Robot;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import domain.C3PO;
|
||||||
|
import domain.Factory;
|
||||||
|
import domain.RobotType;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class FactoryTest {
|
class FactoryTest {
|
||||||
|
|
||||||
@Test
|
Factory f;
|
||||||
void robotListToCollection() {
|
@BeforeEach
|
||||||
|
void setup(){
|
||||||
|
f = new Factory();
|
||||||
|
f.buildNewRobot("herbi", RobotType.C3PO);
|
||||||
|
f.buildNewRobot("Herta", RobotType.R2D2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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() {
|
||||||
|
boolean test = f.buildNewRobot("herbi", RobotType.R2D2);
|
||||||
|
assertEquals(true, test);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getRobotOfList() {
|
void getRobotOfList() {
|
||||||
|
Robot r = f.getRobotOfList(0);
|
||||||
|
assertEquals( "herbi",r.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue