@@ -0,0 +1,2979 @@
+package de.sopa.helper;%0A%0Aimport org.junit.Test;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport de.sopa.model.game.GameFieldService;%0Aimport de.sopa.model.game.Level;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.hamcrest.CoreMatchers.notNullValue;%0Aimport static org.junit.Assert.assertThat;%0A%0Apublic class FileHandlerTest %7B%0A%0A    private LevelTranslator levelTranslator = new LevelTranslator();%0A    private LevelSolver levelSolver = new LevelSolver(new GameFieldService());%0A%0A    @Test%0A    public void testLevelOfLevelmode() throws IOException %7B%0A%0A        List%3CLevel%3E levels = getLevel();%0A        for (Level level : levels) %7B%0A            if (level.getMinimumMovesToSolve() %3C 5) %7B%0A                Level solve = levelSolver.solve(level, level.getMinimumMovesToSolve());%0A                if (level.getMinimumMovesToSolve() != solve.getMinimumMovesToSolve()) %7B%0A                    System.out.println(level.getId() + %22    Alt: %22 + level.getMinimumMovesToSolve() + %22 Neu: %22 + solve.getMinimumMovesToSolve());%0A                %7D%0A                assertThat(solve, notNullValue());%0A                assertThat(solve.getMinimumMovesToSolve(), is(level.getMinimumMovesToSolve()));%0A            %7D else %7B%0A                System.out.println(%22Level %22 + level.getId() + %22 not tested%22);%0A            %7D%0A        %7D%0A%0A    %7D%0A%0A    private List%3CLevel%3E getLevel() throws IOException %7B%0A        File%5B%5D listOfFiles = getLevelNames();%0A        List%3CLevel%3E levels = new ArrayList%3C%3E();%0A        for (File listOfFile : listOfFiles) %7B%0A            String%5B%5D levelAsString = getLevelAsString(listOfFile);%0A            levels.add(levelTranslator.fromString(levelAsString));%0A        %7D%0A        return levels;%0A    %7D%0A%0A%0A    private String%5B%5D getLevelAsString(File file) throws IOException %7B%0A        FileInputStream fis = new FileInputStream(file);%0A        BufferedReader inputStream = new BufferedReader(new InputStreamReader(fis));%0A        StringBuilder lineContent = new StringBuilder();%0A        int content;%0A        List%3CString%3E lines = new ArrayList%3C%3E();%0A        while ((content = inputStream.read()) != -1) %7B%0A            if ((char) content == '%5Cn') %7B%0A                lines.add(lineContent.toString());%0A                lineContent = new StringBuilder();%0A            %7D else %7B%0A                lineContent.append((char) content);%0A            %7D%0A%0A        %7D%0A        if (lineContent.length() != 0) %7B%0A            lines.add(lineContent.toString());%0A        %7D%0A        inputStream.close();%0A        return lines.toArray(new String%5Blines.size()%5D);%0A    %7D%0A%0A    private File%5B%5D getLevelNames() %7B%0A        File app = new File(%22app%22);%0A        File folder;%0A        if (app.isDirectory()) %7B%0A            folder = new File(%22app/src/main/assets/levels%22);%0A        %7D else %7B%0A            folder = new File(%22src/main/assets/levels%22);%0A        %7D%0A        return folder.listFiles();%0A    %7D%0A%7D

add test verifying level mode levels