Browse Source

Add TokenPrinterTest, make TokenList::allTokens into Collection

Robin Maisch 4 years ago
parent
commit
5d88170091

+ 1 - 1
jplag.frontend-testutils/src/test/java/de/jplag/testutils/TokenUtils.java

@@ -29,7 +29,7 @@ public final class TokenUtils {
      * @return the immutable list of tokens.
      */
     public static List<Token> tokensByFile(TokenList tokenList, String name) {
-        var tokens = tokenList.stream();
+        var tokens = tokenList.allTokens().stream();
         return tokens.filter(it -> it.getFile().startsWith(name)).toList();
     }
 

+ 2 - 11
jplag.frontend-utils/src/main/java/de/jplag/TokenList.java

@@ -1,9 +1,8 @@
 package de.jplag;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
 
 /**
  * List of tokens. Allows random access to individual tokens. Contains a hash map for token hashes.
@@ -48,7 +47,7 @@ public class TokenList {
      * Returns a view on all tokens.
      * @return all tokens.
      */
-    public Iterable<Token> allTokens() {
+    public Collection<Token> allTokens() {
         return new ArrayList<>(tokens);
     }
 
@@ -65,14 +64,6 @@ public class TokenList {
         return tokens.get(index);
     }
 
-    /**
-     * Returns a sequential Stream of the tokens.
-     * @return a stream of the tokens
-     */
-    public final Stream<Token> stream() {
-        return StreamSupport.stream(allTokens().spliterator(), false);
-    }
-
     @Override
     public final String toString() {
         try {

+ 55 - 107
jplag.frontend-utils/src/main/java/de/jplag/TokenPrinter.java

@@ -7,9 +7,9 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.NoSuchFileException;
 import java.util.*;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
+import java.util.stream.Stream;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,26 +46,25 @@ public final class TokenPrinter {
     /**
      * Creates a string representation of a set of files line by line and adds the tokens under the lines.
      * @param tokens is the set of tokens parsed from the files.
-     * @param directory is the common directory of the files.
+     * @param rootDirectory is the common rootDirectory of the files.
      * @param fileNames is a collection of the file names.
      * @param suffix is the optional view file suffix.
      * @return the string representation.
      */
-    public static String printTokens(TokenList tokens, File directory, Collection<String> fileNames, Optional<String> suffix) {
-        Collection<File> files = fileNames.stream().map(name -> new File(directory, name)).toList();
-        return printTokens(tokens, files, directory, suffix);
+    public static String printTokens(TokenList tokens, File rootDirectory, Collection<String> fileNames, Optional<String> suffix) {
+        Collection<File> files = fileNames.stream().map(name -> new File(rootDirectory, name)).toList();
+        return printTokens(tokens, files, rootDirectory, suffix);
     }
 
     /**
      * Creates a string representation of a set of files line by line and adds the tokens under the lines.
      * @param tokens is the set of tokens parsed from the files.
-     * @param directory is the common directory of the files.
+     * @param rootDirectory is the common rootDirectory of the files.
      * @param fileNames is a collection of the file names.
      * @return the string representation.
      */
-    public static String printTokens(TokenList tokens, File directory, Collection<String> fileNames) {
-        Collection<File> files = fileNames.stream().map(name -> new File(directory, name)).toList();
-        return printTokens(tokens, files, directory, Optional.empty());
+    public static String printTokens(TokenList tokens, File rootDirectory, Collection<String> fileNames) {
+        return printTokens(tokens, rootDirectory, fileNames, Optional.empty());
     }
 
     /**
@@ -74,31 +73,34 @@ public final class TokenPrinter {
      * @param files are the parsed files.
      * @return the string representation.
      */
-    public static String printTokens(TokenList tokens, Collection<File> files, File root) {
-        return printTokens(tokens, files, root, Optional.empty());
+    public static String printTokens(TokenList tokens, Collection<File> files, File rootDirectory) {
+        return printTokens(tokens, files, rootDirectory, Optional.empty());
     }
 
     /**
      * Creates a string representation of a collection of files line by line and adds the tokens under the lines.
      * @param tokenList is the set of tokens parsed from the files.
      * @param files are the parsed files.
-     * @param root is the common directory of the files.
+     * @param rootDirectory is the common directory of the files.
      * @param suffix is the optional view file suffix.
      * @return the string representation.
      */
-    public static String printTokens(TokenList tokenList, Collection<File> files, File root, Optional<String> suffix) {
+    public static String printTokens(TokenList tokenList, Collection<File> files, File rootDirectory, Optional<String> suffix) {
         PrinterOutputBuilder builder = new PrinterOutputBuilder();
-        Map<String, List<LineData>> fileToLineData = getLineData(files, tokenList, suffix, root);
+        Map<String, List<Token>> fileToTokens = groupTokensByFile(tokenList);
 
-        fileToLineData.forEach((String fileName, List<LineData> lineDatas) -> {
+        fileToTokens.forEach((String fileName, List<Token> fileTokens) -> {
             builder.append(fileName);
 
-            LineData.forEachApply(lineDatas, (String file, Integer lineNumber, String currentLine, List<Token> tokens) -> {
-                builder.setLine(lineNumber);
+            var lineDatas = getLineData(fileTokens, rootDirectory);
+            lineDatas.forEach(lineData -> {
+                builder.setLine(lineData.lineNumber());
 
                 // Print (prefix and) code line
+                String currentLine = lineData.text();
                 builder.appendCodeLine(currentLine);
 
+                List<Token> tokens = lineData.tokens();
                 if (tokens.isEmpty()) {
                     return;
                 }
@@ -125,6 +127,7 @@ public final class TokenPrinter {
                 }
 
                 builder.appendTokenLineSuffix();
+                builder.advanceToNextLine();
             });
             builder.advanceToNextLine();
         });
@@ -132,70 +135,40 @@ public final class TokenPrinter {
         return builder.toString();
     }
 
-    /**
-     * Determines the string representation of the token.
-     */
-    private static String getStringRepresentation(Token token) {
-        return token.getLength() <= 1 && INDICATE_TINY_TOKEN ? token.toString().toLowerCase() : token.toString();
-    }
-
-    /**
-     * Turns a list of files into a map which maps the file names to a list of the contained lines of that file.
-     */
-    private static Map<String, List<String>> readFiles(Collection<File> allFiles) {
-        return allFiles.stream().collect(toMap(File::getName, TokenPrinter::linesFromFile));
-    }
-
-    /**
-     * Turns a list of files and a list of tokens into a map of the file name to [a list of LineData objects for the lines
-     * of the file].
-     * @param allFiles a collection of files
-     * @param allTokens a TokenList containing all tokens of the files
-     * @param suffix the optional view file suffix
-     * @param root the root element of the submission
-     * @return map of file -> [LineData]
-     */
-    private static Map<String, List<LineData>> getLineData(Collection<File> allFiles, TokenList allTokens, Optional<String> suffix, File root) {
-        Map<String, List<Token>> filesToTokens = allTokens.stream().collect(Collectors.groupingBy(Token::getFile));
-        Map<String, List<String>> filesToLines = readFiles(allFiles);
+    private static List<LineData> getLineData(List<Token> fileTokens, File root) {
+        // We expect that all fileTokens share the same Token.file!
 
+        String fileName = fileTokens.get(0).getFile();
         // handle 'files as submissions' mode
-        final String EMPTY_STRING = "";
-        if (filesToTokens.containsKey(EMPTY_STRING)) {
-            filesToTokens.put(root.getName(), filesToTokens.get(EMPTY_STRING));
-            filesToTokens.remove(EMPTY_STRING);
-        }
+        File file = fileName.isEmpty() ? root : new File(root, fileName);
 
         // Sort tokens by file and line -> tokens can be processed without any further checks
-        Function<File, List<LineData>> fileToLineDataList = file -> {
-            String fileName = file.getName();
-            String tokenFileName = restoreTokenFileName(file.getName(), suffix);
+        List<String> lines = linesFromFile(file);
 
-            List<String> lines = filesToLines.get(fileName);
-            Map<Integer, List<Token>> lineNumbersToTokens = filesToTokens.get(tokenFileName).stream().collect(Collectors.groupingBy(Token::getLine));
+        Map<Integer, List<Token>> lineNumbersToTokens = fileTokens.stream().collect(Collectors.groupingBy(Token::getLine));
 
-            // create LineData for each line -- 1-based line index
-            return IntStream.range(1, lines.size() + 1).mapToObj(
-                    lineIndex -> new LineData(fileName, lineIndex, lines.get(lineIndex - 1), lineNumbersToTokens.getOrDefault(lineIndex, List.of())))
-                    .filter(lineData -> PRINT_EMPTY_LINES || !lineData.tokens.isEmpty()).toList();
-        };
+        // create LineData for each line -- 1-based line index
+        Stream<Integer> lineNumbers = PRINT_EMPTY_LINES ? IntStream.range(1, lines.size() + 1).boxed() : lineNumbersToTokens.keySet().stream();
+        return lineNumbers.map(lineIndex -> new LineData(lineIndex, lines.get(lineIndex - 1), lineNumbersToTokens.getOrDefault(lineIndex, List.of())))
+                .toList();
+    }
 
-        return allFiles.stream().collect(toMap(File::getName, fileToLineDataList));
+    private static Map<String, List<Token>> groupTokensByFile(TokenList tokenList) {
+        return tokenList.allTokens().stream().collect(Collectors.groupingBy(Token::getFile));
     }
 
     /**
-     * Returns the fileName with the given suffix cut off at the end, if any.
-     * @param fileName the file name with a suffix
-     * @param suffix the suffix to cut off
-     * @return the shortened file name
+     * Determines the string representation of the token.
      */
-    private static String restoreTokenFileName(String fileName, Optional<String> suffix) {
-        if (suffix.isEmpty() || !fileName.endsWith(suffix.get())) {
-            return fileName;
-        }
+    private static String getStringRepresentation(Token token) {
+        return token.getLength() <= 1 && INDICATE_TINY_TOKEN ? token.toString().toLowerCase() : token.toString();
+    }
 
-        int newLength = fileName.length() - suffix.get().length();
-        return fileName.substring(0, newLength);
+    /**
+     * Turns a list of files into a map which maps the file names to a list of the contained lines of that file.
+     */
+    private static Map<String, List<String>> readFiles(Collection<File> allFiles) {
+        return allFiles.stream().collect(toMap(File::getName, TokenPrinter::linesFromFile));
     }
 
     /**
@@ -214,42 +187,12 @@ public final class TokenPrinter {
 
     /**
      * This contains all data concerning a line of code in a file and the tokens found in that line.
-     * @param file the file
      * @param lineNumber the line number inside the file
      * @param text the code line
      * @param tokens the tokens found in the code line
      */
-    private record LineData(String file, Integer lineNumber, String text, List<Token> tokens) {
+    private record LineData(Integer lineNumber, String text, List<Token> tokens) {
 
-        /**
-         * Applies the given LineDataConsumer to this LineData.
-         * @param consumer the LineDataConsumer
-         */
-        public void apply(LineDataConsumer consumer) {
-            consumer.apply(file, lineNumber, text, tokens);
-        }
-
-        /**
-         * Convenience method to apply a LineDataConsumer to all lineDatas in the given collection.
-         * @param lineDatas the LineData objects to apply the consumer to
-         * @param consumer the LineDataConsumer to apply
-         */
-        public static void forEachApply(Collection<LineData> lineDatas, LineDataConsumer consumer) {
-            lineDatas.forEach(lineData -> lineData.apply(consumer));
-        }
-
-        /**
-         * The LineDataConsumer interface allows to declare variables for all fields of a LineData object in a functional
-         * interface, thus saving manually declaring variables for each one.
-         */
-        @FunctionalInterface
-        interface LineDataConsumer {
-            void apply(String file, Integer lineNumber, String text, List<Token> tokens);
-
-            default void apply(LineData lineData) {
-                apply(lineData.file, lineData.lineNumber, lineData.text, lineData.tokens);
-            }
-        }
     }
 
     /**
@@ -286,7 +229,7 @@ public final class TokenPrinter {
         public PrinterOutputBuilder append(String str) {
             // Avoid too many blank lines
             trailingLineSeparators = str.equals(LINE_SEPARATOR) ? trailingLineSeparators + 1 : 0;
-            if (trailingLineSeparators >= 2)
+            if (trailingLineSeparators >= 3)
                 return this;
 
             builder.append(str);
@@ -343,7 +286,7 @@ public final class TokenPrinter {
          */
         PrinterOutputBuilder advanceToTokenPosition(String currentLine, int targetPosition, boolean breakLine) {
             targetPosition = Math.min(targetPosition, currentLine.length());
-            if (positionBeforeOrEqualTo(targetPosition)) {
+            if (!positionBeforeOrEqualTo(targetPosition)) {
                 if (!breakLine) {
                     // we are past targetPosition, do nothing
                     return this;
@@ -351,15 +294,18 @@ public final class TokenPrinter {
 
                 // new line
                 appendTokenLinePrefix();
-                if (positionBeforeOrEqualTo(targetPosition)) {
+                if (!positionBeforeOrEqualTo(targetPosition)) {
                     // still past targetPosition -> negative targetPosition
                     return this;
                 }
             }
 
             // The replacement operation preserves TAB characters, which is essential for correct alignment
-            String padding = currentLine.substring(columnIndex - 1, targetPosition - 1).replace(TAB, REPLACE_TABS ? TAB_REPLACEMENT : TAB)
-                    .replace(NON_WHITESPACE, SPACE);
+            String padding = currentLine.substring(columnIndex - 1, targetPosition - 1)
+                    // TAB is a string, so use replace
+                    .replace(TAB, REPLACE_TABS ? TAB_REPLACEMENT : TAB)
+                    // NON_WHITESPACE is a pattern, so use replaceAll
+                    .replaceAll(NON_WHITESPACE, SPACE);
             append(padding);
 
             return this;
@@ -371,7 +317,7 @@ public final class TokenPrinter {
          * @return true if before or at target position
          */
         private boolean positionBeforeOrEqualTo(int targetPosition) {
-            return columnIndex > targetPosition;
+            return columnIndex <= targetPosition;
         }
 
         /**
@@ -380,7 +326,9 @@ public final class TokenPrinter {
          */
         PrinterOutputBuilder appendTokenLinePrefix() {
             int paddingLength = Math.max(digitCount(lineNumber) + MIN_PADDING, TAB_LENGTH);
-            return advanceToNextLine().appendPadding(paddingLength);
+            advanceToNextLine().appendPadding(paddingLength);
+            resetLinePosition();
+            return this;
         }
 
         /**

+ 19 - 0
jplag.frontend-utils/src/test/java/de/jplag/TestToken.java

@@ -0,0 +1,19 @@
+package de.jplag;
+
+import static de.jplag.TokenConstants.FILE_END;
+import static de.jplag.simple.TestTokenConstants.STRING;
+
+public class TestToken extends Token {
+    public TestToken(int tokenType, String file, int line, int column, int length) {
+        super(tokenType, file, line, column, length);
+    }
+
+    @Override
+    protected String type2string() {
+        return switch (type) {
+            case STRING -> "STRING";
+            case FILE_END -> "<EOF>";
+            default -> "<UNKNOWN%d>".formatted(type);
+        };
+    }
+}

+ 61 - 0
jplag.frontend-utils/src/test/java/de/jplag/TokenPrinterTest.java

@@ -0,0 +1,61 @@
+package de.jplag;
+
+import org.junit.jupiter.api.Test;
+
+import java.nio.file.Path;
+import java.util.List;
+
+import static de.jplag.TokenConstants.FILE_END;
+import static de.jplag.simple.TestTokenConstants.STRING;
+
+public class TokenPrinterTest {
+
+    private static final Path TEST_FILE_LOCATION = Path.of("src", "test", "resources", "de", "jplag", "samples");
+    private static final String TEST_FILE_NAME = "TokenprinterTest.txt";
+
+    /**
+     * Tests the function of the TokenPrinter
+     */
+    @Test
+    void printMockDirectoriesAsSubmissions() {
+
+        // See TokenPrinterTest.txt for the intended behaviour
+        TokenList tokens = new TokenList();
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 1, 1, "STRING".length()));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 2, 1, "STRING".length() + 1));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 3, 1, "STRING".length() + 2));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 4, 1, "STRING".length() + 10));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 6, 3, 1));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 7, 9, 1));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 9, 1, 1));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 9, 10, 1));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 10, 1, 1));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 10, 5, 1));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 12, 1, 1));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 10, 5, 1));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 12, 10, 1));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 14, 10, 1));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 14, 5, 1));
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 14, 1, 1));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 16, -5, 1));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 19, 100, 1));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 22, 1, 100));
+
+        tokens.addToken(new TestToken(FILE_END, TEST_FILE_NAME, 24, 1, -1));
+
+        tokens.addToken(new TestToken(STRING, TEST_FILE_NAME, 100, 1, 1));
+
+        String output = TokenPrinter.printTokens(tokens, TEST_FILE_LOCATION.toFile(), List.of(TEST_FILE_NAME));
+        System.out.print(output); // no additional newline required
+    }
+}
+
+

