Read me + 2 nouveaux tests dans la v1
This commit is contained in:
16
README.md
16
README.md
@@ -1,5 +1,19 @@
|
||||
V2:
|
||||
|
||||
test_V1 : il s'agit des mêmes tests de la V1, les seuls changements sont sur l'initialisation.
|
||||
|
||||
test_V2 : Nous testons les nouvelles fonctionnalités de la V2 (Property, prix, HTML).
|
||||
Property :
|
||||
On teste si on a bien les propriétés par défaut quand on ne set aucune Propertry.
|
||||
Si on change la valeur d'une Property avec une valeur présence dans possibleValues de la Property, le changement a bien été pris en compte et que la configuration est toujours validée.
|
||||
On teste si en mettant une valeur random, elle est bien prise en compte mais que la configuration n'est plus validé.
|
||||
Prix :
|
||||
On regarde si, à partir d'une configuration, on a bien accès au prix d'une Part
|
||||
On vérifie que le prix total de la Configuration valide, est correct, qu'elle soit complète ou non (-1 si non validée)
|
||||
Qu'une configuration vide a bien un prix de 0
|
||||
HTML :
|
||||
On teste avec différentes configurations (complètes ou non, validées ou non) que la génération de l'HTML ne plante pas
|
||||
|
||||
|
||||
|
||||
(Tests : nous ne savons pas pourquoi mais dans notre projet les tests avec couverture ne fonctionnent pas, les tests sans couverture marchent)
|
||||
nous ne savons pas pourquoi mais dans notre projet les tests avec couverture ne fonctionnent pas, les tets sont bien testé, mais il tourne dans le vide et ne donne jamais le résultat de la couverture...
|
||||
@@ -17,12 +17,6 @@ th,td{border: 1px solid rgb(160 160 160);padding: 8px 10px;}</style>
|
||||
<th>Interior</th>
|
||||
<th>IS</th>
|
||||
<th>2500 €</th>
|
||||
<th>color : black</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Exterior</th>
|
||||
<th>XS</th>
|
||||
<th>10000 €</th>
|
||||
<th>color : red</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -30,6 +24,12 @@ th,td{border: 1px solid rgb(160 160 160);padding: 8px 10px;}</style>
|
||||
<th>TSF7</th>
|
||||
<th>15000 €</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Exterior</th>
|
||||
<th>XS</th>
|
||||
<th>10000 €</th>
|
||||
<th>color : red</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Total Price : </th>
|
||||
<th>52500 € </th>
|
||||
|
||||
@@ -54,14 +54,16 @@ public class HtmlGenerator {
|
||||
}
|
||||
|
||||
static public void generateHTML(ConfigurationImpl config) throws IOException{
|
||||
String content = generateStringHTML(config);
|
||||
|
||||
String projectRoot = System.getProperty("user.dir");
|
||||
File file = new File(projectRoot, "cartailor.html");
|
||||
if(config.isValid()){
|
||||
String content = generateStringHTML(config);
|
||||
|
||||
String projectRoot = System.getProperty("user.dir");
|
||||
File file = new File(projectRoot, "cartailor.html");
|
||||
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
|
||||
writer.write(content);
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
|
||||
writer.write(content);
|
||||
}
|
||||
System.out.println(projectRoot+"\\cartailor.html");
|
||||
}
|
||||
System.out.println(projectRoot+"\\cartailor.html");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,9 @@ public class Interior extends PartImpl {
|
||||
colorSet.add("black");
|
||||
colorSet.add("white");
|
||||
colorSet.add("cream");
|
||||
}
|
||||
}
|
||||
|
||||
String color;
|
||||
String material;
|
||||
|
||||
|
||||
public Interior(){
|
||||
|
||||
@@ -93,6 +93,7 @@ public class test_V1 {
|
||||
cm.addRequirements(IS, ISRequirement);
|
||||
}
|
||||
|
||||
|
||||
//compatibilitiesManager
|
||||
|
||||
@Test
|
||||
@@ -114,8 +115,6 @@ public class test_V1 {
|
||||
assertTrue(cm.getRequirements(EH120).contains(TC120));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* A <-> B
|
||||
* if A -> B then B -> A
|
||||
@@ -138,7 +137,6 @@ public class test_V1 {
|
||||
assertTrue(cm.getIncompatibilities(XS).contains(TM5));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Require Require Require
|
||||
* if A -> B && B -> C then A -> C
|
||||
@@ -208,8 +206,15 @@ public class test_V1 {
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(ED110));
|
||||
}
|
||||
|
||||
|
||||
//Configuration
|
||||
|
||||
@Test
|
||||
public void test_isComplete_empty_config(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
assertFalse(config1.isComplete());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isComplete(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
@@ -242,6 +247,12 @@ public class test_V1 {
|
||||
assertFalse(config1.isComplete());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isValide_empty_config(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
assertTrue(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isValide_empty_cm(){
|
||||
CompatibilityManager cm2 = new CompatibilityManagerImpl();
|
||||
|
||||
@@ -96,6 +96,19 @@ public class test_V2 {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_NotProperty(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TSF7);
|
||||
config1.selectPart(XS);
|
||||
config1.selectPart(IS);
|
||||
|
||||
assertEquals(config1.getPart(exterior).getProperty("color").get(), "white");
|
||||
assertEquals(config1.getPart(interior).getProperty("color").get(), "black");
|
||||
assertTrue(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Property(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
@@ -106,7 +119,7 @@ public class test_V2 {
|
||||
|
||||
config1.getPart(exterior).setProperty("color","red");
|
||||
|
||||
assertTrue(config1.getPart(exterior).getProperty("color").get()=="red");
|
||||
assertEquals(config1.getPart(exterior).getProperty("color").get(), "red");
|
||||
assertTrue(config1.isValid());
|
||||
}
|
||||
|
||||
@@ -120,27 +133,17 @@ public class test_V2 {
|
||||
|
||||
config1.getPart(exterior).setProperty("color","gsqgsdf");
|
||||
|
||||
assertTrue(config1.getPart(exterior).getProperty("color").get()=="gsqgsdf");
|
||||
assertEquals(config1.getPart(exterior).getProperty("color").get(), "gsqgsdf");
|
||||
assertFalse(config1.isValid());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test_NotProperty(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TSF7);
|
||||
config1.selectPart(XS);
|
||||
config1.selectPart(IS);
|
||||
|
||||
assertTrue(config1.getPart(exterior).getProperty("color").get()=="white");
|
||||
assertTrue(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_Price(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
assertTrue(((PartImpl)config1.getPart(engine)).getPrice()==25000);
|
||||
assertEquals(((PartImpl)config1.getPart(engine)).getPrice(), 25000);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -150,7 +153,7 @@ public class test_V2 {
|
||||
config1.selectPart(TSF7);
|
||||
config1.selectPart(XS);
|
||||
config1.selectPart(IS);
|
||||
assertTrue(config1.getTotalPrice()==52500);
|
||||
assertEquals(config1.getTotalPrice(), 52500);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -158,7 +161,23 @@ public class test_V2 {
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TSF7);
|
||||
assertTrue(config1.getTotalPrice()==40000);
|
||||
assertEquals(config1.getTotalPrice(), 40000);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_Config_Price_No_Valid(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG100);
|
||||
config1.selectPart(TSF7);
|
||||
assertFalse(config1.isValid());
|
||||
assertEquals(config1.getTotalPrice(), -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_Config_Price_Empty_config(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
assertTrue(config1.isValid());
|
||||
assertEquals(config1.getTotalPrice(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -175,12 +194,30 @@ public class test_V2 {
|
||||
|
||||
@Test
|
||||
void test_html2(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TSF7);
|
||||
config1.selectPart(XC); //incompatible
|
||||
config1.selectPart(IS); //incompatible
|
||||
config1.getPart(exterior).setProperty("color", "red");
|
||||
config1.getPart(interior).setProperty("color", "red");
|
||||
try {
|
||||
HtmlGenerator.generateHTML(config1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void test_html3(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TSF7);
|
||||
config1.selectPart(XS);
|
||||
config1.selectPart(IS);
|
||||
config1.getPart(exterior).setProperty("color", "red");
|
||||
config1.getPart(interior).setProperty("color", "red");
|
||||
try {
|
||||
HtmlGenerator.generateHTML(config1);
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user