A lot of things.
- Change tests directory location. - Fix Merlu CSV UTF8 encoding. - Make classes for ParasitesPeru2021.csv Parsing.
This commit is contained in:
@@ -1,21 +1,36 @@
|
||||
package ecoparasite.input;
|
||||
|
||||
import static ecoparasite.input.InputFactory.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
|
||||
import ecoparasite.input.InputFactory;
|
||||
import ecoparasite.input.InputFileException;
|
||||
import ecoparasite.input.RawData;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class InputFactoryTest {
|
||||
|
||||
// TODO : Test a être effectué par Sébastien.
|
||||
@Test
|
||||
void readFile() throws InputFileException, RawDataOverflow {
|
||||
RawData r = InputFactory.readData( InputFactory.DATA_MACKEREL );
|
||||
System.out.println( r );
|
||||
System.out.println( r.getColumnsNames() );
|
||||
System.out.println( r.getDataFromColumn( "Sample_codE" ) );
|
||||
System.out.println( r.getEntry( 2 ) );
|
||||
@org.junit.jupiter.api.Test
|
||||
void buildDataPath() {
|
||||
|
||||
String d = "data/Campagne/mackerel.97442.csv";
|
||||
String e = "data/Campagne/merlu2018_75164.csv";
|
||||
|
||||
assertArrayEquals(d.toCharArray(), InputFactory.buildDataPath("Campagne/mackerel.97442.csv").toCharArray());
|
||||
assertArrayEquals(e.toCharArray(), InputFactory.buildDataPath("Campagne/merlu2018_75164.csv").toCharArray());
|
||||
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void readData() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
|
||||
System.out.println(test.getData());
|
||||
|
||||
}
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void testReadData() {
|
||||
}
|
||||
|
||||
}
|
||||
42
tests/ecoparasite/input/RawDataTest.java
Normal file
42
tests/ecoparasite/input/RawDataTest.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package ecoparasite.input;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
class RawDataTest {
|
||||
|
||||
|
||||
@Test
|
||||
void getColumnsNames() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
|
||||
HashSet<String> d = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < test.getData().size(); i++){
|
||||
d.add(test.getData().get(i).getFirst());
|
||||
}
|
||||
|
||||
System.out.println(test.getColumnsNames());
|
||||
System.out.println(d);
|
||||
|
||||
assertIterableEquals(test.getColumnsNames(),d);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getDataFromColumn() throws InputFileException {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
|
||||
System.out.println(test.getDataFromColumn("Sample_code"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void getEntry() throws InputFileException, RawDataOverflow {
|
||||
RawData test = InputFactory.readData("test.csv");
|
||||
|
||||
System.out.println(test.getEntry(2));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user