Skip to content
Snippets Groups Projects
Commit 07fff375 authored by Johannes Mey's avatar Johannes Mey
Browse files

use assertj to compare serialization results

parent b8709e5a
No related branches found
No related tags found
1 merge request!1Mquat2
Pipeline #3039 passed
......@@ -21,6 +21,7 @@ buildscript {
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.0'
testCompile 'org.assertj:assertj-core:3.12.1'
compile 'com.fasterxml.jackson.core:jackson-core:2.9.8'
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
runtime 'org.jastadd:jastadd:2.3.2'
......
......@@ -4,6 +4,9 @@ import org.junit.jupiter.api.Test;
import serializer.ast.*;
import java.io.File;
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@SuppressWarnings("ArraysAsListWithZeroOrOneArgument")
......@@ -11,7 +14,7 @@ class Serializer {
@Test
void testDi1() throws SerializationException, DeserializationException {
void testDi1() throws SerializationException, DeserializationException, IOException {
Root r = new Root();
A a1 = new A("a1");
......@@ -87,12 +90,16 @@ class Serializer {
a1.addBi9(b2);
a2.addBi9(b2);
File f = new File("test.json");
File f = File.createTempFile("original", ".json");
System.out.println(f.getAbsoluteFile());
r.serialize(f);
Root copy = Root.deserialize(f);
File f2 = new File("copy.json");
File f2 = File.createTempFile("copy", ".json");
copy.serialize(f2);
assertThat(f2).hasSameContentAs(f);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment