ajout de commentaires dans les interfaces et correction des test

This commit is contained in:
trochas
2024-10-24 10:03:08 +02:00
parent 467b20f0b6
commit 8770ec3165
5 changed files with 88 additions and 7 deletions

View File

@@ -5,5 +5,10 @@ package src.fr.api;
* A public type to organize part types in categories
*/
public interface Category {
/*
* return the name of the cathegory
* @return String, name of the cathegory, non null
*/
String getName();
}

View File

@@ -1,6 +1,18 @@
package src.fr.api;
import java.util.Set;
public interface CompatibilityChecker {
/*
* return the list of the incompatibles PartType of a PartType
* @param reference : the PartType that we want to see the incompatibilities,non null
* @return the Set list of the incompatibles PartType
*/
Set<PartType> getIncompatibilities(PartType reference);
/*
* return the list of the requirements PartType of a PartType
* @param reference : the PartType that we want to see the requirements,non null
* @return the Set list of the requirements PartType
*/
Set<PartType> getRequirements(PartType reference);
}

View File

@@ -1,8 +1,34 @@
package src.fr.api;
import java.util.Set;
public interface CompatibilityManager extends CompatibilityChecker {
/*
* add a incompatibles PartType to a PartType
* @param reference : the PartType that we wish to add incompatibilities
* @param target : Set list of incompatibilities PartType to add
*/
void addIncompatibilities(PartType reference,Set<PartType> target);
/*
* remove a PartType of the incompatibilities of a PartType, warning,
* warning : we must also remove the incompatibility from all the other PartTypes which the @param reference in their incompatibility
* @param reference : the PartType that we wish to remove a incompatible PartType
* @param target : PartType to remove of incompatibility
*/
void removeIncompatibility(PartType reference, PartType target);
/*
* add requirements PartType to a PartType
* @param reference : the PartType that we wish to add requirements
* @param target : Set list of requirement PartType to add
*/
void addRequirements(PartType reference, Set<PartType> target);
/*
* remove a PartType of the incompatibilities of a PartType
* @param reference : the PartType that we wish to remove a requirement PartType
* @param target : PartType to remove of requirement
*/
void removeRequirement(PartType reference, PartType target);
}

View File

@@ -1,7 +1,14 @@
package src.fr.api;
import java.util.Set;
public interface Configuration {
/*
* @return true if there is no compatibility issue between PartType else false
*/
boolean isValid();
boolean isComplete();
Set<PartType> getSelectedParts();
void selectPart(PartType chosenPart);

View File

@@ -125,18 +125,49 @@ public class test {
}
@Test
public void test_Remove(){
public void test_Remove_and_restore_Incompatibilities_6(){
assertTrue(cm.getIncompatibilities(XM).contains(EG100));
cm.removeIncompatibility(XM, EG100);
assertFalse(cm.getIncompatibilities(XM).contains(EG100));
Set<PartType> setEG100 = new HashSet<PartType>();
setEG100.add(EG100);
cm.addIncompatibilities(EG100, setEG100);
System.out.println(cm.getIncompatibilities(XM) + "//////////");
//assertTrue(cm.getIncompatibilities(XM).contains(EG100));
cm.addIncompatibilities(XM, setEG100);
assertTrue(cm.getIncompatibilities(XM).contains(EG100));
}
@Test
public void test_Remove_Empty_7(){
assertTrue(cm.getIncompatibilities(EG100).isEmpty());
cm.removeIncompatibility(EG100, EG100);
assertFalse(cm.getIncompatibilities(EG100).contains(EG100));
}
@Test
public void test_Remove_and_restore_Requirements_8(){
assertTrue(cm.getRequirements(EH120).contains(TC120));
cm.removeRequirement(EH120, TC120);
assertFalse(cm.getRequirements(EH120).contains(TC120));
Set<PartType> setTC120 = new HashSet<PartType>();
setTC120.add(TC120);
cm.addRequirements(EH120, setTC120);
assertTrue(cm.getRequirements(EH120).contains(TC120));
}
@Test
public void test_Add_and_restore_Incompatibilities_9(){
assertTrue(cm.getIncompatibilities(TSF7).contains(EG100));
assertTrue(cm.getIncompatibilities(TSF7).contains(EG133));
assertTrue(cm.getIncompatibilities(TSF7).contains(ED110));
cm.removeIncompatibility(TSF7, EG100);
assertFalse(cm.getIncompatibilities(TSF7).contains(EG100));
assertTrue(cm.getIncompatibilities(TSF7).contains(EG133));
assertTrue(cm.getIncompatibilities(TSF7).contains(ED110));
Set<PartType> setEG100 = new HashSet<PartType>();
setEG100.add(EG100);
cm.addIncompatibilities(TSF7, setEG100);
assertTrue(cm.getIncompatibilities(TSF7).contains(EG100));
assertTrue(cm.getIncompatibilities(TSF7).contains(EG133));
assertTrue(cm.getIncompatibilities(TSF7).contains(ED110));
}
}