Skip to content

Commit

Permalink
add file compare to unit test refs Edirom/MEIGarage#13
Browse files Browse the repository at this point in the history
  • Loading branch information
anneferger committed Apr 10, 2024
1 parent 4433d2b commit 338a57f
Show file tree
Hide file tree
Showing 3 changed files with 2,195 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
!*.yml
!test-input.*.zip
!required.sh
!expected-output.svg
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package de.edirom.meigarage.verovio;

import pl.psnc.dl.ege.configuration.EGEConfigurationManager;
import pl.psnc.dl.ege.exception.ConverterException;
import pl.psnc.dl.ege.types.ConversionActionArguments;
import pl.psnc.dl.ege.types.DataType;

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;

import static org.junit.Assert.*;

Expand Down Expand Up @@ -33,8 +36,14 @@ public void convert() throws IOException, ConverterException {
String tempDir = "src/test/temp";
converter.convert(is, os, conversionActionArguments, tempDir);
assertNotNull(new File("src/test/resources/output.svg.zip"));
InputStream isout = new FileInputStream("src/test/resources/output.svg.zip");
EGEConfigurationManager.getInstance().getStandardIOResolver().decompressStream(isout, new File("src/test/resources/output.svg"));
assertEquals("Files differ",
new String(Files.readAllBytes(Paths.get("src/test/resources/expected-output.svg"))).replaceAll("id=\"[\\s\\S]*?\"|xlink:href=\"[\\s\\S]*?\"|class=\"[\\s\\S]*?\"",""),
new String(Files.readAllBytes(Paths.get("src/test/resources/output.svg/output_001.svg"))).replaceAll("id=\"[\\s\\S]*?\"|xlink:href=\"[\\s\\S]*?\"|class=\"[\\s\\S]*?\"",""));
is.close();
os.close();
isout.close();
}

@org.junit.Test
Expand Down
Loading

0 comments on commit 338a57f

Please sign in to comment.