correction @Before test

This commit is contained in:
trochas
2024-10-18 18:06:06 +02:00
parent 7685f600ea
commit 06fe1715a9

View File

@@ -5,6 +5,7 @@ import java.util.HashSet;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import src.fr.impl.*; import src.fr.impl.*;
@@ -12,36 +13,40 @@ import src.fr.api.*;
public class test { public class test {
public static void main(String[] args){
Category Engine = new CategoryImpl("Engine");
Category Transmission = new CategoryImpl("Transmission");
Category Exterior= new CategoryImpl("Exterior");
Category Interior= new CategoryImpl("Interior");
//PartType Category Engine = new CategoryImpl("Engine");
PartType EG100= new PartTypeImpl("EG100", Engine); Category Transmission = new CategoryImpl("Transmission");
PartType EG133= new PartTypeImpl("EG133", Engine); Category Exterior= new CategoryImpl("Exterior");
PartType EG210= new PartTypeImpl("EG210", Engine); Category Interior= new CategoryImpl("Interior");
PartType ED110= new PartTypeImpl("ED110", Engine);
PartType ED180= new PartTypeImpl("ED180", Engine);
PartType EH120= new PartTypeImpl("EH120", Engine);
PartType TM5= new PartTypeImpl("TM5", Transmission); //PartType
PartType TM6= new PartTypeImpl("TM6", Transmission); PartType EG100= new PartTypeImpl("EG100", Engine);
PartType TA5= new PartTypeImpl("TA5", Transmission); PartType EG133= new PartTypeImpl("EG133", Engine);
PartType TS6= new PartTypeImpl("TS6", Transmission); PartType EG210= new PartTypeImpl("EG210", Engine);
PartType TSF7= new PartTypeImpl("TSF7", Transmission); PartType ED110= new PartTypeImpl("ED110", Engine);
PartType TC120= new PartTypeImpl("TC120", Transmission); PartType ED180= new PartTypeImpl("ED180", Engine);
PartType EH120= new PartTypeImpl("EH120", Engine);
PartType XC= new PartTypeImpl("XC", Exterior); PartType TM5= new PartTypeImpl("TM5", Transmission);
PartType XM= new PartTypeImpl("XM", Exterior); PartType TM6= new PartTypeImpl("TM6", Transmission);
PartType XS= new PartTypeImpl("XS", Exterior); PartType TA5= new PartTypeImpl("TA5", Transmission);
PartType TS6= new PartTypeImpl("TS6", Transmission);
PartType TSF7= new PartTypeImpl("TSF7", Transmission);
PartType TC120= new PartTypeImpl("TC120", Transmission);
PartType IN= new PartTypeImpl("IN", Interior); PartType XC= new PartTypeImpl("XC", Exterior);
PartType IH= new PartTypeImpl("IH", Interior); PartType XM= new PartTypeImpl("XM", Exterior);
PartType IS= new PartTypeImpl("IS", Interior); PartType XS= new PartTypeImpl("XS", Exterior);
PartType IN= new PartTypeImpl("IN", Interior);
PartType IH= new PartTypeImpl("IH", Interior);
PartType IS= new PartTypeImpl("IS", Interior);
CompatibilityManager cm = new CompatibilityManagerImpl();
@Before
public void init(){
CompatibilityManager cm = new CompatibilityManagerImpl();
Set<PartType> EH120Requirement = new HashSet<PartType>(); Set<PartType> EH120Requirement = new HashSet<PartType>();
EH120Requirement.add(TC120); EH120Requirement.add(TC120);
@@ -91,13 +96,19 @@ public class test {
} }
@Test @Test
public void test(){ public void test_1_Incompatibilities(){
assertTrue(true); assertTrue(cm.getIncompatibilities(EH120).contains(TC120));
} }
@Test @Test
public void test2(){ public void test_multiple_Incompatibilities(){
assertEquals(1,1); //very Important test assertTrue(
cm.getIncompatibilities(TSF7).contains(EG100)&&
cm.getIncompatibilities(TSF7).contains(EG133)&&
cm.getIncompatibilities(TSF7).contains(ED110)
);
} }
} }