From 3e8f6981c4e3184b2f5698f9f4d6906a85013b59 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Wed, 25 Mar 2020 17:38:58 +0100 Subject: [PATCH] dhp-schemas tests upgraded to junit5 --- .../dnetlib/dhp/schema/action/AtomicActionTest.java | 13 +++++++++---- .../java/eu/dnetlib/dhp/schema/oaf/MergeTest.java | 12 +++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/dhp-schemas/src/test/java/eu/dnetlib/dhp/schema/action/AtomicActionTest.java b/dhp-schemas/src/test/java/eu/dnetlib/dhp/schema/action/AtomicActionTest.java index 9ff4f5aac..d216c05d5 100644 --- a/dhp-schemas/src/test/java/eu/dnetlib/dhp/schema/action/AtomicActionTest.java +++ b/dhp-schemas/src/test/java/eu/dnetlib/dhp/schema/action/AtomicActionTest.java @@ -3,11 +3,16 @@ package eu.dnetlib.dhp.schema.action; import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.dhp.schema.oaf.Relation; import org.apache.commons.lang3.StringUtils; -import org.junit.Assert; + import org.junit.jupiter.api.Test; import java.io.IOException; +import static org.junit.jupiter.api.Assertions.*; + +/** + * @author claudio.atzori + */ public class AtomicActionTest { @Test @@ -25,12 +30,12 @@ public class AtomicActionTest { final ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(aa1); - Assert.assertTrue(StringUtils.isNotBlank(json)); + assertTrue(StringUtils.isNotBlank(json)); AtomicAction aa2 = mapper.readValue(json, AtomicAction.class); - Assert.assertEquals(aa1.getClazz(), aa2.getClazz()); - Assert.assertEquals(aa1.getPayload(), aa2.getPayload()); + assertEquals(aa1.getClazz(), aa2.getClazz()); + assertEquals(aa1.getPayload(), aa2.getPayload()); } diff --git a/dhp-schemas/src/test/java/eu/dnetlib/dhp/schema/oaf/MergeTest.java b/dhp-schemas/src/test/java/eu/dnetlib/dhp/schema/oaf/MergeTest.java index fb192dc23..ac4bd5d27 100644 --- a/dhp-schemas/src/test/java/eu/dnetlib/dhp/schema/oaf/MergeTest.java +++ b/dhp-schemas/src/test/java/eu/dnetlib/dhp/schema/oaf/MergeTest.java @@ -1,11 +1,9 @@ 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.Test; -import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -44,8 +42,8 @@ public class MergeTest { a.mergeFrom(b); - Assert.assertNotNull(a.getCollectedfrom()); - Assert.assertEquals(3, a.getCollectedfrom().size()); + assertNotNull(a.getCollectedfrom()); + assertEquals(3, a.getCollectedfrom().size()); } @@ -60,8 +58,8 @@ public class MergeTest { a.mergeFrom(b); - Assert.assertNotNull(a.getSubject()); - Assert.assertEquals(3, a.getSubject().size()); + assertNotNull(a.getSubject()); + assertEquals(3, a.getSubject().size()); }