dhp-schemas tests upgraded to junit5

This commit is contained in:
Claudio Atzori 2020-03-25 17:38:58 +01:00
parent 56f5a4eeab
commit 3e8f6981c4
2 changed files with 14 additions and 11 deletions

View File

@ -3,11 +3,16 @@ package eu.dnetlib.dhp.schema.action;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.schema.oaf.Relation; import eu.dnetlib.dhp.schema.oaf.Relation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.io.IOException; import java.io.IOException;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author claudio.atzori
*/
public class AtomicActionTest { public class AtomicActionTest {
@Test @Test
@ -25,12 +30,12 @@ public class AtomicActionTest {
final ObjectMapper mapper = new ObjectMapper(); final ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(aa1); String json = mapper.writeValueAsString(aa1);
Assert.assertTrue(StringUtils.isNotBlank(json)); assertTrue(StringUtils.isNotBlank(json));
AtomicAction aa2 = mapper.readValue(json, AtomicAction.class); AtomicAction aa2 = mapper.readValue(json, AtomicAction.class);
Assert.assertEquals(aa1.getClazz(), aa2.getClazz()); assertEquals(aa1.getClazz(), aa2.getClazz());
Assert.assertEquals(aa1.getPayload(), aa2.getPayload()); assertEquals(aa1.getPayload(), aa2.getPayload());
} }

View File

@ -1,11 +1,9 @@
package eu.dnetlib.dhp.schema.oaf; package eu.dnetlib.dhp.schema.oaf;
import org.junit.Assert; import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -44,8 +42,8 @@ public class MergeTest {
a.mergeFrom(b); a.mergeFrom(b);
Assert.assertNotNull(a.getCollectedfrom()); assertNotNull(a.getCollectedfrom());
Assert.assertEquals(3, a.getCollectedfrom().size()); assertEquals(3, a.getCollectedfrom().size());
} }
@ -60,8 +58,8 @@ public class MergeTest {
a.mergeFrom(b); a.mergeFrom(b);
Assert.assertNotNull(a.getSubject()); assertNotNull(a.getSubject());
Assert.assertEquals(3, a.getSubject().size()); assertEquals(3, a.getSubject().size());
} }