diff --git a/pom.xml b/pom.xml index 9458c8fb..7d5fe1f5 100644 --- a/pom.xml +++ b/pom.xml @@ -319,9 +319,9 @@ - junit - junit - 4.13.1 + org.junit.jupiter + junit-jupiter + 5.9.1 test @@ -347,6 +347,11 @@ + + + maven-surefire-plugin + 2.22.2 + org.apache.maven.plugins @@ -364,7 +369,7 @@ false false true - junit + junit-jupiter @@ -542,4 +547,4 @@ - \ No newline at end of file + diff --git a/src/test/java/org/segrada/model/ColorTest.java b/src/test/java/org/segrada/model/ColorTest.java index b9358508..dc998d31 100644 --- a/src/test/java/org/segrada/model/ColorTest.java +++ b/src/test/java/org/segrada/model/ColorTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,13 +9,13 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class ColorTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -32,28 +32,28 @@ public void testValidColor() throws Exception { color.setTitle("Example title"); color.setColor(123456); Set> constraintViolations = validator.validate(color); - assertTrue("Color not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Color not valid"); } @Test public void testTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Color.class, "title", null); - assertTrue("Title empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title empty"); } @Test public void testTitleTooShort() throws Exception { Set> constraintViolations = validator.validateValue(Color.class, "title", ""); - assertTrue("Title too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title too short"); } @Test public void testColorEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Color.class, "color", null); - assertTrue("Color empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Color empty"); constraintViolations = validator.validateValue(Color.class, "color", 0); - assertTrue("Color can be 0!", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Color can be 0!"); } @Test @@ -159,4 +159,4 @@ public void testGetB() throws Exception { color.setColorCode("#ffff33"); assertEquals(51, color.getB()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/CommentTest.java b/src/test/java/org/segrada/model/CommentTest.java index 12a3f40b..152453a1 100644 --- a/src/test/java/org/segrada/model/CommentTest.java +++ b/src/test/java/org/segrada/model/CommentTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,13 +9,13 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class CommentTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -32,24 +32,24 @@ public void testValidComment() throws Exception { comment.setText("Example text"); comment.setMarkup("DUMMY"); Set> constraintViolations = validator.validate(comment); - assertTrue("Comment not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Comment not valid"); } @Test public void testTextEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Comment.class, "text", null); - assertTrue("Text empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Text empty"); } @Test public void testTextTooShort() throws Exception { Set> constraintViolations = validator.validateValue(Comment.class, "text", ""); - assertTrue("Text too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Text too short"); } @Test public void testmarkupEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Comment.class, "markup", null); - assertTrue("Markup empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Markup empty"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/FileTest.java b/src/test/java/org/segrada/model/FileTest.java index 273cc95a..ecd44b01 100644 --- a/src/test/java/org/segrada/model/FileTest.java +++ b/src/test/java/org/segrada/model/FileTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,7 +9,7 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class FileTest { @@ -17,7 +17,7 @@ public class FileTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -52,49 +52,49 @@ public void testValidFile() throws Exception { file.setData(fileData); file.setDescriptionMarkup("default"); Set> constraintViolations = validator.validate(file); - assertTrue("File not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "File not valid"); } @Test public void testFilenameEmpty() throws Exception { Set> constraintViolations = validator.validateValue(File.class, "filename", null); - assertTrue("Filename empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Filename empty"); } @Test public void testFilenameTooShort() throws Exception { Set> constraintViolations = validator.validateValue(File.class, "filename", ""); - assertTrue("Filename too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Filename too short"); } @Test public void testMimeTypeEmpty() throws Exception { Set> constraintViolations = validator.validateValue(File.class, "mimeType", null); - assertTrue("MimeType empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "MimeType empty"); } @Test public void testMimeTypeTooShort() throws Exception { Set> constraintViolations = validator.validateValue(File.class, "mimeType", ""); - assertTrue("MimeType too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "MimeType too short"); } @Test public void testIndexFullTextEmpty() throws Exception { Set> constraintViolations = validator.validateValue(File.class, "indexFullText", null); - assertTrue("indexFullText empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "indexFullText empty"); } @Test public void testContainFileEmpty() throws Exception { Set> constraintViolations = validator.validateValue(File.class, "containFile", null); - assertTrue("containFile empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "containFile empty"); } @Test public void testDescriptionMarkupEmpty() throws Exception { Set> constraintViolations = validator.validateValue(File.class, "descriptionMarkup", null); - assertTrue("Description markup empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Description markup empty"); } @Test @@ -116,4 +116,4 @@ public void testGetMimeType() throws Exception { file.setFilename("filename.png"); assertEquals("image", file.getFileType()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/LocationTest.java b/src/test/java/org/segrada/model/LocationTest.java index a284924b..2a89cd93 100644 --- a/src/test/java/org/segrada/model/LocationTest.java +++ b/src/test/java/org/segrada/model/LocationTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,13 +9,13 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class LocationTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -35,51 +35,51 @@ public void testValidLocation() throws Exception { location.setLongitude(21.0); location.setComment(null); Set> constraintViolations = validator.validate(location); - assertTrue("Location not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Location not valid"); } @Test public void testParentEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Location.class, "parentId", null); - assertTrue("Parent Id empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Parent Id empty"); constraintViolations = validator.validateValue(Location.class, "parentModel", null); - assertTrue("Parent model empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Parent model empty"); } @Test public void testLatitudeEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Location.class, "latitude", null); - assertTrue("Latitude empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Latitude empty"); } @Test public void testLatitudeTooLow() throws Exception { Set> constraintViolations = validator.validateValue(Location.class, "latitude", -500); - assertTrue("Latitude too low", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Latitude too low"); } @Test public void testLatitudeTooHigh() throws Exception { Set> constraintViolations = validator.validateValue(Location.class, "latitude", 500); - assertTrue("Latitude too high", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Latitude too high"); } @Test public void testLongitudeEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Location.class, "longitude", null); - assertTrue("Longitude empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Longitude empty"); } @Test public void testLongitudeTooLow() throws Exception { Set> constraintViolations = validator.validateValue(Location.class, "longitude", -500); - assertTrue("Longitude too low", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Longitude too low"); } @Test public void testLongitudeTooHigh() throws Exception { Set> constraintViolations = validator.validateValue(Location.class, "longitude", 500); - assertTrue("Longitude too high", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Longitude too high"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/NodeTest.java b/src/test/java/org/segrada/model/NodeTest.java index cd8b21f9..811cff53 100644 --- a/src/test/java/org/segrada/model/NodeTest.java +++ b/src/test/java/org/segrada/model/NodeTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,15 +9,15 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class NodeTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -45,31 +45,31 @@ public void testValidNode() throws Exception { node.setAlternativeTitles(""); node.setDescription("Description"); Set> constraintViolations = validator.validate(node); - assertTrue("Node not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Node not valid"); } @Test public void testTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Node.class, "title", null); - assertTrue("Title empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title empty"); } @Test public void testTitleTooShort() throws Exception { Set> constraintViolations = validator.validateValue(Node.class, "title", ""); - assertTrue("Title too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title too short"); } @Test public void testAlternativeTitlesEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Node.class, "alternativeTitles", null); - assertTrue("Alternative titles empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Alternative titles empty"); } @Test public void testDescriptionEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Node.class, "description", null); - assertTrue("Description empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Description empty"); } /*@Test can be "" for now @@ -81,6 +81,6 @@ public void testDescriptionTooShort() throws Exception { @Test public void testDescriptionMarkupEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Node.class, "descriptionMarkup", null); - assertTrue("Description markup empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Description markup empty"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/PeriodTest.java b/src/test/java/org/segrada/model/PeriodTest.java index 96550eac..c7c6b546 100644 --- a/src/test/java/org/segrada/model/PeriodTest.java +++ b/src/test/java/org/segrada/model/PeriodTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,13 +9,13 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class PeriodTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -34,7 +34,7 @@ public void testValidPeriod() throws Exception { period.setFromEntry("21.05.2000"); period.setToEntry("22.05.2009"); Set> constraintViolations = validator.validate(period); - assertTrue("Period not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Period not valid"); assertEquals("period", period.getType()); assertEquals(new Long(2451686L), period.getFromJD()); @@ -50,7 +50,7 @@ public void testFromAfterTo() throws Exception { period.setFromEntry("21.05.2009"); period.setToEntry("22.05.2000"); Set> constraintViolations = validator.validate(period); - assertTrue("Invalid Period is valid", constraintViolations.size() > 0); + assertTrue(constraintViolations.size() > 0, "Invalid Period is valid"); } @Test @@ -62,12 +62,12 @@ public void testNothingSet() throws Exception { period.setFromEntry(""); period.setToEntry(""); Set> constraintViolations = validator.validate(period); - assertTrue("Invalid Period is valid", constraintViolations.size() > 0); + assertTrue(constraintViolations.size() > 0, "Invalid Period is valid"); period.setFromEntry(null); period.setToEntry(null); constraintViolations = validator.validate(period); - assertTrue("Invalid Period is valid", constraintViolations.size() > 0); + assertTrue(constraintViolations.size() > 0, "Invalid Period is valid"); } @Test @@ -134,58 +134,58 @@ public void testType() throws Exception { @Test public void testParentEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Period.class, "parentId", null); - assertTrue("Parent Id empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Parent Id empty"); constraintViolations = validator.validateValue(Period.class, "parentModel", null); - assertTrue("Parent model empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Parent model empty"); } @Test public void testFromEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Period.class, "fromJD", null); - assertTrue("from empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "from empty"); } @Test public void testToEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Period.class, "toJD", null); - assertTrue("to empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "to empty"); } @Test public void testFromEntryCalendarEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Period.class, "fromEntryCalendar", null); - assertTrue("fromEntryCalendar empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "fromEntryCalendar empty"); } @Test public void testToEntryCalendarEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Period.class, "toEntryCalendar", null); - assertTrue("toEntryCalendar empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "toEntryCalendar empty"); } @Test public void testFromEntryCalendarValidSettings() throws Exception { Set> constraintViolations = validator.validateValue(Period.class, "fromEntryCalendar", "G"); - assertTrue("fromEntryCalendar settings", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "fromEntryCalendar settings"); constraintViolations = validator.validateValue(Period.class, "fromEntryCalendar", "J"); - assertTrue("fromEntryCalendar settings", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "fromEntryCalendar settings"); constraintViolations = validator.validateValue(Period.class, "fromEntryCalendar", ""); - assertTrue("fromEntryCalendar settings", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "fromEntryCalendar settings"); } @Test public void testToEntryCalendarValidSettings() throws Exception { Set> constraintViolations = validator.validateValue(Period.class, "toEntryCalendar", "G"); - assertTrue("toEntryCalendar settings", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "toEntryCalendar settings"); constraintViolations = validator.validateValue(Period.class, "toEntryCalendar", "J"); - assertTrue("toEntryCalendar settings", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "toEntryCalendar settings"); constraintViolations = validator.validateValue(Period.class, "toEntryCalendar", ""); - assertTrue("toEntryCalendar settings", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "toEntryCalendar settings"); } @Test @@ -278,4 +278,4 @@ public void testGetFuzzyToFlag() throws Exception { assertArrayEquals(new char[]{'c'}, period.getFuzzyToFlags()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/PictogramTest.java b/src/test/java/org/segrada/model/PictogramTest.java index db363cf0..50d2cdfd 100644 --- a/src/test/java/org/segrada/model/PictogramTest.java +++ b/src/test/java/org/segrada/model/PictogramTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,8 +9,8 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class PictogramTest { @@ -18,7 +18,7 @@ public class PictogramTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -42,18 +42,18 @@ public void testValidPictogram() throws Exception { pictogram.setTitle("Example Titel"); pictogram.setData(pictureData); Set> constraintViolations = validator.validate(pictogram); - assertTrue("Pictogram not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Pictogram not valid"); } @Test public void testTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Pictogram.class, "title", null); - assertTrue("Title empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title empty"); } @Test public void testTitleTooShort() throws Exception { Set> constraintViolations = validator.validateValue(Pictogram.class, "title", "T"); - assertTrue("Title too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title too short"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/RelationTest.java b/src/test/java/org/segrada/model/RelationTest.java index 2743bb53..319cf6a1 100644 --- a/src/test/java/org/segrada/model/RelationTest.java +++ b/src/test/java/org/segrada/model/RelationTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.segrada.model.prototype.INode; import org.segrada.model.prototype.IRelation; import org.segrada.model.prototype.IRelationType; @@ -12,13 +12,13 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class RelationTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -48,31 +48,31 @@ public void testValidRelation() throws Exception { relation.setFromEntity(fromNode); relation.setToEntity(toNode); Set> constraintViolations = validator.validate(relation); - assertTrue("Relation not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Relation not valid"); } @Test public void testRelationTypeEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Relation.class, "relationType", null); - assertTrue("RelationType empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "RelationType empty"); } @Test public void testFromEntityEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Relation.class, "fromEntity", null); - assertTrue("FromEntity empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "FromEntity empty"); } @Test public void testToEntityEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Relation.class, "toEntity", null); - assertTrue("ToEntity empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "ToEntity empty"); } @Test public void testDescriptionEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Relation.class, "description", null); - assertTrue("Description empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Description empty"); } /*@Test can be "" for now @@ -84,7 +84,7 @@ public void testDescriptionTooShort() throws Exception { @Test public void testDescriptionMarkupEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Relation.class, "descriptionMarkup", null); - assertTrue("Description markup empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Description markup empty"); } @Test @@ -106,4 +106,4 @@ public void testGetReversedTitle() throws Exception { assertEquals("to⇒xtox⇒from", relation.getReversedTitle()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/RelationTypeTest.java b/src/test/java/org/segrada/model/RelationTypeTest.java index 96ef2e06..c6216fc3 100644 --- a/src/test/java/org/segrada/model/RelationTypeTest.java +++ b/src/test/java/org/segrada/model/RelationTypeTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,15 +9,15 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class RelationTypeTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -46,37 +46,37 @@ public void testValidRelationType() throws Exception { relationType.setDescription("Description"); relationType.setDescriptionMarkup("default"); Set> constraintViolations = validator.validate(relationType); - assertTrue("Relation Type not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Relation Type not valid"); } @Test public void testFromTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(RelationType.class, "fromTitle", null); - assertTrue("fromTitle empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "fromTitle empty"); } @Test public void testFromTitleTooShort() throws Exception { Set> constraintViolations = validator.validateValue(RelationType.class, "fromTitle", ""); - assertTrue("fromTitle too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "fromTitle too short"); } @Test public void testToTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(RelationType.class, "toTitle", null); - assertTrue("toTitle empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "toTitle empty"); } @Test public void testToTitleTooShort() throws Exception { Set> constraintViolations = validator.validateValue(RelationType.class, "toTitle", ""); - assertTrue("toTitle too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "toTitle too short"); } @Test public void testDescriptionEmpty() throws Exception { Set> constraintViolations = validator.validateValue(RelationType.class, "description", null); - assertTrue("Description empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Description empty"); } /*@Test @@ -88,6 +88,6 @@ public void testDescriptionTooShort() throws Exception { @Test public void testDescriptionMarkupEmpty() throws Exception { Set> constraintViolations = validator.validateValue(RelationType.class, "descriptionMarkup", null); - assertTrue("Description markup empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Description markup empty"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/SavedQueryTest.java b/src/test/java/org/segrada/model/SavedQueryTest.java index 41611ec7..c8176e96 100644 --- a/src/test/java/org/segrada/model/SavedQueryTest.java +++ b/src/test/java/org/segrada/model/SavedQueryTest.java @@ -2,8 +2,8 @@ import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONObject; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -11,13 +11,13 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class SavedQueryTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -36,31 +36,31 @@ public void testValidNode() throws Exception { savedQuery.setDescription("Description"); savedQuery.setData("Data"); Set> constraintViolations = validator.validate(savedQuery); - assertTrue("Node not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Node not valid"); } @Test public void testTypeEmpty() throws Exception { Set> constraintViolations = validator.validateValue(SavedQuery.class, "type", null); - assertTrue("Type empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Type empty"); } @Test public void testTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(SavedQuery.class, "title", null); - assertTrue("Title empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title empty"); } @Test public void testDescriptionEmpty() throws Exception { Set> constraintViolations = validator.validateValue(SavedQuery.class, "description", null); - assertTrue("Description empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Description empty"); } @Test public void testDataEmpty() throws Exception { Set> constraintViolations = validator.validateValue(SavedQuery.class, "data", null); - assertTrue("Data empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Data empty"); } @Test @@ -92,4 +92,4 @@ public void getJSONData() throws Exception { assertEquals(1, o.length()); assertEquals("test", o.get("test")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/SourceReferenceTest.java b/src/test/java/org/segrada/model/SourceReferenceTest.java index 68bcbbe5..d2fc59e8 100644 --- a/src/test/java/org/segrada/model/SourceReferenceTest.java +++ b/src/test/java/org/segrada/model/SourceReferenceTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,14 +9,14 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class SourceReferenceTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -40,18 +40,18 @@ public void testValidSourceReference() throws Exception { sourceReference.setSource(new Source()); sourceReference.setReference(new Node()); Set> constraintViolations = validator.validate(sourceReference); - assertTrue("Source reference not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Source reference not valid"); } @Test public void testSourceEmpty() throws Exception { Set> constraintViolations = validator.validateValue(SourceReference.class, "source", null); - assertTrue("Source empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Source empty"); } @Test public void testReferenceEmpty() throws Exception { Set> constraintViolations = validator.validateValue(SourceReference.class, "reference", null); - assertTrue("Reference empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Reference empty"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/SourceTest.java b/src/test/java/org/segrada/model/SourceTest.java index 37db6aa6..a6f68afd 100644 --- a/src/test/java/org/segrada/model/SourceTest.java +++ b/src/test/java/org/segrada/model/SourceTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,15 +9,15 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class SourceTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -50,30 +50,30 @@ public void testValidSource() throws Exception { source.setShortTitle("Example title"); source.setShortRef("ex"); Set> constraintViolations = validator.validate(source); - assertTrue("Source not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Source not valid"); } @Test public void testTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Source.class, "shortTitle", null); - assertTrue("Short Title empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Short Title empty"); } @Test public void testTitleTooShort() throws Exception { Set> constraintViolations = validator.validateValue(Source.class, "shortTitle", ""); - assertTrue("Short Title too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Short Title too short"); } @Test public void testShortRefEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Source.class, "shortRef", null); - assertTrue("Short Ref empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Short Ref empty"); } @Test public void testShortRefTooShort() throws Exception { Set> constraintViolations = validator.validateValue(Source.class, "shortRef", ""); - assertTrue("Short Ref too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Short Ref too short"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/TagTest.java b/src/test/java/org/segrada/model/TagTest.java index 99a66415..8661ef53 100644 --- a/src/test/java/org/segrada/model/TagTest.java +++ b/src/test/java/org/segrada/model/TagTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,14 +9,14 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class TagTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -39,19 +39,19 @@ public void testValidTag() throws Exception { final Tag tag = new Tag(); tag.setTitle("Example title"); Set> constraintViolations = validator.validate(tag); - assertTrue("Tag not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "Tag not valid"); } @Test public void testTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(Tag.class, "title", null); - assertTrue("Title empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title empty"); } @Test public void testTitleTooShort() throws Exception { Set> constraintViolations = validator.validateValue(Tag.class, "title", ""); - assertTrue("Title too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title too short"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/UserGroupTest.java b/src/test/java/org/segrada/model/UserGroupTest.java index 1d8e3f83..fbde77c5 100644 --- a/src/test/java/org/segrada/model/UserGroupTest.java +++ b/src/test/java/org/segrada/model/UserGroupTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,13 +9,13 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class UserGroupTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -41,19 +41,19 @@ public void testValidUserGroup() throws Exception { userGroup.setDescription("description"); userGroup.setSpecial("ADMIN"); Set> constraintViolations = validator.validate(userGroup); - assertTrue("UserGroup not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "UserGroup not valid"); } @Test public void testTitleEmpty() throws Exception { Set> constraintViolations = validator.validateValue(UserGroup.class, "title", null); - assertTrue("Title empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title empty"); } @Test public void testTitleTooShort() throws Exception { Set> constraintViolations = validator.validateValue(UserGroup.class, "title", ""); - assertTrue("Title too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Title too short"); } @@ -154,4 +154,4 @@ public void testGetRoles() throws Exception { public void testGetRole() throws Exception { // covered above }*/ -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/UserTest.java b/src/test/java/org/segrada/model/UserTest.java index 4d20ee47..e5088b96 100644 --- a/src/test/java/org/segrada/model/UserTest.java +++ b/src/test/java/org/segrada/model/UserTest.java @@ -1,7 +1,7 @@ package org.segrada.model; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.validation.ConstraintViolation; import javax.validation.Validation; @@ -9,13 +9,13 @@ import javax.validation.ValidatorFactory; import java.util.Set; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; public class UserTest { private static Validator validator; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); @@ -36,25 +36,25 @@ public void testValidUser() throws Exception { user.setPassword("supersecretpassword"); user.setGroup(userGroup); Set> constraintViolations = validator.validate(user); - assertTrue("User not valid", constraintViolations.size() == 0); + assertTrue(constraintViolations.size() == 0, "User not valid"); } @Test public void testLoginEmpty() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "login", null); - assertTrue("Login empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Login empty"); } @Test public void testLoginTooShort() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "login", "abc"); - assertTrue("Login too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Login too short"); } @Test public void testLoginTooLong() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "login", "THISISAVERYLONGLOGINTOOLONG"); - assertTrue("Login too long", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Login too long"); } /*@Test @@ -66,43 +66,43 @@ public void testLoginInvalidCharacters() throws Exception { @Test public void testPasswordEmpty() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "password", null); - assertTrue("Password empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Password empty"); } @Test public void testPasswordTooShort() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "password", "abcd"); - assertTrue("Password too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Password too short"); } @Test public void testPasswordTooLong() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "password", "THISISAVERYLONGPASSWORDJUSTTOOLONGTHISISAVERYLONGPASSWORDJUSTTOOLONGTHISISAVERYLONGPASSWORDJUSTTOOLONGTHISISAVERYLONGPASSWORDJUSTTOOLONGTHISISAVERYLONGPASSWORDJUSTTOOLONGTHISISAVERYLONGPASSWORDJUSTTOOLONGTHISISAVERYLONGPASSWORDJUSTTOOLONGTHISISAVERYLONGPASSWORDJUSTTOOLONGTHISISAVERYLONGPASSWORDJUSTTOOLONG"); - assertTrue("Password too long", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Password too long"); } @Test public void testNameEmpty() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "name", null); - assertTrue("Name empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Name empty"); } @Test public void testNameTooShort() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "name", "a"); - assertTrue("Name too short", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Name too short"); } @Test public void testNameTooLong() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "name", "This name is too long. This name is too long. This name is too long. This name is too long."); - assertTrue("Name too long", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Name too long"); } @Test public void testEmptyGroup() throws Exception { Set> constraintViolations = validator.validateValue(User.class, "group", null); - assertTrue("Group empty", constraintViolations.size() == 1); + assertTrue(constraintViolations.size() == 1, "Group empty"); } @Test @@ -131,4 +131,4 @@ public void testPasswordsMatch() throws Exception { user.setPassword(null); assertFalse(user.passwordsMatch()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/base/AbstractAnnotatedModelTest.java b/src/test/java/org/segrada/model/base/AbstractAnnotatedModelTest.java index 87ebea31..7b8786f5 100644 --- a/src/test/java/org/segrada/model/base/AbstractAnnotatedModelTest.java +++ b/src/test/java/org/segrada/model/base/AbstractAnnotatedModelTest.java @@ -1,6 +1,6 @@ package org.segrada.model.base; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.segrada.model.Comment; import org.segrada.model.File; import org.segrada.model.SourceReference; @@ -12,7 +12,7 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractAnnotatedModelTest { @@ -126,4 +126,4 @@ public void setDummyLoad(String dummyLoad) { this.dummyLoad = dummyLoad; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/base/AbstractColoredModelTest.java b/src/test/java/org/segrada/model/base/AbstractColoredModelTest.java index 821e55b2..d6c79026 100644 --- a/src/test/java/org/segrada/model/base/AbstractColoredModelTest.java +++ b/src/test/java/org/segrada/model/base/AbstractColoredModelTest.java @@ -1,8 +1,8 @@ package org.segrada.model.base; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class AbstractColoredModelTest { @Test @@ -44,4 +44,4 @@ public String getTitle() { return "DUMMY"; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/base/AbstractCoreModelTest.java b/src/test/java/org/segrada/model/base/AbstractCoreModelTest.java index 6ee8cb35..bbdc21e1 100644 --- a/src/test/java/org/segrada/model/base/AbstractCoreModelTest.java +++ b/src/test/java/org/segrada/model/base/AbstractCoreModelTest.java @@ -1,13 +1,13 @@ package org.segrada.model.base; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.segrada.model.*; import org.segrada.model.prototype.*; import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractCoreModelTest { @@ -227,4 +227,4 @@ public void setDummyLoad(String dummyLoad) { this.dummyLoad = dummyLoad; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/base/AbstractSegradaEntityTest.java b/src/test/java/org/segrada/model/base/AbstractSegradaEntityTest.java index 22c17fb1..270bd209 100644 --- a/src/test/java/org/segrada/model/base/AbstractSegradaEntityTest.java +++ b/src/test/java/org/segrada/model/base/AbstractSegradaEntityTest.java @@ -1,9 +1,9 @@ package org.segrada.model.base; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.segrada.model.User; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractSegradaEntityTest { @Test @@ -100,14 +100,14 @@ public void testGetUid() throws Exception { entity.setId("#12345:45678"); - assertEquals("Id to Uid conversion failed", "12345-45678", entity.getUid()); + assertEquals("12345-45678", entity.getUid(), "Id to Uid conversion failed"); } @Test public void testConvertOrientIdToUid() throws Exception { assertNull(AbstractSegradaEntity.convertOrientIdToUid(null)); assertNull(AbstractSegradaEntity.convertOrientIdToUid("")); - assertEquals("Id to Uid conversion failed", "12345-45678", AbstractSegradaEntity.convertOrientIdToUid("#12345:45678")); + assertEquals("12345-45678", AbstractSegradaEntity.convertOrientIdToUid("#12345:45678"), "Id to Uid conversion failed"); assertNull(AbstractSegradaEntity.convertOrientIdToUid("xxx")); assertNull(AbstractSegradaEntity.convertOrientIdToUid("123-123")); } @@ -116,7 +116,7 @@ public void testConvertOrientIdToUid() throws Exception { public void testConvertUidToOrientId() throws Exception { assertNull(AbstractSegradaEntity.convertUidToOrientId(null)); assertNull(AbstractSegradaEntity.convertUidToOrientId("")); - assertEquals("Uid to id conversion failed", "#12345:45678", AbstractSegradaEntity.convertUidToOrientId("12345-45678")); + assertEquals("#12345:45678", AbstractSegradaEntity.convertUidToOrientId("12345-45678"), "Uid to id conversion failed"); assertNull(AbstractSegradaEntity.convertUidToOrientId("xxx")); assertNull(AbstractSegradaEntity.convertUidToOrientId("#123:123")); } @@ -140,4 +140,4 @@ public void setDummyLoad(String dummyLoad) { this.dummyLoad = dummyLoad; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/model/util/FuzzyFlagTest.java b/src/test/java/org/segrada/model/util/FuzzyFlagTest.java index cccff5a4..4e71ab96 100644 --- a/src/test/java/org/segrada/model/util/FuzzyFlagTest.java +++ b/src/test/java/org/segrada/model/util/FuzzyFlagTest.java @@ -1,11 +1,11 @@ package org.segrada.model.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.EnumSet; import java.util.Set; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class FuzzyFlagTest { @@ -101,4 +101,4 @@ public void testGetFuzzyFlags() throws Exception { assertArrayEquals(new char[]{'c'}, FuzzyFlag.getFuzzyFlags(EnumSet.of(FuzzyFlag.FUZZY_CA))); assertArrayEquals(new char[]{'c', '?'}, FuzzyFlag.getFuzzyFlags(EnumSet.of(FuzzyFlag.FUZZY_CA, FuzzyFlag.FUZZY_UNKNOWN))); //TODO: does this work on every machine? } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/rendering/markup/DefaultMarkupFilterTest.java b/src/test/java/org/segrada/rendering/markup/DefaultMarkupFilterTest.java index 4479c8cc..a14dbb86 100644 --- a/src/test/java/org/segrada/rendering/markup/DefaultMarkupFilterTest.java +++ b/src/test/java/org/segrada/rendering/markup/DefaultMarkupFilterTest.java @@ -1,12 +1,12 @@ package org.segrada.rendering.markup; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.segrada.rendering.markup.DefaultMarkupFilter; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class DefaultMarkupFilterTest { @Test @@ -14,19 +14,19 @@ public void testToHTML() throws Exception { DefaultMarkupFilter filter = new DefaultMarkupFilter(); String test1 = "This is a text string"; - assertEquals("Test 1 failed", "This is a text string", filter.toHTML(test1)); + assertEquals("This is a text string", filter.toHTML(test1), "Test 1 failed"); String test2 = "This is a text string\nNext line"; - assertEquals("Test 2 failed", "This is a text string
\nNext line", filter.toHTML(test2)); + assertEquals("This is a text string
\nNext line", filter.toHTML(test2), "Test 2 failed"); String test3 = "This is a text string\rNext line"; - assertEquals("Test 3 failed", "This is a text string
\nNext line", filter.toHTML(test3)); + assertEquals("This is a text string
\nNext line", filter.toHTML(test3), "Test 3 failed"); String test4 = "This is a text string\r\nNext line"; - assertEquals("Test 4 failed", "This is a text string
\nNext line", filter.toHTML(test4)); + assertEquals("This is a text string
\nNext line", filter.toHTML(test4), "Test 4 failed"); String test5 = "
ÄÖÜ@µ"; - assertEquals("Test 5 failed", "<br>ÄÖÜ@µ", filter.toHTML(test5)); + assertEquals("<br>ÄÖÜ@µ", filter.toHTML(test5), "Test 5 failed"); } @Test @@ -34,11 +34,11 @@ public void testToHTMLDecorations() throws Exception { DefaultMarkupFilter filter = new DefaultMarkupFilter(); String test1 = "Normaltext *bold* _emphasised_ ==underline== *not\nbold* _not\nemphasised_ ==no\nunderline== *not\n*yesbold*"; - assertEquals("Decoration test failed", "Normaltext bold emphasised underline *not
\n" + + assertEquals("Normaltext bold emphasised underline *not
\n" + "bold* _not
\n" + "emphasised_ ==no
\n" + "underline== *not
\n" + - "yesbold", filter.toHTML(test1)); + "yesbold", filter.toHTML(test1), "Decoration test failed"); } @Test @@ -46,7 +46,7 @@ public void testToHTMLBibliographicAnnotations() throws Exception { DefaultMarkupFilter filter = new DefaultMarkupFilter(); String test1 = "[[haebler:rott]] Blahblah [13f:]"; - assertEquals("Bibliographic annotations test failed", "[[haebler:rott]] Blahblah 13f:", filter.toHTML(test1)); + assertEquals("[[haebler:rott]] Blahblah 13f:", filter.toHTML(test1), "Bibliographic annotations test failed"); } @Test @@ -54,7 +54,7 @@ public void testToHTMLEntities() throws Exception { DefaultMarkupFilter filter = new DefaultMarkupFilter(); String test1 = "1 - 2--3. (c)(C)(R)<=><-> <=<- =>->"; - assertEquals("Entity test failed", "1 – 2—3. ©©®⇔↔ ⇐← ⇒→", filter.toHTML(test1)); + assertEquals("1 – 2—3. ©©®⇔↔ ⇐← ⇒→", filter.toHTML(test1), "Entity test failed"); } @Test @@ -88,4 +88,4 @@ public void testBibRefPattern() throws Exception { matcher = bibRefPattern.matcher("from source [[article:Procurement Nadir: India Howitzer Competitions]]"); assertEquals("from source _R_", matcher.replaceFirst("_R_")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/rendering/markup/HtmlMarkupFilterTest.java b/src/test/java/org/segrada/rendering/markup/HtmlMarkupFilterTest.java index 1687127b..ca63e7c9 100644 --- a/src/test/java/org/segrada/rendering/markup/HtmlMarkupFilterTest.java +++ b/src/test/java/org/segrada/rendering/markup/HtmlMarkupFilterTest.java @@ -1,9 +1,9 @@ package org.segrada.rendering.markup; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.segrada.rendering.markup.HtmlMarkupFilter; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class HtmlMarkupFilterTest { @Test @@ -11,10 +11,10 @@ public void testToHTML() throws Exception { HtmlMarkupFilter filter = new HtmlMarkupFilter(); String test1 = "This is a text string"; - assertEquals("Test 1 failed", test1, filter.toHTML(test1)); + assertEquals(test1, filter.toHTML(test1), "Test 1 failed"); String test2 = "

This is a text string

"; - assertEquals("Test 1 failed", test2, filter.toHTML(test2)); + assertEquals(test2, filter.toHTML(test2), "Test 1 failed"); //trivial... } @@ -32,4 +32,4 @@ public void testToPlain() throws Exception { HtmlMarkupFilter filter = new HtmlMarkupFilter(); assertEquals("Hello World This is a text yesIt is not well formed still it should be converted ÄÖÜ@µ Ää© …<> Bye!", filter.toPlain(test)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/rendering/markup/MarkupFilterFactoryTest.java b/src/test/java/org/segrada/rendering/markup/MarkupFilterFactoryTest.java index 3dc5b284..1e0f8076 100644 --- a/src/test/java/org/segrada/rendering/markup/MarkupFilterFactoryTest.java +++ b/src/test/java/org/segrada/rendering/markup/MarkupFilterFactoryTest.java @@ -1,12 +1,12 @@ package org.segrada.rendering.markup; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.segrada.rendering.markup.DefaultMarkupFilter; import org.segrada.rendering.markup.MarkupFilter; import org.segrada.rendering.markup.MarkupFilterFactory; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MarkupFilterFactoryTest { @@ -27,4 +27,4 @@ public void testProduceNoArguments() throws Exception { MarkupFilter markupFilter = MarkupFilterFactory.produce(); assertTrue(markupFilter instanceof DefaultMarkupFilter); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/rendering/markup/MarkupFilterTest.java b/src/test/java/org/segrada/rendering/markup/MarkupFilterTest.java index 5b30eacb..d8787c4f 100644 --- a/src/test/java/org/segrada/rendering/markup/MarkupFilterTest.java +++ b/src/test/java/org/segrada/rendering/markup/MarkupFilterTest.java @@ -1,9 +1,9 @@ package org.segrada.rendering.markup; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.segrada.rendering.markup.MarkupFilter; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class MarkupFilterTest { @@ -27,4 +27,4 @@ public String toPlain(String markupText) { return null; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/rendering/thymeleaf/processor/MarkupProcessorTest.java b/src/test/java/org/segrada/rendering/thymeleaf/processor/MarkupProcessorTest.java index f57a9e68..5b4ebda7 100644 --- a/src/test/java/org/segrada/rendering/thymeleaf/processor/MarkupProcessorTest.java +++ b/src/test/java/org/segrada/rendering/thymeleaf/processor/MarkupProcessorTest.java @@ -1,8 +1,8 @@ package org.segrada.rendering.thymeleaf.processor; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class MarkupProcessorTest { @Test @@ -29,4 +29,4 @@ public void testCorruptMarkup() throws Exception { assertEquals("", processor.markup("", "xxxyyy")); assertEquals("Test", processor.markup("Test", "xxxyyy")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/rendering/thymeleaf/processor/Nl2BrProcessorTest.java b/src/test/java/org/segrada/rendering/thymeleaf/processor/Nl2BrProcessorTest.java index 2ed48488..b11430ab 100644 --- a/src/test/java/org/segrada/rendering/thymeleaf/processor/Nl2BrProcessorTest.java +++ b/src/test/java/org/segrada/rendering/thymeleaf/processor/Nl2BrProcessorTest.java @@ -1,8 +1,8 @@ package org.segrada.rendering.thymeleaf.processor; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class Nl2BrProcessorTest { @@ -16,4 +16,4 @@ public void textNl2br() throws Exception { assertEquals("Hello
\nWorld!", processor.nl2br("Hello\rWorld!")); assertEquals("Hello
\nWorld
\n!", processor.nl2br("Hello\nWorld\n!")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/rendering/thymeleaf/util/MimeTypeIsRenderableTest.java b/src/test/java/org/segrada/rendering/thymeleaf/util/MimeTypeIsRenderableTest.java index 76cb52e5..abaf5a06 100644 --- a/src/test/java/org/segrada/rendering/thymeleaf/util/MimeTypeIsRenderableTest.java +++ b/src/test/java/org/segrada/rendering/thymeleaf/util/MimeTypeIsRenderableTest.java @@ -1,8 +1,8 @@ package org.segrada.rendering.thymeleaf.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class MimeTypeIsRenderableTest { @Test @@ -23,4 +23,4 @@ public void isRenderable() throws Exception { assertTrue(MimeTypeIsRenderable.isRenderable("video/mpeg")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/search/SearchHitTest.java b/src/test/java/org/segrada/search/SearchHitTest.java index 4dc52ecb..74226d52 100644 --- a/src/test/java/org/segrada/search/SearchHitTest.java +++ b/src/test/java/org/segrada/search/SearchHitTest.java @@ -1,6 +1,6 @@ package org.segrada.search; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.segrada.test.PropertyAsserter.assertBasicGetterSetterBehavior; @@ -9,4 +9,4 @@ public class SearchHitTest { public void testProperties() { assertBasicGetterSetterBehavior(new SearchHit()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/search/lucene/LuceneSearchEngineTest.java b/src/test/java/org/segrada/search/lucene/LuceneSearchEngineTest.java index 7e62c9d7..c310388a 100644 --- a/src/test/java/org/segrada/search/lucene/LuceneSearchEngineTest.java +++ b/src/test/java/org/segrada/search/lucene/LuceneSearchEngineTest.java @@ -1,15 +1,15 @@ package org.segrada.search.lucene; import org.apache.lucene.store.RAMDirectory; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.search.SearchHit; import org.segrada.service.util.PaginationInfo; import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class LuceneSearchEngineTest { /** @@ -17,7 +17,7 @@ public class LuceneSearchEngineTest { */ private LuceneSearchEngine searchEngine; - @Before + @BeforeEach public void setUp() throws Exception { searchEngine = new LuceneSearchEngine(new RAMDirectory(), new LuceneSegradaAnalyzer()); } @@ -34,7 +34,7 @@ public void testIndexSearchRemove() throws Exception { "eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata " + "sanctus est Lorem ipsum dolor sit amet.", new String[]{}, null, null,1.0f); - assertTrue("Could not save document to index", check); + assertTrue(check, "Could not save document to index"); // search PaginationInfo searchResult = searchEngine.search("consetetur hello", null); @@ -336,4 +336,4 @@ public void testSearchInDocument() throws Exception { assertEquals("elitr, sed diam nonumy eirmod tempor invidunt ut x labore et dolore magna aliquyam erat, sed diam voluptua", highlights[0]); assertEquals("elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua", highlights[1]); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/base/AbstractFullTextServiceTest.java b/src/test/java/org/segrada/service/base/AbstractFullTextServiceTest.java index c89f7a79..6f1faaf1 100644 --- a/src/test/java/org/segrada/service/base/AbstractFullTextServiceTest.java +++ b/src/test/java/org/segrada/service/base/AbstractFullTextServiceTest.java @@ -6,9 +6,9 @@ import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; import org.apache.lucene.store.RAMDirectory; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Source; import org.segrada.model.prototype.ISource; import org.segrada.search.SearchEngine; @@ -26,7 +26,7 @@ import javax.annotation.Nullable; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractFullTextServiceTest { /** @@ -54,7 +54,7 @@ public class AbstractFullTextServiceTest { */ private boolean methodCalled; - @Before + @BeforeEach public void setUp() throws Exception { searchEngine = new LuceneSearchEngine(new RAMDirectory(), new LuceneSegradaAnalyzer()); @@ -70,7 +70,7 @@ public void setUp() throws Exception { service = new MockService(factory, searchEngine); } - @After + @AfterEach public void tearDown() throws Exception { // clear search indexes searchEngine.clearAllIndexes(); @@ -327,4 +327,4 @@ public List findByTitle(String title) { return repository.findByTitle(title); } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/base/AbstractRepositoryServiceTest.java b/src/test/java/org/segrada/service/base/AbstractRepositoryServiceTest.java index 97a70c55..6e798e13 100644 --- a/src/test/java/org/segrada/service/base/AbstractRepositoryServiceTest.java +++ b/src/test/java/org/segrada/service/base/AbstractRepositoryServiceTest.java @@ -5,9 +5,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Color; import org.segrada.model.prototype.IColor; import org.segrada.service.repository.ColorRepository; @@ -20,7 +20,7 @@ import java.util.Iterator; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractRepositoryServiceTest { /** @@ -38,7 +38,7 @@ public class AbstractRepositoryServiceTest { */ private MockService service; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -52,7 +52,7 @@ public void setUp() throws Exception { service = new MockService(factory); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("truncate class Color")).execute(); @@ -201,4 +201,4 @@ public Class getModelClass() { return IColor.class; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/binarydata/BinaryDataServiceFileTest.java b/src/test/java/org/segrada/service/binarydata/BinaryDataServiceFileTest.java index 8562d501..494a53c5 100644 --- a/src/test/java/org/segrada/service/binarydata/BinaryDataServiceFileTest.java +++ b/src/test/java/org/segrada/service/binarydata/BinaryDataServiceFileTest.java @@ -1,10 +1,10 @@ package org.segrada.service.binarydata; import com.google.common.io.Files; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll;; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Node; import org.segrada.model.base.AbstractSegradaEntity; import org.segrada.model.prototype.SegradaEntity; @@ -18,7 +18,7 @@ import java.util.List; import java.util.Map; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class BinaryDataServiceFileTest { private static String savePath; @@ -27,7 +27,7 @@ public class BinaryDataServiceFileTest { private static File tempPath; - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { savePath = System.getProperty("java.io.tmpdir") + File.separator + "segradatest"; @@ -39,7 +39,7 @@ public static void setUpClass() throws Exception { tempPath.mkdirs(); } - @AfterClass + @AfterAll public static void tearDownClass() throws Exception { // delete all deleteDirectory(tempPath); @@ -71,7 +71,7 @@ public static boolean deleteDirectory(File directory) { */ private BinaryDataServiceFile binaryDataServiceFile; - @Before + @BeforeEach public void setUp() throws Exception { binaryDataServiceFile = new BinaryDataServiceFile(new ApplicationSettings() { @Override @@ -264,4 +264,4 @@ public String getTitle() { assertEquals(id, binaryDataServiceFile.getFilename(newId)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbColorRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbColorRepositoryTest.java index 65ac6f15..259b855c 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbColorRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbColorRepositoryTest.java @@ -3,9 +3,9 @@ import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Color; import org.segrada.model.prototype.IColor; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; @@ -13,7 +13,7 @@ import org.segrada.test.OrientDBTestInstance; import org.segrada.test.OrientDbTestApplicationSettings; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class OrientDbColorRepositoryTest { /** @@ -31,7 +31,7 @@ public class OrientDbColorRepositoryTest { */ private OrientDbColorRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -45,7 +45,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbColorRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("truncate class Color")).execute(); @@ -115,4 +115,4 @@ public void testGetDefaultOrder() throws Exception { assertEquals(" ORDER BY color", repository.getDefaultOrder(true)); assertEquals(" color", repository.getDefaultOrder(false)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbCommentRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbCommentRepositoryTest.java index 0e0b53ad..0f9aece0 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbCommentRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbCommentRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Comment; import org.segrada.model.prototype.IComment; import org.segrada.model.prototype.SegradaEntity; @@ -17,7 +17,7 @@ import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbCommentRepositoryTest { /** @@ -35,7 +35,7 @@ public class OrientDbCommentRepositoryTest { */ private OrientDbCommentRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -49,7 +49,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbCommentRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete edge IsCommentOf")).execute(); @@ -279,4 +279,4 @@ public void testHasConnections() throws Exception { // but not vice versa assertFalse(repository.hasConnections(comment2)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbConfigRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbConfigRepositoryTest.java index e368cd68..5c4bb8d3 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbConfigRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbConfigRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; import org.segrada.session.Identity; import org.segrada.test.OrientDBTestInstance; @@ -14,7 +14,7 @@ import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbConfigRepositoryTest { /** @@ -32,7 +32,7 @@ public class OrientDbConfigRepositoryTest { */ private OrientDbConfigRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -46,7 +46,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbConfigRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("truncate class Config")).execute(); @@ -124,4 +124,4 @@ public void testDeleteValue() throws Exception { List result = factory.getDb().command(query).execute("testKey4"); assertTrue(result.isEmpty()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbFileRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbFileRepositoryTest.java index b225bca2..8a3309c0 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbFileRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbFileRepositoryTest.java @@ -5,9 +5,9 @@ import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; import com.tinkerpop.blueprints.impls.orient.OrientEdge; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Comment; import org.segrada.model.File; import org.segrada.model.prototype.IComment; @@ -20,7 +20,7 @@ import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbFileRepositoryTest { /** @@ -38,7 +38,7 @@ public class OrientDbFileRepositoryTest { */ private OrientDbFileRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -52,7 +52,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbFileRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete vertex V")).execute(); @@ -518,4 +518,4 @@ public void testPaginate() throws Exception { //fail("Test not implemented yet."); //TODO: do later } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbLocationRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbLocationRepositoryTest.java index 4cadeab3..063067e4 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbLocationRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbLocationRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.id.ORecordId; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Location; import org.segrada.model.prototype.ILocation; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; @@ -17,8 +17,8 @@ import java.util.List; import java.util.Objects; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class OrientDbLocationRepositoryTest { /** @@ -36,7 +36,7 @@ public class OrientDbLocationRepositoryTest { */ private OrientDbLocationRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -50,7 +50,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbLocationRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("truncate class Location")).execute(); @@ -329,4 +329,4 @@ public void testFindWithin() throws Exception { locations = repository.findWithin(10, 10, -1, -10); assertTrue(locations.size() == 3); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbNodeRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbNodeRepositoryTest.java index 68420ac9..5abc6aea 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbNodeRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbNodeRepositoryTest.java @@ -5,9 +5,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Location; import org.segrada.model.Node; import org.segrada.model.Period; @@ -29,7 +29,7 @@ import java.util.List; import java.util.Map; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbNodeRepositoryTest { /** @@ -47,7 +47,7 @@ public class OrientDbNodeRepositoryTest { */ private OrientDbNodeRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -61,7 +61,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbNodeRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete vertex V")).execute(); @@ -437,4 +437,4 @@ public void testDelete() throws Exception { result = factory.getDb().command(query).execute(); assertTrue(result.isEmpty()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbPeriodRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbPeriodRepositoryTest.java index 6de763ba..e7e97de5 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbPeriodRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbPeriodRepositoryTest.java @@ -5,9 +5,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import org.joda.time.DateTime; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Period; import org.segrada.model.prototype.IPeriod; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; @@ -17,9 +17,9 @@ import java.util.List; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class OrientDbPeriodRepositoryTest { @@ -38,7 +38,7 @@ public class OrientDbPeriodRepositoryTest { */ private OrientDbPeriodRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -52,7 +52,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbPeriodRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete vertex V")).execute(); @@ -377,4 +377,4 @@ public void testGetDefaultOrder() throws Exception { assertEquals(" fromJD ASC, toJD ASC", repository.getDefaultOrder(false)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbPictogramRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbPictogramRepositoryTest.java index 3d610d9f..0aa03b57 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbPictogramRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbPictogramRepositoryTest.java @@ -3,9 +3,9 @@ import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Pictogram; import org.segrada.model.prototype.IPictogram; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; @@ -15,7 +15,7 @@ import java.util.List; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class OrientDbPictogramRepositoryTest { /** @@ -33,7 +33,7 @@ public class OrientDbPictogramRepositoryTest { */ private OrientDbPictogramRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -47,7 +47,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbPictogramRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("truncate class Pictogram")).execute(); @@ -165,4 +165,4 @@ public void testGetDefaultOrder() throws Exception { assertEquals(" ORDER BY title", repository.getDefaultOrder(true)); assertEquals(" title", repository.getDefaultOrder(false)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbRelationRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbRelationRepositoryTest.java index 4fdaa401..b88be36e 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbRelationRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbRelationRepositoryTest.java @@ -7,9 +7,9 @@ import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; import org.apache.commons.lang.NotImplementedException; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Node; import org.segrada.model.Relation; import org.segrada.model.RelationType; @@ -25,7 +25,7 @@ import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbRelationRepositoryTest { /** @@ -43,7 +43,7 @@ public class OrientDbRelationRepositoryTest { */ private OrientDbRelationRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -57,7 +57,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbRelationRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete vertex V")).execute(); @@ -146,9 +146,9 @@ public void testConvertToEntity() throws Exception { assertEquals(node2.getIdentity().toString(), relation.getToEntity().getId()); } - @Test(expected = NotImplementedException.class) + @Test public void testConvertToDocument() throws Exception { - repository.convertToDocument(new Relation()); + assertThrows(NotImplementedException.class, () -> repository.convertToDocument(new Relation())); } @Test @@ -549,4 +549,4 @@ public void testSave() throws Exception { result = factory.getDb().command(query).execute(); assertEquals(0, result.size()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbRelationTypeRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbRelationTypeRepositoryTest.java index 82d139b1..038d3fa2 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbRelationTypeRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbRelationTypeRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.RelationType; import org.segrada.model.prototype.IRelationType; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; @@ -16,8 +16,8 @@ import java.util.List; -import static org.junit.Assert.*; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; public class OrientDbRelationTypeRepositoryTest { @@ -38,7 +38,7 @@ public class OrientDbRelationTypeRepositoryTest { */ private OrientDbRelationTypeRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -52,7 +52,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbRelationTypeRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete vertex RelationType")).execute(); @@ -247,4 +247,4 @@ public void testDelete() throws Exception { result = factory.getDb().command(query).execute(); assertTrue(result.isEmpty()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbSavedQueryRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbSavedQueryRepositoryTest.java index c39ac00a..75d80f03 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbSavedQueryRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbSavedQueryRepositoryTest.java @@ -3,9 +3,9 @@ import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.SavedQuery; import org.segrada.model.User; import org.segrada.model.prototype.ISavedQuery; @@ -14,7 +14,7 @@ import org.segrada.test.OrientDBTestInstance; import org.segrada.test.OrientDbTestApplicationSettings; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbSavedQueryRepositoryTest { /** @@ -32,7 +32,7 @@ public class OrientDbSavedQueryRepositoryTest { */ private OrientDbSavedQueryRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -46,7 +46,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbSavedQueryRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("truncate class SavedQuery")).execute(); @@ -158,4 +158,4 @@ public void testFindAllBy() throws Exception { assertEquals(1, repository.findAllBy(null, "dummy", "query 1").size()); assertEquals(0, repository.findAllBy(null, "dummy", "query 2").size()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbSourceReferenceRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbSourceReferenceRepositoryTest.java index fa63d444..e9139757 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbSourceReferenceRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbSourceReferenceRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.id.ORecordId; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Comment; import org.segrada.model.Period; import org.segrada.model.Source; @@ -27,8 +27,8 @@ import java.util.HashMap; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class OrientDbSourceReferenceRepositoryTest { @@ -47,7 +47,7 @@ public class OrientDbSourceReferenceRepositoryTest { */ private OrientDbRepositoryFactory factory; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -61,7 +61,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbSourceReferenceRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete edge E")).execute(); @@ -240,4 +240,4 @@ public void testFindByReference() throws Exception { assertTrue(list.getEntities().size() == 1); assertEquals(sourceReference.getId(), list.getEntities().get(0).getId()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbSourceRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbSourceRepositoryTest.java index ca93717f..510e1416 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbSourceRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbSourceRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Comment; import org.segrada.model.Period; import org.segrada.model.Source; @@ -25,7 +25,7 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbSourceRepositoryTest { /** @@ -43,7 +43,7 @@ public class OrientDbSourceRepositoryTest { */ private OrientDbSourceRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -57,7 +57,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbSourceRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete vertex V")).execute(); @@ -394,4 +394,4 @@ public void testPaginate() throws Exception { //fail("Test not implemented yet."); //TODO: do later } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbTagRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbTagRepositoryTest.java index 9fba5800..4571a730 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbTagRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbTagRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Node; import org.segrada.model.Tag; import org.segrada.model.prototype.INode; @@ -20,7 +20,7 @@ import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbTagRepositoryTest { /** @@ -38,7 +38,7 @@ public class OrientDbTagRepositoryTest { */ private OrientDbTagRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { orientDBTestInstance.setUpSchemaIfNeeded(); @@ -52,7 +52,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbTagRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("delete vertex V")).execute(); @@ -172,7 +172,7 @@ public void testFindBySearchTerm() throws Exception { @Test public void testCreateNewTagsByTitles() throws Exception { // make sure we have not created any tags yet - assertTrue("Repository not empty", repository.count() == 0); + assertTrue(repository.count() == 0, "Repository not empty"); // some tags String[] tags = new String[]{"Tag1", "Tag2", "Tag3"}; @@ -201,7 +201,7 @@ public void testCreateNewTagsByTitles() throws Exception { @Test public void testFindTagsByTitles() throws Exception { // make sure we have not created any tags yet - assertTrue("Repository not empty", repository.count() == 0); + assertTrue(repository.count() == 0, "Repository not empty"); // create some tags for (int i = 1; i <= 10; i++) { @@ -233,7 +233,7 @@ public void testFindTagsByTitles() throws Exception { @Test public void testFindTagIdsByTitles() throws Exception { // make sure we have not created any tags yet - assertTrue("Repository not empty", repository.count() == 0); + assertTrue(repository.count() == 0, "Repository not empty"); // create some tags String[] ids = new String[10]; @@ -269,7 +269,7 @@ public void testFindTagIdsByTitles() throws Exception { @Test public void testFindTagTitlesByIds() throws Exception { // make sure we have not created any tags yet - assertTrue("Repository not empty", repository.count() == 0); + assertTrue(repository.count() == 0, "Repository not empty"); // create some tags String[] ids = new String[10]; @@ -738,4 +738,4 @@ public void testPaginate() throws Exception { //fail("Test not implemented yet."); //TODO: do later } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbUserGroupRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbUserGroupRepositoryTest.java index 99e3123b..356618ad 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbUserGroupRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbUserGroupRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.metadata.schema.OType; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.UserGroup; import org.segrada.model.prototype.IUserGroup; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; @@ -17,7 +17,7 @@ import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbUserGroupRepositoryTest { /** @@ -35,7 +35,7 @@ public class OrientDbUserGroupRepositoryTest { */ private OrientDbUserGroupRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -49,7 +49,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbUserGroupRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("truncate class UserGroup")).execute(); @@ -203,4 +203,4 @@ public void testDelete() throws Exception { // disallow deletion assertTrue(repository.delete(userGroup)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientDbUserRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientDbUserRepositoryTest.java index c8fbf303..acd12b7f 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientDbUserRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientDbUserRepositoryTest.java @@ -3,9 +3,9 @@ import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.User; import org.segrada.model.prototype.IUser; import org.segrada.model.prototype.IUserGroup; @@ -17,7 +17,7 @@ import java.util.HashMap; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbUserRepositoryTest { /** @@ -35,7 +35,7 @@ public class OrientDbUserRepositoryTest { */ private OrientDbUserRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -49,7 +49,7 @@ public void setUp() throws Exception { repository = factory.produceRepository(OrientDbUserRepository.class); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db factory.getDb().command(new OCommandSQL("truncate class User")).execute(); @@ -182,4 +182,4 @@ public void testPaginate() throws Exception { //fail("Test not implemented yet."); //TODO: do later } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/OrientRememberMeRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/OrientRememberMeRepositoryTest.java index 398005f9..fba72ac4 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/OrientRememberMeRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/OrientRememberMeRepositoryTest.java @@ -6,16 +6,16 @@ import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; import org.apache.commons.codec.binary.Hex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.test.OrientDBTestInstance; import java.security.MessageDigest; import java.util.HashMap; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientRememberMeRepositoryTest { /** @@ -33,7 +33,7 @@ public class OrientRememberMeRepositoryTest { */ private OrientRememberMeRepository repository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -45,7 +45,7 @@ public void setUp() throws Exception { repository = new OrientRememberMeRepository(db); } - @After + @AfterEach public void tearDown() throws Exception { // truncate db db.command(new OCommandSQL("truncate class User")).execute(); @@ -186,4 +186,4 @@ public void testValidateTokenAndGetUserId() throws Exception { assertNull(userId); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractAnnotatedOrientDbRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractAnnotatedOrientDbRepositoryTest.java index 09db52c7..1b994a66 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractAnnotatedOrientDbRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractAnnotatedOrientDbRepositoryTest.java @@ -5,9 +5,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.base.AbstractAnnotatedModel; import org.segrada.model.prototype.IComment; import org.segrada.model.prototype.IFile; @@ -22,7 +22,7 @@ import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractAnnotatedOrientDbRepositoryTest { /** @@ -40,7 +40,7 @@ public class AbstractAnnotatedOrientDbRepositoryTest { */ private MockOrientDbRepository mockOrientDbRepository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -59,7 +59,7 @@ public void setUp() throws Exception { factory.addRepository(mockOrientDbRepository.getClass(), mockOrientDbRepository); } - @After + @AfterEach public void tearDown() throws Exception { // close db try { @@ -420,4 +420,4 @@ public String getModelClassName() { return "Mock"; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractColoredOrientDbRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractColoredOrientDbRepositoryTest.java index d49c384a..11fb60fc 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractColoredOrientDbRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractColoredOrientDbRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.id.ORecordId; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.base.AbstractColoredModel; import org.segrada.model.prototype.IPictogram; import org.segrada.model.prototype.SegradaColoredEntity; @@ -15,8 +15,8 @@ import org.segrada.test.OrientDBTestInstance; import org.segrada.test.OrientDbTestApplicationSettings; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class AbstractColoredOrientDbRepositoryTest { /** @@ -29,7 +29,7 @@ public class AbstractColoredOrientDbRepositoryTest { */ private MockOrientDbRepository mockOrientDbRepository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -46,7 +46,7 @@ public void setUp() throws Exception { mockOrientDbRepository = new MockOrientDbRepository(factory); } - @After + @AfterEach public void tearDown() throws Exception { // close db try { @@ -179,4 +179,4 @@ public String getModelClassName() { return "Mock"; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractCoreOrientDbRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractCoreOrientDbRepositoryTest.java index 730701f6..6f5398e7 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractCoreOrientDbRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractCoreOrientDbRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.id.ORecordId; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Location; import org.segrada.model.Node; import org.segrada.model.Period; @@ -29,7 +29,7 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractCoreOrientDbRepositoryTest { /** @@ -47,7 +47,7 @@ public class AbstractCoreOrientDbRepositoryTest { */ private MockOrientDbRepository mockOrientDbRepository; - @Before + @BeforeEach public void setUp() throws Exception { // set up schema if needed orientDBTestInstance.setUpSchemaIfNeeded(); @@ -64,7 +64,7 @@ public void setUp() throws Exception { mockOrientDbRepository = new MockOrientDbRepository(factory); } - @After + @AfterEach public void tearDown() throws Exception { // close db try { @@ -341,4 +341,4 @@ public String getModelClassName() { return "Mock"; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractOrientDbBaseRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractOrientDbBaseRepositoryTest.java index cf4fe8d9..8e38564c 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractOrientDbBaseRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractOrientDbBaseRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import org.apache.commons.lang3.builder.EqualsBuilder; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.base.AbstractSegradaEntity; import org.segrada.model.prototype.SegradaEntity; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; @@ -14,7 +14,7 @@ import org.segrada.test.OrientDBTestInstance; import org.segrada.test.OrientDbTestApplicationSettings; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractOrientDbBaseRepositoryTest { /** @@ -27,7 +27,7 @@ public class AbstractOrientDbBaseRepositoryTest { */ private OrientDbRepositoryFactory factory; - @Before + @BeforeEach public void setUp() throws Exception { // open database ODatabaseDocumentTx db = orientDBTestInstance.getDatabase(); @@ -83,4 +83,4 @@ public MockOrientDbRepository(OrientDbRepositoryFactory repositoryFactory) { super(repositoryFactory); } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractOrientDbRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractOrientDbRepositoryTest.java index e38ccba6..258b593b 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractOrientDbRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractOrientDbRepositoryTest.java @@ -5,9 +5,9 @@ import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; import org.apache.commons.lang3.builder.EqualsBuilder; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.base.AbstractSegradaEntity; import org.segrada.model.prototype.IMock; import org.segrada.service.repository.orientdb.factory.OrientDbRepositoryFactory; @@ -17,7 +17,7 @@ import java.util.List; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractOrientDbRepositoryTest { /** @@ -30,7 +30,7 @@ public class AbstractOrientDbRepositoryTest { */ private MockOrientDbRepository mockOrientDbRepository; - @Before + @BeforeEach public void setUp() throws Exception { // open database ODatabaseDocumentTx db = orientDBTestInstance.getDatabase(); @@ -44,7 +44,7 @@ public void setUp() throws Exception { mockOrientDbRepository = new MockOrientDbRepository(factory); } - @After + @AfterEach public void tearDown() throws Exception { // close db try { @@ -310,7 +310,7 @@ public void testGetDefaultOrder() throws Exception { public void testConvertUidToId() throws Exception { assertNull(mockOrientDbRepository.convertUidToId(null)); assertNull(mockOrientDbRepository.convertUidToId("")); - assertEquals("Id to Uid conversion failed", "#12345:45678", mockOrientDbRepository.convertUidToId("12345-45678")); + assertEquals("#12345:45678", mockOrientDbRepository.convertUidToId("12345-45678"), "Id to Uid conversion failed"); } /** @@ -354,4 +354,4 @@ public String getModelClassName() { return "Mock"; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractSegradaOrientDbRepositoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractSegradaOrientDbRepositoryTest.java index 5716c478..54d51e03 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/base/AbstractSegradaOrientDbRepositoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/base/AbstractSegradaOrientDbRepositoryTest.java @@ -4,9 +4,9 @@ import com.orientechnologies.orient.core.id.ORecordId; import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.sql.OCommandSQL; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.model.Node; import org.segrada.model.User; import org.segrada.model.base.AbstractSegradaEntity; @@ -19,7 +19,7 @@ import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class AbstractSegradaOrientDbRepositoryTest { /** @@ -32,7 +32,7 @@ public class AbstractSegradaOrientDbRepositoryTest { */ private MockOrientDbRepository mockOrientDbRepository; - @Before + @BeforeEach public void setUp() throws Exception { orientDBTestInstance.setUpSchemaIfNeeded(); @@ -49,7 +49,7 @@ public void setUp() throws Exception { mockOrientDbRepository = new MockOrientDbRepository(factory); } - @After + @AfterEach public void tearDown() throws Exception { // close db try { @@ -409,4 +409,4 @@ public String getModelClassName() { } //updateEntityTags tested in AbstractAnnotatedOrientDbRepositoryTest -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/repository/orientdb/factory/OrientDbRepositoryFactoryTest.java b/src/test/java/org/segrada/service/repository/orientdb/factory/OrientDbRepositoryFactoryTest.java index 2f6e6f16..cd28a303 100644 --- a/src/test/java/org/segrada/service/repository/orientdb/factory/OrientDbRepositoryFactoryTest.java +++ b/src/test/java/org/segrada/service/repository/orientdb/factory/OrientDbRepositoryFactoryTest.java @@ -1,9 +1,9 @@ package org.segrada.service.repository.orientdb.factory; import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.segrada.service.repository.CommentRepository; import org.segrada.service.repository.FileRepository; import org.segrada.service.repository.orientdb.OrientDbCommentRepository; @@ -12,7 +12,7 @@ import org.segrada.test.OrientDBTestInstance; import org.segrada.test.OrientDbTestApplicationSettings; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class OrientDbRepositoryFactoryTest { /** @@ -28,7 +28,7 @@ public class OrientDbRepositoryFactoryTest { private OrientDbRepositoryFactory factory; - @Before + @BeforeEach public void setUp() throws Exception { // open database db = orientDBTestInstance.getDatabase(); @@ -36,7 +36,7 @@ public void setUp() throws Exception { factory = new OrientDbRepositoryFactory(db, applicationSettings, identity); } - @After + @AfterEach public void tearDown() throws Exception { factory.getDb().close(); } @@ -85,4 +85,4 @@ public void testProduceRepository() throws Exception { assertNotNull(commentRepository3); assertTrue(commentRepository3 instanceof OrientDbCommentRepository); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/util/AbstractLazyLoadedObjectTest.java b/src/test/java/org/segrada/service/util/AbstractLazyLoadedObjectTest.java index 147e9e69..6d8f7c4f 100644 --- a/src/test/java/org/segrada/service/util/AbstractLazyLoadedObjectTest.java +++ b/src/test/java/org/segrada/service/util/AbstractLazyLoadedObjectTest.java @@ -1,17 +1,17 @@ package org.segrada.service.util; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.lang.reflect.Method; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class AbstractLazyLoadedObjectTest { private MockObject mockObject; private MockAbstractLazyLoadedObject mockAbstractLazyLoadedObject; - @Before + @BeforeEach public void setUp() throws Exception { mockObject = new MockObject(); mockAbstractLazyLoadedObject = new MockAbstractLazyLoadedObject(mockObject); @@ -85,4 +85,4 @@ protected Object loadObject() { return mockObject; } } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/service/util/PaginationInfoTest.java b/src/test/java/org/segrada/service/util/PaginationInfoTest.java index 3849a135..cd39d6c9 100644 --- a/src/test/java/org/segrada/service/util/PaginationInfoTest.java +++ b/src/test/java/org/segrada/service/util/PaginationInfoTest.java @@ -1,8 +1,8 @@ package org.segrada.service.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class PaginationInfoTest { @@ -65,4 +65,4 @@ public void testShowLastPage() throws Exception { paginationInfo = new PaginationInfo(5, 10, 200, 20, null); assertEquals(true, paginationInfo.showLastPage()); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/session/ApplicationSettingsPropertiesTest.java b/src/test/java/org/segrada/session/ApplicationSettingsPropertiesTest.java index ae9be629..eb19a660 100644 --- a/src/test/java/org/segrada/session/ApplicationSettingsPropertiesTest.java +++ b/src/test/java/org/segrada/session/ApplicationSettingsPropertiesTest.java @@ -1,11 +1,11 @@ package org.segrada.session; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.Collection; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class ApplicationSettingsPropertiesTest { /** @@ -13,7 +13,7 @@ public class ApplicationSettingsPropertiesTest { */ private ApplicationSettingsProperties applicationSettings; - @Before + @BeforeEach public void setUp() throws Exception { // environmental variables cannot be tested but should be ok applicationSettings = new ApplicationSettingsProperties(); @@ -52,4 +52,4 @@ public void testGetKeys() throws Exception { assertTrue(keys.size() > 0); assertTrue(keys.contains("environment")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/session/IdentityTest.java b/src/test/java/org/segrada/session/IdentityTest.java index 6ed8d83c..1f1114d7 100644 --- a/src/test/java/org/segrada/session/IdentityTest.java +++ b/src/test/java/org/segrada/session/IdentityTest.java @@ -1,12 +1,12 @@ package org.segrada.session; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.segrada.model.User; import org.segrada.model.UserGroup; import org.segrada.model.prototype.IUser; import org.segrada.model.prototype.IUserGroup; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class IdentityTest { @@ -221,4 +221,4 @@ public void textHasEditAccess() throws Exception { public void textHasDeleteAccess() throws Exception { //TODO create test } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/test/PropertyAsserter.java b/src/test/java/org/segrada/test/PropertyAsserter.java index 8aeb536f..4b2b6984 100644 --- a/src/test/java/org/segrada/test/PropertyAsserter.java +++ b/src/test/java/org/segrada/test/PropertyAsserter.java @@ -14,7 +14,7 @@ import java.sql.Timestamp; import java.util.*; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; /** * Test utility class that makes easy work of testing default behavior of getters and setters. @@ -201,9 +201,9 @@ public static void assertBasicGetterSetterBehavior(Object target, String propert */ static void assertPropertyResult(String property, Object arg, Class type, Object propertyValue) { if (type.isPrimitive() || type == String.class) { - assertEquals(property + " getter/setter failed test", arg, propertyValue); + assertEquals(arg, propertyValue, property + " getter/setter failed test"); }else { - assertSame(property + " getter/setter failed test", arg, propertyValue); + assertSame(arg, propertyValue, property + " getter/setter failed test"); } } @@ -358,4 +358,4 @@ static void writeMethodInvoke(Object target, Object arg,Method writeMethod) thro log.debug("Wrote arg: '{}'",arg); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/FlexibleDateParserTest.java b/src/test/java/org/segrada/util/FlexibleDateParserTest.java index 8a9f9975..23ccea26 100644 --- a/src/test/java/org/segrada/util/FlexibleDateParserTest.java +++ b/src/test/java/org/segrada/util/FlexibleDateParserTest.java @@ -1,10 +1,10 @@ package org.segrada.util; import org.joda.time.DateTime; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class FlexibleDateParserTest { @Test @@ -108,4 +108,4 @@ public void testInputToJd() throws Exception { assertEquals(new Long(2299971), parser.inputToJd("2.1.1585", "G", true)); assertEquals(new Long(2300028), parser.inputToJd("2.1585", "G", true)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/FuzzyDateRendererTest.java b/src/test/java/org/segrada/util/FuzzyDateRendererTest.java index 8a91a5ed..340da0b8 100644 --- a/src/test/java/org/segrada/util/FuzzyDateRendererTest.java +++ b/src/test/java/org/segrada/util/FuzzyDateRendererTest.java @@ -1,8 +1,8 @@ package org.segrada.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class FuzzyDateRendererTest { @@ -51,4 +51,4 @@ public void testRenderFromTo() throws Exception { assertEquals("1505 – 1506", FuzzyDateRenderer.renderFromTo(0, "1505", "G", new char[0], 0, "1506", "G", new char[0], "", "")); assertEquals(" – 1506", FuzzyDateRenderer.renderFromTo(0, "", "G", new char[0], 0, "1506", "G", new char[0], "", "")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/ImageManipulatorTest.java b/src/test/java/org/segrada/util/ImageManipulatorTest.java index 1880989b..6b3c293a 100644 --- a/src/test/java/org/segrada/util/ImageManipulatorTest.java +++ b/src/test/java/org/segrada/util/ImageManipulatorTest.java @@ -1,7 +1,7 @@ package org.segrada.util; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; @@ -10,7 +10,7 @@ import java.io.IOException; import java.io.InputStream; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ImageManipulatorTest { /** @@ -27,7 +27,7 @@ public class ImageManipulatorTest { private static final String mimeJPG = "image/jpeg"; private static final String mimeGIF = "image/gif"; - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { // load bytes icon_png = resourceToBytes("/img/test_icon.png"); @@ -178,4 +178,4 @@ public static byte[] resourceToBytes(String resource) throws IOException { return bos.toByteArray(); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/NumberFormatterTest.java b/src/test/java/org/segrada/util/NumberFormatterTest.java index 150e2b2e..3707d32c 100644 --- a/src/test/java/org/segrada/util/NumberFormatterTest.java +++ b/src/test/java/org/segrada/util/NumberFormatterTest.java @@ -1,16 +1,16 @@ package org.segrada.util; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.Locale; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class NumberFormatterTest { private NumberFormatter numberFormatter; - @Before + @BeforeEach public void setUp() { numberFormatter = new NumberFormatter(); } @@ -54,4 +54,4 @@ public void testFileSizeBinary() throws Exception { assertEquals("1.7 TiB", numberFormatter.fileSizeBinary(1855425871872L)); assertEquals("8.0 EiB", numberFormatter.fileSizeBinary(Long.MAX_VALUE)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/OrientStringEscapeTest.java b/src/test/java/org/segrada/util/OrientStringEscapeTest.java index 95ea3af1..195773b9 100644 --- a/src/test/java/org/segrada/util/OrientStringEscapeTest.java +++ b/src/test/java/org/segrada/util/OrientStringEscapeTest.java @@ -1,9 +1,9 @@ package org.segrada.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; public class OrientStringEscapeTest { @@ -15,4 +15,4 @@ public void testEscapeOrientSql() throws Exception { assertEquals("\"test\"", OrientStringEscape.escapeOrientSql("\"test\"")); assertEquals("\\'test\\'", OrientStringEscape.escapeOrientSql("'test'")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/PBKDF2WithHmacSHA1PasswordEncoderTest.java b/src/test/java/org/segrada/util/PBKDF2WithHmacSHA1PasswordEncoderTest.java index 66f59d99..bed01aca 100644 --- a/src/test/java/org/segrada/util/PBKDF2WithHmacSHA1PasswordEncoderTest.java +++ b/src/test/java/org/segrada/util/PBKDF2WithHmacSHA1PasswordEncoderTest.java @@ -1,9 +1,9 @@ package org.segrada.util; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class PBKDF2WithHmacSHA1PasswordEncoderTest { /** @@ -16,7 +16,7 @@ public class PBKDF2WithHmacSHA1PasswordEncoderTest { */ private static PasswordEncoder encoder; - @BeforeClass + @BeforeAll public static void setup() { encoder = new PBKDF2WithHmacSHA1PasswordEncoder(); } @@ -37,20 +37,20 @@ public void testEncode() throws Exception { String parts[] = encoded.split(":"); // make sure that password follows certain patterns - assertTrue("Password is not composed of three parts", parts.length == 3); - assertTrue("First part of password smaller than 5 letters", parts[0].length() >= 5); // should be at least 10000 today - assertTrue("First part of password not a number", parts[0].matches("^[1-9][0-9]*$")); - assertTrue("Second part of password smaller than 16 bytes", parts[1].length() == 32); - assertTrue("Second part of password not a hex number", parts[1].matches("^[0-9a-f]+$")); - assertTrue("Third part of password smaller than 64 bytes", parts[2].length() == 128); - assertTrue("Third part of password not a hex number", parts[2].matches("^[0-9a-f]+$")); + assertTrue(parts.length == 3, "Password is not composed of three parts"); + assertTrue(parts[0].length() >= 5, "First part of password smaller than 5 letters"); // should be at least 10000 today + assertTrue(parts[0].matches("^[1-9][0-9]*$"), "First part of password not a number"); + assertTrue(parts[1].length() == 32, "Second part of password smaller than 16 bytes"); + assertTrue(parts[1].matches("^[0-9a-f]+$"), "Second part of password not a hex number"); + assertTrue(parts[2].length() == 128, "Third part of password smaller than 64 bytes"); + assertTrue(parts[2].matches("^[0-9a-f]+$"), "Third part of password not a hex number"); } @Test public void testMatches() throws Exception { // different sample passwords - assertTrue("Password 1000 did not match", encoder.matches(password, "1000:ecebaf7f4ca80b35ad01d9cc9a23d712:e28d2699de28279030c0c2ddb90bf7e32428ccf455123a823ee9e04187ca73e427b12241315048599a56a2d471b85768ecc5250a29b55fb1831b413730d383cb")); - assertTrue("Password 10000 did not match", encoder.matches(password, "10000:4a708704ba083f99033cf726f63b88c7:7605720d577d1567659594673596bdb70dadd8286662c4a1bf77e56f304021cb7d91459366ff053d8007f3cfc8a1fdf78d2f633ab14d9f8d9a4ed35546eefa99")); - assertTrue("Password 100000 did not match", encoder.matches(password, "100000:de7b326aa219cf55a6868d9ad87df65c:dc2f56de369744eb67ecc33ebb0541223af8d8dfd900e3d3d2150b44213bfe05f704e79c3e314a0e4445af9cd80ae8f09fc80f81e684f5ff99deaf9b72e33bbb")); + assertTrue(encoder.matches(password, "1000:ecebaf7f4ca80b35ad01d9cc9a23d712:e28d2699de28279030c0c2ddb90bf7e32428ccf455123a823ee9e04187ca73e427b12241315048599a56a2d471b85768ecc5250a29b55fb1831b413730d383cb"), "Password 1000 did not match"); + assertTrue(encoder.matches(password, "10000:4a708704ba083f99033cf726f63b88c7:7605720d577d1567659594673596bdb70dadd8286662c4a1bf77e56f304021cb7d91459366ff053d8007f3cfc8a1fdf78d2f633ab14d9f8d9a4ed35546eefa99"), "Password 10000 did not match"); + assertTrue(encoder.matches(password, "100000:de7b326aa219cf55a6868d9ad87df65c:dc2f56de369744eb67ecc33ebb0541223af8d8dfd900e3d3d2150b44213bfe05f704e79c3e314a0e4445af9cd80ae8f09fc80f81e684f5ff99deaf9b72e33bbb"), "Password 100000 did not match"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/PreconditionsTest.java b/src/test/java/org/segrada/util/PreconditionsTest.java index c5530174..48b913ab 100644 --- a/src/test/java/org/segrada/util/PreconditionsTest.java +++ b/src/test/java/org/segrada/util/PreconditionsTest.java @@ -1,9 +1,9 @@ package org.segrada.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; public class PreconditionsTest { @@ -15,9 +15,9 @@ public void testCheckNotNull() throws Exception { // no exception should be thrown } - @Test(expected = NullPointerException.class) + @Test public void testCheckNotNullFail() throws Exception { - assertNull(Preconditions.checkNotNull(null, "test")); + assertThrows(NullPointerException.class, () -> Preconditions.checkNotNull(null, "test")); // exception should be thrown } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/SluggifyTest.java b/src/test/java/org/segrada/util/SluggifyTest.java index d70c20af..256c2f4c 100644 --- a/src/test/java/org/segrada/util/SluggifyTest.java +++ b/src/test/java/org/segrada/util/SluggifyTest.java @@ -1,9 +1,9 @@ package org.segrada.util; import net.sf.ehcache.CacheManager; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class SluggifyTest { @Test @@ -231,4 +231,4 @@ public void slugifyMitSonderzeichen() { assertEquals("haup-t-hose_plus-un-d-so-wahns-i-n-n", Sluggify.sluggify("Haup(t)hose_+*~#'/-\"'un[d]so--Wahns{i}n.n;")); assertEquals("haup-t-hose_plus-un-d-so-wahns-i-n-n", Sluggify.asciify("Haup(t)hose_+*~#'/-\"'un[d]so--Wahns{i}n.n;")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/segrada/util/TextExtractorTest.java b/src/test/java/org/segrada/util/TextExtractorTest.java index 6919b2ff..59507642 100644 --- a/src/test/java/org/segrada/util/TextExtractorTest.java +++ b/src/test/java/org/segrada/util/TextExtractorTest.java @@ -1,10 +1,10 @@ package org.segrada.util; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.InputStream; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; public class TextExtractorTest { @@ -61,4 +61,4 @@ public void testIdentifyLanguage() throws Exception { lang = textExtractor.identifyLanguage(textNone); assertEquals("", lang); } -} \ No newline at end of file +}