+ 5 - 0
jplag.frontend-utils/src/test/java/de/jplag/simple/TestTokenConstants.java

@@ -0,0 +1,5 @@
+package de.jplag.simple;
+
+public interface TestTokenConstants {
+    int STRING = 2;
+}

+ 26 - 0
jplag.frontend-utils/src/test/resources/de/jplag/samples/TokenPrinterTest.txt

@@ -0,0 +1,26 @@
+|----| 				token shorter than label, no bar printed
+|-----| 			token exactly as long as label, no bar printed
+|------|			token at minimal length for bar to be printed
+|--------------|	token much longer than label, padding + bar
+
+		|			token starts after TAB indentation
+        |			token starts after SPACE indentation
+
+|        | 			multiple tokens fitting in one line
+|   |      			multiple tokens where the labels overlap
+
+|   |    | 			token in the middle is set to previous line -- saved by TokenList::addToken method
+
+|   |    | 			token in this line are in reverse order -- that's okay
+
+|					negative column index leads to redundant blank line
+
+	|      |		one line below: column index greater than line length -- beginning printed at last character of the line
+           #
+
+|              |	one line below: length of token exceeds line length -- ending bar printed at last character of the line
+               #
+
+|					negative length -- no effect
+
+					token with position after EOF is not printed

+ 1 - 1
jplag.frontend.csharp-6/src/test/java/de/jplag/csharp/MinimalCSharpFrontendTest.java

@@ -50,7 +50,7 @@ class MinimalCSharpFrontendTest {
 
         // Compare parsed tokens:
         assertEquals(expectedToken.size(), result.size());
-        List<Integer> actualToken = result.stream().map(Token::getType).collect(toList());
+        List<Integer> actualToken = result.allTokens().stream().map(Token::getType).collect(toList());
         assertEquals(expectedToken, actualToken);
     }
 

+ 1 - 1
jplag.frontend.golang/src/test/java/de/jplag/golang/GoFrontendTest.java

@@ -157,7 +157,7 @@ class GoFrontendTest {
      * @param fileName The file name of the complete code example
      */
     private void testTokenCoverage(TokenList tokens, String fileName) {
-        var foundTokens = tokens.stream().parallel().mapToInt(Token::getType).sorted().distinct().boxed().toList();
+        var foundTokens = tokens.allTokens().stream().parallel().mapToInt(Token::getType).sorted().distinct().boxed().toList();
 
         // Exclude SEPARATOR_TOKEN, as it does not occur
         var missingTokenTypes = IntStream.range(0, GoTokenConstants.NUM_DIFF_TOKENS).filter(i -> i != TokenConstants.SEPARATOR_TOKEN).boxed()

+ 1 - 1
jplag.frontend.kotlin/src/test/java/de/jplag/kotlin/KotlinFrontendTest.java

@@ -153,7 +153,7 @@ class KotlinFrontendTest {
      * @param fileName The file name of the complete code example
      */
     private void testTokenCoverage(TokenList tokens, String fileName) {
-        var foundTokens = tokens.stream().parallel().mapToInt(Token::getType).sorted().distinct().toArray();
+        var foundTokens = tokens.allTokens().stream().parallel().mapToInt(Token::getType).sorted().distinct().toArray();
         // Exclude SEPARATOR_TOKEN, as it does not occur
         var allTokens = IntStream.range(0, KotlinTokenConstants.NUMBER_DIFF_TOKENS).filter(i -> i != TokenConstants.SEPARATOR_TOKEN).toArray();
 

+ 1 - 1
jplag.frontend.rlang/src/test/java/de/jplag/rlang/RFrontendTest.java

@@ -92,7 +92,7 @@ class RFrontendTest {
      * @param fileName The file name of the complete code example
      */
     private void testTokenCoverage(TokenList tokens, String fileName) {
-        var foundTokens = tokens.stream().parallel().mapToInt(Token::getType).sorted().distinct().toArray();
+        var foundTokens = tokens.allTokens().stream().parallel().mapToInt(Token::getType).sorted().distinct().toArray();
         // Exclude SEPARATOR_TOKEN, as it does not occur
         var allTokens = IntStream.range(0, RTokenConstants.NUM_DIFF_TOKENS).filter(i -> i != TokenConstants.SEPARATOR_TOKEN).toArray();
 

+ 1 - 1
jplag.frontend.scala/src/test/java/de/jplag/scala/ScalaFrontendTest.java

@@ -161,7 +161,7 @@ class ScalaFrontendTest {
      * @param fileName The file name of the complete code example
      */
     private void testTokenCoverage(TokenList tokens, String fileName) {
-        var foundTokens = tokens.stream().parallel().mapToInt(Token::getType).distinct().boxed().toList();
+        var foundTokens = tokens.allTokens().stream().parallel().mapToInt(Token::getType).distinct().boxed().toList();
         var allTokens = IntStream.range(0, ScalaTokenConstants.numberOfTokens()).boxed().toList();
         allTokens = new ArrayList<>(allTokens);
 

+ 5 - 3
jplag/src/test/java/de/jplag/TestBase.java

@@ -3,6 +3,7 @@ package de.jplag;
 import java.io.File;
 import java.nio.file.Path;
 import java.util.List;
+import java.util.StringJoiner;
 import java.util.function.Consumer;
 
 import de.jplag.exceptions.ExitException;
@@ -20,11 +21,12 @@ public abstract class TestBase {
     }
 
     protected String getBasePath(String... subs) {
-        String path = BASE_PATH;
+        StringJoiner joiner = new StringJoiner(File.separator);
+        joiner.add(BASE_PATH);
         for (String sub : subs) {
-            path += File.separator + sub;
+            joiner.add(sub);
         }
-        return path;
+        return joiner.toString();
     }
 
     protected JPlagResult runJPlagWithExclusionFile(String testSampleName, String exclusionFileName) throws ExitException {

+ 1 - 20
jplag/src/test/java/de/jplag/special/TokenPrinterTest.java

@@ -7,10 +7,7 @@ import java.util.function.Consumer;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
-import de.jplag.JPlagResult;
-import de.jplag.Submission;
-import de.jplag.TestBase;
-import de.jplag.TokenPrinter;
+import de.jplag.*;
 import de.jplag.exceptions.ExitException;
 import de.jplag.options.JPlagOptions;
 import de.jplag.options.LanguageOption;
@@ -25,7 +22,6 @@ public class TokenPrinterTest extends TestBase {
 
     private static final int MIN_TOKEN_MATCH = 5;
     private static final String PRINTER_FOLDER = "PRINTER"; // in the folder 'jplag/src/test/resources/samples'
-    private static final String FILES_AS_SUBMISSIONS = "FilesAsSubmissions"; // in the folder 'jplag/src/test/resources/samples'
 
     @Disabled
     @Test
@@ -65,21 +61,6 @@ public class TokenPrinterTest extends TestBase {
         printSubmissions(options -> options.setLanguageOption(LanguageOption.KOTLIN));
     }
 
-    @Test
-    void printFilesAsSubmissions() {
-        try {
-            JPlagResult result = runJPlag(FILES_AS_SUBMISSIONS, options -> {
-            });
-            for (Submission submission : result.getSubmissions().getSubmissions()) {
-                printSubmission(submission);
-            }
-            System.out.println("JPlag printed " + result.getSubmissions().numberOfSubmissions() + " valid submissions!");
-        } catch (ExitException exception) {
-            System.err.println("JPlag threw Error: " + exception.getMessage());
-            fail();
-        }
-    }
-
     private void printSubmissions(Consumer<JPlagOptions> optionsCustomization) {
         try {
             JPlagResult result = runJPlag(PRINTER_FOLDER, optionsCustomization);