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;
import domain.Robot;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import src.domain.C3PO;
import src.domain.Factory;
import src.domain.RobotType;
import domain.C3PO;
import domain.Factory;
import domain.RobotType;
import static org.junit.jupiter.api.Assertions.*;
@ -14,26 +15,27 @@ class FactoryTest {
@BeforeEach
void setup(){
f = new Factory();
}
@Test
void robotListToCollection() {
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() {
asserEquals(true, f.buildNewRobot("herbi", RobotType.R2D2));
boolean test = f.buildNewRobot("herbi", RobotType.R2D2);
assertEquals(true, test);
}
@Test
void getRobotOfList() {
String[] test = new String[0];
assertEquals(test, f.getRobotList());
Robot r = f.getRobotOfList(0);
assertEquals( "herbi",r.getName());
}
}