Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b181fdf7 authored by luc chatty's avatar luc chatty
Browse files

improve code

parent 9be153f6
No related branches found
Tags 8.13+no
2 merge requests!4Develop,!3Feature/frame 39
Pipeline #136554 failed
...@@ -92,19 +92,14 @@ class CSVFileLoader { ...@@ -92,19 +92,14 @@ class CSVFileLoader {
static List<String> readCSVFile(File csvFile) throws FileNotFoundException { static List<String> readCSVFile(File csvFile) throws FileNotFoundException {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
FileReader fr = new FileReader(csvFile); FileReader fr = new FileReader(csvFile);
BufferedReader br = new BufferedReader(fr);
try { try (BufferedReader br = new BufferedReader(fr)){
for (String line = br.readLine(); line != null; line = br.readLine()) { for (String line = br.readLine(); line != null; line = br.readLine()) {
result.add(line); result.add(line);
} }
} catch (IOException e) {
LOGGER.error("The following exception has occured during file reading : {}",e);
}
try {
br.close();
fr.close(); fr.close();
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("The following exception has occured during file closing : {}",e); LOGGER.error("The following exception has occured during file reading : {}",e);
} }
return result; return result;
......
...@@ -20,19 +20,12 @@ public class CoversProcessor extends AbstractProcessor { ...@@ -20,19 +20,12 @@ public class CoversProcessor extends AbstractProcessor {
public boolean process(Set<? extends TypeElement> annotations, public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) { RoundEnvironment roundEnv) {
String fileName = System.getProperty("csv.name"); String fileName = System.getProperty("csv.name");
String className = roundEnv.getRootElements().iterator().next().getSimpleName().toString();
for (TypeElement annotation : annotations) { for (TypeElement annotation : annotations) {
Set<? extends Element> annotatedElements
= roundEnv.getElementsAnnotatedWith(annotation);
CSVFileLoader.loadCSVFileFromPath(fileName); CSVFileLoader.loadCSVFileFromPath(fileName);
annotatedElements.forEach(annotatedElement -> { roundEnv.getElementsAnnotatedWith(annotation).forEach(annotatedElement -> {
String[] requirements = annotatedElement.getAnnotation(Covers.class).requirements(); Arrays.asList(annotatedElement.getAnnotation(Covers.class).requirements()).forEach(assertionId -> {
annotatedElement.getAnnotation(Test.class);
Set<? extends Element> contextElements =roundEnv.getRootElements();
String className = contextElements.iterator().next().getSimpleName().toString();
Arrays.asList(requirements).forEach(assertionId -> {
if (className.endsWith("Test") || className.endsWith("IT")) { if (className.endsWith("Test") || className.endsWith("IT")) {
CSVFileLoader.setTestedForAssertionID(fileName,assertionId); CSVFileLoader.setTestedForAssertionID(fileName,assertionId);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment