M332-PT-NGCC/tests/csv/TestCSV.java

69 lines
1.2 KiB
Java
Raw Normal View History

2019-09-19 14:57:06 +02:00
package csv;
2019-09-19 13:55:43 +02:00
2019-10-10 09:30:35 +02:00
import static org.junit.jupiter.api.Assertions.*;
2019-09-19 13:55:43 +02:00
2019-10-10 09:30:35 +02:00
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
2019-09-19 13:55:43 +02:00
import org.junit.jupiter.api.Test;
public class TestCSV {
2019-10-10 09:30:35 +02:00
Map<String,String> map = new HashMap<String,String>();
String length = "8";
2019-10-11 10:48:32 +02:00
String format = "20";
2019-10-10 09:30:35 +02:00
String path = "../export/result.csv";
2019-10-11 10:48:32 +02:00
GenerateCSV csv = new GenerateCSV(map,length,format,path);
2019-10-10 09:30:35 +02:00
@BeforeEach
void setUp() {
map = new HashMap<String,String>();
length = "8";
path = "../export/result.csv";
}
@Test
void testNotNull() {
map.put("21705239", "17");
2019-10-11 10:48:32 +02:00
csv = new GenerateCSV(map,length,format,path);
2019-10-10 09:30:35 +02:00
assertFalse(csv == null);
}
@Test
void testValid() {
map.put("21435712", "9");
map.put("21705239", "17");
2019-10-11 10:48:32 +02:00
csv = new GenerateCSV(map,length,format,path);
2019-10-10 09:30:35 +02:00
for (String etud : csv.etudiants.keySet()) {
2019-10-11 10:48:32 +02:00
assertTrue(csv.isNumValid(etud));
2019-10-10 09:30:35 +02:00
}
}
@Test
void testNotValid() {
map.put("21435", "9");
map.put("1705239", "17");
2019-10-11 10:48:32 +02:00
csv = new GenerateCSV(map,length,format,path);
2019-10-10 09:30:35 +02:00
for (String etud : csv.etudiants.keySet()) {
2019-10-11 10:48:32 +02:00
assertFalse(csv.isNumValid(etud));
2019-10-10 09:30:35 +02:00
}
}
@Test
void testGeneration() {
}
2019-09-19 13:55:43 +02:00
2019-10-10 09:30:35 +02:00
}