A lot of things.
- Change tests directory location. - Fix Merlu CSV UTF8 encoding. - Make classes for ParasitesPeru2021.csv Parsing.
This commit is contained in:
@@ -9,5 +9,7 @@ import java.util.HashSet;
|
||||
*/
|
||||
public interface DataParsing {
|
||||
|
||||
public HashSet<Poisson> parse(RawData data) throws RawDataOverflow;
|
||||
public static HashSet<Poisson> parse(RawData data) throws RawDataOverflow {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public class InputFactory {
|
||||
|
||||
final public static String DATA_MACKEREL = "Campagne/mackerel.97442.csv";
|
||||
final public static String DATA_MERLU = "Campagne/merlu2018_75164.csv";
|
||||
final public static String DATA_PARASITES_PERU = "Combinés/ParasitesPeru2021.csv";
|
||||
|
||||
/**
|
||||
* Construit le chemin vers le fichier de données voulu.
|
||||
|
||||
@@ -110,7 +110,7 @@ public class RawData {
|
||||
HashMap<String,String> entry = new HashMap<>();
|
||||
|
||||
for( ArrayList<String> row : data ){
|
||||
if( index > row.size()){
|
||||
if( index >= row.size()){
|
||||
throw new RawDataOverflow( index, row.size() );
|
||||
}
|
||||
entry.put( row.getFirst(), row.get( index ) );
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package ecoparasite.input;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import ecoparasite.input.RawData;
|
||||
|
||||
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