Update arborescence 2
This commit is contained in:
19
tests/TestExec.java
Normal file
19
tests/TestExec.java
Normal file
@@ -0,0 +1,19 @@
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import picocli.CommandLine;
|
||||
|
||||
|
||||
class TestExec {
|
||||
|
||||
@Test
|
||||
void test() throws InterruptedException {
|
||||
|
||||
Exec exec = new Exec();
|
||||
|
||||
|
||||
//Exec.main(new String[] {});
|
||||
}
|
||||
|
||||
}
|
62
tests/commands/TestRead.java
Normal file
62
tests/commands/TestRead.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package commands;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
|
||||
@Command(
|
||||
name = "TestRead",
|
||||
version = "Version 1.0",
|
||||
sortOptions = false,
|
||||
usageHelpWidth = 60,
|
||||
header = "\n ---- Nicely Generated and Corrected Copies ---- \n\n" +
|
||||
" _______ _________________ ________ \n" +
|
||||
" \\ \\ / _____/\\_ ___ \\\\_ ___ \\ \n" +
|
||||
" / | \\/ \\ ___/ \\ \\// \\ \\/ \n" +
|
||||
" / | \\ \\_ \\ \\ \\___\\ \\___ \n" +
|
||||
" \\____|__ /\\______ /\\______ /\\______ / \n" +
|
||||
" \\/ \\/ \\/ \\/ \n" +
|
||||
" \n" ,
|
||||
footer = "\n\n ---- Provided by IUT Info Nice S3T-G4 ---- \n",
|
||||
description = ""
|
||||
)
|
||||
|
||||
|
||||
class TestRead {
|
||||
|
||||
Read read = new Read(System.out);
|
||||
|
||||
@BeforeEach
|
||||
void setUp () {
|
||||
|
||||
read = new Read(System.out);
|
||||
|
||||
CommandLine cmd = new CommandLine (new TestRead())
|
||||
.addSubcommand("-r", read);
|
||||
|
||||
String[] t = {"-r","-v9","-d","pdf","config.txt"};
|
||||
cmd.execute(t);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testCommand() {
|
||||
|
||||
assertFalse(read == null);
|
||||
|
||||
assertEquals("pdf",read.directory_name);
|
||||
assertEquals(false,read.help);
|
||||
assertEquals(9,read.vb_level);
|
||||
assertEquals("config.txt",read.source_path);
|
||||
assertEquals("result.csv",read.result_name);
|
||||
|
||||
assertFalse(read.logger == null);
|
||||
assertEquals(Level.DEBUG.toString(), read.logger.getLevel().toString());
|
||||
}
|
||||
|
||||
}
|
25
tests/config/TestConfig.java
Normal file
25
tests/config/TestConfig.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package config;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TestConfig {
|
||||
|
||||
@Test
|
||||
void testMakeQuestion() {
|
||||
Config c=new Config("test");
|
||||
Question q=new Question("Je suis le titre",false);
|
||||
q=c.makeQuestion("* Dans M.A.S.K. qui sont les pilotes ou copilote de Rhino (un camion tracteur Kenworth w900)?");
|
||||
assertEquals("Dans M.A.S.K. qui sont les pilotes ou copilote de Rhino (un camion tracteur Kenworth w900)?",q.getTitre());
|
||||
|
||||
Question q2=new Question("Selon la serie diffusée en 1991 sur TF1, où le petit Nicolas doit il travailler et s'appliquer ?",false);
|
||||
q2=c.makeQuestion("** Dans M.A.S.K. qui sont les pilotes ou copilote de Rhino (un camion tracteur Kenworth w900)?");
|
||||
assertEquals("Dans M.A.S.K. qui sont les pilotes ou copilote de Rhino (un camion tracteur Kenworth w900)?",q2.getTitre());
|
||||
|
||||
Question q3=new Question("Quelles sont les bonnes réponses",false);
|
||||
q3=c.makeQuestion("*<lines=1> Cette jeune fille vient d'emménager à Sunnydale avec sa mère et rencontre son nouvel observateur. Quel est le nom de ce dernier ?");
|
||||
assertEquals("Cette jeune fille vient d'emménager à Sunnydale avec sa mère et rencontre son nouvel observateur. Quel est le nom de ce dernier ?",q3.getTitre());
|
||||
|
||||
}
|
||||
}
|
35
tests/config/TestQuestion.java
Normal file
35
tests/config/TestQuestion.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package config;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TestQuestion {
|
||||
@Test
|
||||
void testQuestion() {
|
||||
Question q=new Question("Je suis le titre",false);
|
||||
assertEquals("Je suis le titre",q.getTitre());
|
||||
assertEquals(false,q.isMultiple());
|
||||
|
||||
Question q2=new Question("Je suis Q2",true);
|
||||
assertNotEquals("Je suis q2",q2.getTitre());
|
||||
assertEquals("Je suis Q2",q2.getTitre());
|
||||
assertNotEquals(false,q2.isMultiple());
|
||||
assertEquals(true,q2.isMultiple());
|
||||
}
|
||||
@Test
|
||||
void testAddReponse() {
|
||||
Reponse r1=new Reponse("+ Au collège des ninjas",true);
|
||||
Question q=new Question("Selon la serie diffusée en 1991 sur TF1, où le petit Nicolas doit il travailler et s'appliquer ?",false);
|
||||
q.addReponse(r1.getIntitule());
|
||||
assertEquals("Au collège des ninjas",q.getReponses().get(0).getIntitule());
|
||||
Reponse r2=new Reponse("- A l'académie des ninjas",false);
|
||||
q.addReponse(r2.getIntitule());
|
||||
assertEquals("A l'académie des ninjas",q.getReponses().get(1).getIntitule());
|
||||
q.addReponse("Suite de la question");
|
||||
assertEquals("Selon la serie diffusée en 1991 sur TF1, où le petit Nicolas doit il travailler et s'appliquer ?\nSuite de la question",q.getTitre());
|
||||
|
||||
}
|
||||
|
||||
}
|
17
tests/config/TestQuestionBoite.java
Normal file
17
tests/config/TestQuestionBoite.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TestQuestionBoite {
|
||||
@Test
|
||||
void testQuestionBoite() {
|
||||
QuestionBoite q=new QuestionBoite("Quelles sont les bonnes réponses",false,3);
|
||||
assertEquals(3,q.getNbligne());
|
||||
assertEquals(false,q.isMultiple());
|
||||
assertEquals("Quelles sont les bonnes réponses",q.getTitre());
|
||||
assertNotEquals("quelles sont les bonnes réponses",q.getTitre());
|
||||
}
|
||||
}
|
16
tests/config/TestReponse.java
Normal file
16
tests/config/TestReponse.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TestReponse {
|
||||
@Test
|
||||
void testReponse() {
|
||||
Reponse r=new Reponse("Je suis la réponse",true);
|
||||
assertEquals("Je suis la réponse",r.getIntitule());
|
||||
assertEquals(true,r.isJuste());
|
||||
|
||||
}
|
||||
|
||||
}
|
68
tests/csv/TestCSV.java
Normal file
68
tests/csv/TestCSV.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package csv;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
public class TestCSV {
|
||||
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
String length = "8";
|
||||
String path = "../export/result.csv";
|
||||
GenerateCSV csv = new GenerateCSV(map,length,path);
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
map = new HashMap<String,String>();
|
||||
length = "8";
|
||||
path = "../export/result.csv";
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNotNull() {
|
||||
|
||||
map.put("21705239", "17");
|
||||
csv = new GenerateCSV(map,length,path);
|
||||
|
||||
assertFalse(csv == null);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testValid() {
|
||||
|
||||
map.put("21435712", "9");
|
||||
map.put("21705239", "17");
|
||||
csv = new GenerateCSV(map,length,path);
|
||||
|
||||
for (String etud : csv.etudiants.keySet()) {
|
||||
assertTrue(csv.isValid(etud));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testNotValid() {
|
||||
|
||||
map.put("21435", "9");
|
||||
map.put("1705239", "17");
|
||||
csv = new GenerateCSV(map,length,path);
|
||||
|
||||
for (String etud : csv.etudiants.keySet()) {
|
||||
assertFalse(csv.isValid(etud));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testGeneration() {
|
||||
|
||||
}
|
||||
|
||||
}
|
32
tests/log4j/TestLog4j.java
Normal file
32
tests/log4j/TestLog4j.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package log4j;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.config.Configurator;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class TestLog4j {
|
||||
|
||||
|
||||
private static Logger logger = LogManager.getLogger(TestLog4j.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
int v = 9;
|
||||
|
||||
if (v > 8) {
|
||||
Configurator.setLevel("log4j", Level.DEBUG);
|
||||
}
|
||||
|
||||
logger.debug("msg de debogage");
|
||||
logger.info("msg d'information");
|
||||
logger.warn("msg d'avertissement");
|
||||
logger.error("msg d'erreur");
|
||||
logger.fatal("msg d'erreur fatale");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user