workflows = workflowService.getAvailableWorkflows();
- assertEquals("Workflows were not found in database!", 1, workflows.size());
+ assertEquals(1, workflows.size(), "Workflows were not found in database!");
SecurityTestUtils.cleanSecurityContext();
}
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/dataeditor/DataEditorServiceTest.java b/Kitodo/src/test/java/org/kitodo/production/services/dataeditor/DataEditorServiceTest.java
index 2b63ac3ab0e..8a242250248 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/dataeditor/DataEditorServiceTest.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/dataeditor/DataEditorServiceTest.java
@@ -11,15 +11,18 @@
package org.kitodo.production.services.dataeditor;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.apache.commons.io.IOUtils;
-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.kitodo.production.services.ServiceManager;
public class DataEditorServiceTest {
@@ -29,29 +32,29 @@ public class DataEditorServiceTest {
private static final String pathOfOldMetaFormat = "src/test/resources/testmetaOldFormat.xml";
private static final String metadataFilesDir = "./src/test/resources/metadata/metadataFiles/";
- @Before
+ @BeforeEach
public void saveFile() throws IOException {
File file = new File(metadataFilesDir + "testmetaOldFormat.xml");
testMetaOldFormat = IOUtils.toByteArray(file.toURI());
}
- @After
+ @AfterEach
public void revertFile() throws IOException {
IOUtils.write( testMetaOldFormat, Files.newOutputStream(Paths.get(pathOfOldMetaFormat)));
}
@Test
- public void shouldReadMetadata() throws IOException {
- dataEditorService.readData(Paths.get(metadataFilesDir + "testmeta.xml").toUri());
+ public void shouldReadMetadata() {
+ assertDoesNotThrow(() -> dataEditorService.readData(Paths.get(metadataFilesDir + "testmeta.xml").toUri()));
}
@Test
public void shouldReadOldMetadata() throws IOException {
- dataEditorService.readData(Paths.get(metadataFilesDir + "testmetaOldFormat.xml").toUri());
+ assertDoesNotThrow(() -> dataEditorService.readData(Paths.get(metadataFilesDir + "testmetaOldFormat.xml").toUri()));
}
- @Test(expected = IOException.class)
+ @Test
public void shouldNotReadMetadataOfNotExistingFile() throws IOException {
- dataEditorService.readData(Paths.get("notExisting.xml").toUri());
+ assertThrows(IOException.class, () -> dataEditorService.readData(Paths.get("notExisting.xml").toUri()));
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/dataformat/MetsServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/dataformat/MetsServiceIT.java
index 60a01d46213..af10d35d8ab 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/dataformat/MetsServiceIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/dataformat/MetsServiceIT.java
@@ -11,14 +11,14 @@
package org.kitodo.production.services.dataformat;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
import java.net.URI;
import java.util.Arrays;
import java.util.stream.Collectors;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.kitodo.api.dataformat.PhysicalDivision;
import org.kitodo.api.dataformat.Workpiece;
import org.kitodo.production.services.ServiceManager;
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/file/FileServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/file/FileServiceIT.java
index fb472873112..4e7eb7f79a0 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/file/FileServiceIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/file/FileServiceIT.java
@@ -11,9 +11,9 @@
package org.kitodo.production.services.file;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileOutputStream;
@@ -30,9 +30,9 @@
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
-import org.junit.AfterClass;
-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.Test;
import org.kitodo.MockDatabase;
import org.kitodo.TreeDeleter;
import org.kitodo.api.dataformat.MediaVariant;
@@ -61,7 +61,7 @@ public class FileServiceIT {
private static int mediaRenamingSecondProcessId = -1;
private static int revertMediaRenamingProcessId = -1;
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
FileService fileService = new FileService();
fileService.createDirectory(URI.create(""), "fileServiceTest");
@@ -71,7 +71,7 @@ public static void setUp() throws Exception {
MockDatabase.insertFoldersForSecondProject();
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws IOException {
FileService fileService = new FileService();
fileService.delete(URI.create("fileServiceTest"));
@@ -114,20 +114,20 @@ public void testCreateDirectoriesWithTrailingSlash() throws IOException {
public void testMetadataImageComparator() {
MetadataImageComparator metadataImageComparator = ServiceManager.getFileService().getMetadataImageComparator();
- assertEquals(metadataImageComparator.compare("filename2", "filename1"),1);
+ assertEquals(metadataImageComparator.compare("filename2", "filename1"), 1);
- assertEquals(metadataImageComparator.compare("0000001", "0000002"),-1);
+ assertEquals(metadataImageComparator.compare("0000001", "0000002"), -1);
assertEquals(metadataImageComparator.compare("file.name.01", "file.name.02"),-1);
assertEquals(metadataImageComparator.compare(
- new File("filename_01.tif").toURI(), new File("filename_02.tif").toURI()),-1);
+ new File("filename_01.tif").toURI(), new File("filename_02.tif").toURI()), -1);
assertEquals(metadataImageComparator.compare(
- new File("0000001.tif").toURI(), new File("0000002.tif").toURI()),-1);
+ new File("0000001.tif").toURI(), new File("0000002.tif").toURI()), -1);
assertEquals(metadataImageComparator.compare(
- new File("file.name.01.tif").toURI(), new File("file.name.02.tif").toURI()),-1);
+ new File("file.name.01.tif").toURI(), new File("file.name.02.tif").toURI()), -1);
}
@@ -212,7 +212,7 @@ private void cleanUp() throws IOException {
*
* @throws Exception when removing process from database, index or filesystem fails.
*/
- @AfterClass
+ @AfterAll
public static void removeDummyAndTestProcesses() throws Exception {
ProcessTestUtils.removeTestProcess(mediaRenamingFirstProcessId);
ProcessTestUtils.removeTestProcess(mediaRenamingSecondProcessId);
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/file/FileServiceTest.java b/Kitodo/src/test/java/org/kitodo/production/services/file/FileServiceTest.java
index ab41eb94d05..3cf8475a2b7 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/file/FileServiceTest.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/file/FileServiceTest.java
@@ -11,10 +11,11 @@
package org.kitodo.production.services.file;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -29,9 +30,9 @@
import org.apache.commons.lang3.SystemUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.junit.AfterClass;
-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.Test;
import org.kitodo.ExecutionPermission;
import org.kitodo.api.dataformat.Workpiece;
import org.kitodo.config.ConfigCore;
@@ -41,7 +42,6 @@
import org.kitodo.data.database.beans.Project;
import org.kitodo.data.database.beans.User;
import org.kitodo.exceptions.CommandException;
-import org.kitodo.exceptions.InvalidImagesException;
import org.kitodo.exceptions.MediaNotFoundException;
import org.kitodo.production.services.ServiceManager;
@@ -52,14 +52,14 @@ public class FileServiceTest {
private static final String OLD_DIRECTORY_NAME = "oldDirectoryName";
private static final String NEW_DIRECTORY_NAME = "newDirectoryName";
- @BeforeClass
+ @BeforeAll
public static void setUp() throws IOException {
fileService.createDirectory(URI.create(""), "fileServiceTest");
URI directory = fileService.createDirectory(URI.create(""), "12");
fileService.createResource(directory, "meta.xml");
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws IOException {
fileService.delete(URI.create("fileServiceTest"));
fileService.delete(URI.create("12"));
@@ -77,11 +77,11 @@ public void testCreateMetaDirectory() throws IOException, CommandException {
File file = fileService.getFile((URI.create("fileServiceTest/testMetaScript")));
ExecutionPermission.setNoExecutePermission(script);
- assertEquals("Result of execution was incorrect!", URI.create((parentFolderUri.getPath()
- + '/' + "testMetaScript")), result);
- assertTrue("Created resource is not directory!", file.isDirectory());
- assertFalse("Created resource is file!", file.isFile());
- assertTrue("Directory was not created!", file.exists());
+ assertEquals(URI.create((parentFolderUri.getPath()
+ + '/' + "testMetaScript")), result, "Result of execution was incorrect!");
+ assertTrue(file.isDirectory(), "Created resource is not directory!");
+ assertFalse(file.isFile(), "Created resource is file!");
+ assertTrue(file.exists(), "Directory was not created!");
}
@Test
@@ -89,11 +89,10 @@ public void testCreateDirectory() throws IOException {
URI testMetaUri = fileService.createDirectory(URI.create("fileServiceTest"), "testMeta");
File file = fileService.getFile(URI.create("fileServiceTest/testMeta"));
- assertTrue("Created resource is not directory!", file.isDirectory());
- assertFalse("Created resource is file!", file.isFile());
- assertTrue("Directory was not created!", file.exists());
- assertTrue("Incorrect path!",
- Paths.get(file.getPath()).toUri().getPath().contains(testMetaUri.getPath()));
+ assertTrue(file.isDirectory(), "Created resource is not directory!");
+ assertFalse(file.isFile(), "Created resource is file!");
+ assertTrue(file.exists(), "Directory was not created!");
+ assertTrue(Paths.get(file.getPath()).toUri().getPath().contains(testMetaUri.getPath()), "Incorrect path!");
}
@Test
@@ -119,8 +118,7 @@ public void testCreateDirectoryWithAlreadyExistingDirectory() throws IOException
file = fileService.getFile(URI.create("fileServiceTest/testMetaExisting"));
assertTrue(file.exists());
- assertTrue("Incorrect path!",
- Paths.get(file.getPath()).toUri().getPath().contains(testMetaUri.getPath()));
+ assertTrue(Paths.get(file.getPath()).toUri().getPath().contains(testMetaUri.getPath()), "Incorrect path!");
}
@Test
@@ -162,9 +160,8 @@ public void testRenameDirectory() throws Exception {
* MediaNotFoundException will be thrown instead of removing file references from workpiece, if no media are
* present but workpiece contains file references.
*/
- @Test(expected = MediaNotFoundException.class)
- public void testSearchForMedia()
- throws MediaNotFoundException, IOException, InvalidImagesException, URISyntaxException {
+ @Test
+ public void testSearchForMedia() throws IOException, URISyntaxException {
Process process = mock(Process.class);
Project project = mock(Project.class);
Folder folder = mock(Folder.class);
@@ -181,10 +178,10 @@ public void testSearchForMedia()
URI testmeta = Paths.get("./src/test/resources/metadata/metadataFiles/testmeta.xml").toUri();
Workpiece workpiece = ServiceManager.getMetsService().loadWorkpiece(testmeta);
- fileService.searchForMedia(process, workpiece);
+ assertThrows(MediaNotFoundException.class, () -> fileService.searchForMedia(process, workpiece));
}
- @Test(expected = IOException.class)
+ @Test
public void testRenameFileWithExistingTarget() throws IOException {
FileService fileService = new FileService();
@@ -193,15 +190,15 @@ public void testRenameFileWithExistingTarget() throws IOException {
assertTrue(fileService.fileExist(oldUri));
assertTrue(fileService.fileExist(newUri));
- fileService.renameFile(oldUri, "newName.xml");
+ assertThrows(IOException.class, () -> fileService.renameFile(oldUri, "newName.xml"));
}
- @Test(expected = FileNotFoundException.class)
- public void testRenameFileWithMissingSource() throws IOException {
+ @Test
+ public void testRenameFileWithMissingSource() {
URI oldUri = URI.create("fileServiceTest/oldNameMissing.xml");
assertFalse(fileService.fileExist(oldUri));
- fileService.renameFile(oldUri, "newName.xml");
+ assertThrows(FileNotFoundException.class, () -> fileService.renameFile(oldUri, "newName.xml"));
}
@Test
@@ -213,7 +210,6 @@ public void testGetNumberOfFiles() throws IOException {
int numberOfFiles = fileService.getNumberOfFiles(directory);
assertEquals(2, numberOfFiles);
-
}
@Test
@@ -227,7 +223,6 @@ public void testGetNumberOfFilesWithSubDirectory() throws IOException {
int numberOfFiles = fileService.getNumberOfFiles(directory);
assertEquals(3, numberOfFiles);
-
}
@Test
@@ -240,7 +235,6 @@ public void testGetNumberOfImageFiles() throws IOException {
int numberOfFiles = fileService.getNumberOfImageFiles(directory);
assertEquals(1, numberOfFiles);
-
}
@Test
@@ -254,7 +248,6 @@ public void testGetNumberOfImageFilesWithSubDirectory() throws IOException {
int numberOfFiles = fileService.getNumberOfImageFiles(directory);
assertEquals(1, numberOfFiles);
-
}
@Test
@@ -270,19 +263,17 @@ public void testCopyDirectory() throws IOException {
assertTrue(fileService.fileExist(toDirectory));
assertTrue(fileService.fileExist(toDirectory.resolve("test.pdf")));
assertTrue(fileService.fileExist(fromDirectory));
-
}
- @Test(expected = FileNotFoundException.class)
- public void testCopyDirectoryWithMissingSource() throws IOException {
+ @Test
+ public void testCopyDirectoryWithMissingSource() {
URI fromDirectory = URI.create("fileServiceTest/copyDirectoryNotExisting/");
URI toDirectory = URI.create("fileServiceTest/copyDirectoryNotExistingTo/");
assertFalse(fileService.fileExist(fromDirectory));
assertFalse(fileService.fileExist(toDirectory));
- fileService.copyDirectory(fromDirectory, toDirectory);
-
+ assertThrows(FileNotFoundException.class, () -> fileService.copyDirectory(fromDirectory, toDirectory));
}
@Test
@@ -304,7 +295,6 @@ public void testCopyDirectoryWithExistingTarget() throws IOException {
assertTrue(fileService.fileExist(fromDirectory));
assertTrue(fileService.fileExist(fromDirectory.resolve("testToCopy.pdf")));
assertFalse(fileService.fileExist(fromDirectory.resolve("testExisting.pdf")));
-
}
@Test
@@ -319,19 +309,17 @@ public void testCopyFile() throws IOException {
assertTrue(fileService.fileExist(originFile));
assertTrue(fileService.fileExist(targetFile));
-
}
- @Test(expected = FileNotFoundException.class)
- public void testCopyFileWithMissingSource() throws IOException {
+ @Test
+ public void testCopyFileWithMissingSource() {
URI originFile = URI.create("fileServiceTest/copyFileMissing");
URI targetFile = URI.create("fileServiceTest/copyFileTargetMissing");
assertFalse(fileService.fileExist(originFile));
assertFalse(fileService.fileExist(targetFile));
- fileService.copyFile(originFile, targetFile);
-
+ assertThrows(FileNotFoundException.class, () -> fileService.copyFile(originFile, targetFile));
}
@Test
@@ -346,7 +334,6 @@ public void testCopyFileWithExistingTarget() throws IOException {
assertTrue(fileService.fileExist(originFile));
assertTrue(fileService.fileExist(targetFile));
-
}
@Test
@@ -362,7 +349,6 @@ public void testCopyFileToDirectory() throws IOException {
assertTrue(fileService.fileExist(originFile));
assertTrue(fileService.fileExist(targetDirectory.resolve("copyFileToDirectory.txt")));
-
}
@Test
@@ -378,10 +364,9 @@ public void testCopyFileToDirectoryWithMissingDirectory() throws IOException {
assertTrue(fileService.fileExist(originFile));
assertTrue(fileService.fileExist(targetDirectory.resolve("copyFileToDirectoryMissing")));
-
}
- @Test(expected = FileNotFoundException.class)
+ @Test
public void testCopyFileToDirectoryWithMissingSource() throws IOException {
URI originFile = URI.create("fileServiceTest/copyFileToDirectoryMissingSource");
URI targetDirectory = fileService.createDirectory(URI.create("fileServiceTest"),
@@ -391,8 +376,7 @@ public void testCopyFileToDirectoryWithMissingSource() throws IOException {
assertTrue(fileService.fileExist(targetDirectory));
assertFalse(fileService.fileExist(targetDirectory.resolve("copyFileToDirectoryMissingSource")));
- fileService.copyFileToDirectory(originFile, targetDirectory);
-
+ assertThrows(FileNotFoundException.class, () -> fileService.copyFileToDirectory(originFile, targetDirectory));
}
@Test
@@ -430,7 +414,6 @@ public void testFileExist() throws IOException {
URI existing = fileService.createResource(URI.create("fileServiceTest"), "fileExists");
assertTrue(fileService.fileExist(existing));
-
}
@Test
@@ -485,19 +468,17 @@ public void testMoveDirectory() throws IOException {
assertFalse(fileService.fileExist(directory.resolve("test.xml")));
assertTrue(fileService.fileExist(target));
assertTrue(fileService.fileExist(target.resolve("test.xml")));
-
}
- @Test(expected = FileNotFoundException.class)
- public void testMoveDirectoryWithMissingSource() throws IOException {
+ @Test
+ public void testMoveDirectoryWithMissingSource() {
URI directory = URI.create("fileServiceTest/movingDirectoryMissing/");
URI target = URI.create("fileServiceTest/movingDirectoryMissingTarget/");
assertFalse(fileService.fileExist(directory));
assertFalse(fileService.fileExist(target));
- fileService.moveDirectory(directory, target);
-
+ assertThrows(FileNotFoundException.class, () -> fileService.moveDirectory(directory, target));
}
@Test
@@ -519,7 +500,6 @@ public void testMoveDirectoryWithExistingTarget() throws IOException {
assertTrue(fileService.fileExist(target));
assertTrue(fileService.fileExist(target.resolve("test.xml")));
assertTrue(fileService.fileExist(target.resolve("testTarget.xml")));
-
}
@Test
@@ -534,19 +514,17 @@ public void testMoveFile() throws IOException {
assertFalse(fileService.fileExist(file));
assertTrue(fileService.fileExist(target));
-
}
- @Test(expected = FileNotFoundException.class)
- public void testMoveFileWithMissingSource() throws IOException {
+ @Test
+ public void testMoveFileWithMissingSource() {
URI file = URI.create("fileServiceTest/movingFileMissing");
URI target = URI.create("fileServiceTest/movingFileMissingTarget");
assertFalse(fileService.fileExist(file));
assertFalse(fileService.fileExist(target));
- fileService.moveDirectory(file, target);
-
+ assertThrows(FileNotFoundException.class, () -> fileService.moveDirectory(file, target));
}
@Test
@@ -561,7 +539,6 @@ public void testMoveFileWithExistingTarget() throws IOException {
assertFalse(fileService.fileExist(file));
assertTrue(fileService.fileExist(target));
-
}
@Test
@@ -597,7 +574,7 @@ public void testCreateBackupFile() throws IOException {
public void testDeleteFirstSlashFromPath() {
URI uri = URI.create("/test/test");
URI actualUri = fileService.deleteFirstSlashFromPath(uri);
- assertEquals("Paths of Uri did not match", "test/test", actualUri.getPath());
+ assertEquals("test/test", actualUri.getPath(), "Paths of Uri did not match");
}
@Test
@@ -615,7 +592,7 @@ public void shouldCreateSymLink() throws IOException {
ExecutionPermission.setExecutePermission(script);
boolean result = fileService.createSymLink(symLinkSource, symLinkTarget, false, user);
ExecutionPermission.setNoExecutePermission(script);
- assertTrue("Create symbolic link has failed!", result);
+ assertTrue(result, "Create symbolic link has failed!");
File scriptClean = new File(ConfigCore.getParameter(ParameterCore.SCRIPT_DELETE_SYMLINK));
ExecutionPermission.setExecutePermission(scriptClean);
@@ -645,7 +622,7 @@ public void shouldDeleteSymLink() throws IOException {
ExecutionPermission.setExecutePermission(script);
boolean result = fileService.deleteSymLink(symLinkTarget);
ExecutionPermission.setNoExecutePermission(script);
- assertTrue("Delete symbolic link has failed!", result);
+ assertTrue(result, "Delete symbolic link has failed!");
fileService.delete(symLinkSource);
fileService.delete(symLinkTarget);
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/image/ImageGeneratorIT.java b/Kitodo/src/test/java/org/kitodo/production/services/image/ImageGeneratorIT.java
index 3a5a3ac1e8d..d0c41bb6c1a 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/image/ImageGeneratorIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/image/ImageGeneratorIT.java
@@ -12,8 +12,8 @@
package org.kitodo.production.services.image;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.io.File;
import java.io.IOException;
@@ -29,9 +29,9 @@
import java.util.Optional;
import java.util.concurrent.TimeUnit;
-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.kitodo.config.ConfigCore;
import org.kitodo.data.database.beans.Folder;
import org.kitodo.data.database.beans.Process;
@@ -147,7 +147,7 @@ private static void setField(Object subject, String predicate, Object object) th
* broken image go into the destination directory. This happens twice, for
* the two test variants.
*/
- @Before
+ @BeforeEach
public void setUp() throws IOException {
Path processDir = Paths.get(metadata, processId.toString());
if (processDir.toFile().exists()) {
@@ -176,7 +176,7 @@ public void setUp() throws IOException {
/**
* Deletes the files created in the test.
*/
- @After
+ @AfterEach
public void tearDown() throws IOException {
Path processDir = Paths.get(metadata, processId.toString());
Files.walk(processDir).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
@@ -217,12 +217,9 @@ public void testTheNewGenerationOfAllImagesOrFilesInDifferentFolders() throws Ex
imageGenerator.run();
- assertNotEquals(resultFileOne + MESSAGE_NOT_CHANGED, resultFileOneBefore,
- lastModifiedTime(resultFileOne));
- assertNotEquals(resultFileTwo + MESSAGE_NOT_CHANGED, resultFileTwoBefore,
- lastModifiedTime(resultFileTwo));
- assertNotEquals(resultFileThree + MESSAGE_NOT_CHANGED, resultFileThreeBefore,
- lastModifiedTime(resultFileThree));
+ assertNotEquals(resultFileOneBefore, lastModifiedTime(resultFileOne), resultFileOne + MESSAGE_NOT_CHANGED);
+ assertNotEquals(resultFileTwoBefore, lastModifiedTime(resultFileTwo), resultFileTwo + MESSAGE_NOT_CHANGED);
+ assertNotEquals(resultFileThreeBefore, lastModifiedTime(resultFileThree), resultFileThree + MESSAGE_NOT_CHANGED);
}
/**
@@ -261,12 +258,9 @@ public void testRecreatingAllMissingImagesForFilesInDifferentFolders() throws Ex
imageGenerator.run();
- assertEquals(resultFileOne + MESSAGE_CHANGED, resultFileOneBefore,
- lastModifiedTime(resultFileOne));
- assertEquals(resultFileTwo + MESSAGE_CHANGED, resultFileTwoBefore,
- lastModifiedTime(resultFileTwo));
- assertNotEquals(resultFileThree + MESSAGE_NOT_CHANGED, resultFileThreeBefore,
- lastModifiedTime(resultFileThree));
+ assertEquals(resultFileOneBefore, lastModifiedTime(resultFileOne), resultFileOne + MESSAGE_CHANGED);
+ assertEquals(resultFileTwoBefore, lastModifiedTime(resultFileTwo), resultFileTwo + MESSAGE_CHANGED);
+ assertNotEquals(resultFileThreeBefore, lastModifiedTime(resultFileThree), resultFileThree + MESSAGE_NOT_CHANGED);
}
/**
@@ -305,12 +299,9 @@ public void testRecreatingAllMissingOrDamagedImagesForFilesInDifferentFolders()
imageGenerator.run();
- assertEquals(resultFileOne + MESSAGE_CHANGED, resultFileOneBefore,
- lastModifiedTime(resultFileOne));
- assertNotEquals(resultFileTwo + MESSAGE_NOT_CHANGED, resultFileTwoBefore,
- lastModifiedTime(resultFileTwo));
- assertNotEquals(resultFileThree + MESSAGE_NOT_CHANGED, resultFileThreeBefore,
- lastModifiedTime(resultFileThree));
+ assertEquals(resultFileOneBefore, lastModifiedTime(resultFileOne), resultFileOne + MESSAGE_CHANGED);
+ assertNotEquals(resultFileTwoBefore, lastModifiedTime(resultFileTwo), resultFileTwo + MESSAGE_NOT_CHANGED);
+ assertNotEquals(resultFileThreeBefore, lastModifiedTime(resultFileThree), resultFileThree + MESSAGE_NOT_CHANGED);
}
/**
@@ -347,12 +338,9 @@ public void testTheNewGenerationOfAllImagesOrFilesInTheSameFolder() throws Excep
imageGenerator.run();
- assertNotEquals(mixedResultOne + MESSAGE_NOT_CHANGED, resultFileOneBefore,
- lastModifiedTime(mixedResultOne));
- assertNotEquals(mixedResultTwo + MESSAGE_NOT_CHANGED, resultFileTwoBefore,
- lastModifiedTime(mixedResultTwo));
- assertNotEquals(mixedResultThree + MESSAGE_NOT_CHANGED, resultFileThreeBefore,
- lastModifiedTime(mixedResultThree));
+ assertNotEquals(resultFileOneBefore, lastModifiedTime(mixedResultOne), mixedResultOne + MESSAGE_NOT_CHANGED);
+ assertNotEquals(resultFileTwoBefore, lastModifiedTime(mixedResultTwo), mixedResultTwo + MESSAGE_NOT_CHANGED);
+ assertNotEquals(resultFileThreeBefore, lastModifiedTime(mixedResultThree), mixedResultThree + MESSAGE_NOT_CHANGED);
}
/**
@@ -391,12 +379,9 @@ public void testRecreatingAllMissingImagesForFilesInTheSameFolder() throws Excep
imageGenerator.run();
- assertEquals(mixedResultOne + MESSAGE_CHANGED, resultFileOneBefore,
- lastModifiedTime(mixedResultOne));
- assertEquals(mixedResultTwo + MESSAGE_CHANGED, resultFileTwoBefore,
- lastModifiedTime(mixedResultTwo));
- assertNotEquals(mixedResultThree + MESSAGE_NOT_CHANGED, resultFileThreeBefore,
- lastModifiedTime(mixedResultThree));
+ assertEquals(resultFileOneBefore, lastModifiedTime(mixedResultOne), mixedResultOne + MESSAGE_CHANGED);
+ assertEquals(resultFileTwoBefore, lastModifiedTime(mixedResultTwo), mixedResultTwo + MESSAGE_CHANGED);
+ assertNotEquals(resultFileThreeBefore, lastModifiedTime(mixedResultThree), mixedResultThree + MESSAGE_NOT_CHANGED);
}
/**
@@ -435,11 +420,8 @@ public void testRecreatingAllMissingOrDamagedImagesForFilesInTheSameFolder() thr
imageGenerator.run();
- assertEquals(mixedResultOne + MESSAGE_CHANGED, resultFileOneBefore,
- lastModifiedTime(mixedResultOne));
- assertNotEquals(mixedResultTwo + MESSAGE_NOT_CHANGED, resultFileTwoBefore,
- lastModifiedTime(mixedResultTwo));
- assertNotEquals(mixedResultThree + MESSAGE_NOT_CHANGED, resultFileThreeBefore,
- lastModifiedTime(mixedResultThree));
+ assertEquals(resultFileOneBefore, lastModifiedTime(mixedResultOne), mixedResultOne + MESSAGE_CHANGED);
+ assertNotEquals(resultFileTwoBefore, lastModifiedTime(mixedResultTwo), mixedResultTwo + MESSAGE_NOT_CHANGED);
+ assertNotEquals(resultFileThreeBefore, lastModifiedTime(mixedResultThree), mixedResultThree + MESSAGE_NOT_CHANGED);
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/migration/MigrationServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/migration/MigrationServiceIT.java
index 1423095bccf..93a38de3484 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/migration/MigrationServiceIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/migration/MigrationServiceIT.java
@@ -11,15 +11,21 @@
package org.kitodo.production.services.migration;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import org.junit.After;
-import org.junit.Assert;
-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.kitodo.MockDatabase;
import org.kitodo.SecurityTestUtils;
import org.kitodo.data.database.beans.Process;
@@ -37,14 +43,14 @@ public class MigrationServiceIT {
private MigrationService migrationService = ServiceManager.getMigrationService();
- @Before
+ @BeforeEach
public void prepareDatabase() throws Exception {
MockDatabase.startNode();
MockDatabase.insertProcessesFull();
SecurityTestUtils.addUserDataToSecurityContext(ServiceManager.getUserService().getById(1), 1);
}
- @After
+ @AfterEach
public void cleanDatabase() throws Exception {
MockDatabase.stopNode();
MockDatabase.cleanDatabase();
@@ -62,19 +68,17 @@ public void testTasksAreEqual() throws DAOException {
taskOne.setTitle("test");
tasksToCompare.add(taskOne);
- Assert.assertFalse("Lists should have a different size",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "Lists should have a different size");
Task taskTwo = new Task();
taskTwo.setTitle("testTwo");
tasksToCompare.add(taskTwo);
- Assert.assertFalse("Tasks should have different Titles",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "Tasks should have different Titles");
tasksToCompare.set(1, null);
- Assert.assertFalse("Null task should fail", migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "Null task should fail");
Task correctTaskOne = new Task();
correctTaskOne.setTitle("Finished");
@@ -88,20 +92,18 @@ public void testTasksAreEqual() throws DAOException {
tasksToCompare.add(correctTaskOne);
tasksToCompare.add(correctTaskTwo);
- Assert.assertFalse("scriptPath should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "scriptPath should be different");
correctTaskTwo.setScriptPath("../type/automatic/script/path");
- Assert.assertTrue("Tasks should be equal", migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertTrue(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "Tasks should be equal");
correctTaskOne.setBatchStep(false);
tasksToCompare.clear();
tasksToCompare.add(correctTaskTwo);
tasksToCompare.add(correctTaskOne);
- Assert.assertFalse("Tasks are in the wrong order",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "Tasks are in the wrong order");
}
@@ -126,50 +128,42 @@ public void testBooleans() throws DAOException {
correctTaskOne.setTypeMetadata(true);
- Assert.assertFalse("TypeMetadata should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "TypeMetadata should be different");
correctTaskOne.setTypeMetadata(false);
correctTaskOne.setTypeImagesWrite(true);
- Assert.assertFalse("typeImagesWrite should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "typeImagesWrite should be different");
correctTaskOne.setTypeImagesWrite(false);
correctTaskOne.setTypeImagesRead(true);
- Assert.assertFalse("typeImagesRead should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "typeImagesRead should be different");
correctTaskOne.setTypeImagesRead(false);
correctTaskOne.setTypeAutomatic(true);
- Assert.assertFalse("typeAutomatic should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "typeAutomatic should be different");
correctTaskOne.setTypeAutomatic(false);
correctTaskOne.setTypeExportDMS(true);
- Assert.assertFalse("TypeExportDMS should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "TypeExportDMS should be different");
correctTaskOne.setTypeExportDMS(false);
correctTaskOne.setTypeAcceptClose(true);
- Assert.assertFalse("TypeAcceptClose should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "TypeAcceptClose should be different");
correctTaskOne.setTypeAcceptClose(false);
correctTaskOne.setTypeCloseVerify(true);
- Assert.assertFalse("TypeCloseVerify should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "TypeCloseVerify should be different");
correctTaskOne.setTypeCloseVerify(false);
correctTaskOne.setBatchStep(true);
- Assert.assertFalse("batchStep should be different",
- migrationService.tasksAreEqual(originalTasks, tasksToCompare));
+ assertFalse(migrationService.tasksAreEqual(originalTasks, tasksToCompare), "batchStep should be different");
}
@@ -187,13 +181,13 @@ public void getMatchingTemplatesTest() throws DAOException {
newTemplates.add(template);
Map matchingTemplates = migrationService.getMatchingTemplates(newTemplates);
- Assert.assertNotNull(matchingTemplates.get(template));
- Assert.assertEquals(existingTemplates.get(0), matchingTemplates.get(template));
+ assertNotNull(matchingTemplates.get(template));
+ assertEquals(existingTemplates.get(0), matchingTemplates.get(template));
template.setDocket(null);
- Assert.assertNull(matchingTemplates.get(template));
- Assert.assertNotEquals(existingTemplates.get(0), matchingTemplates.get(template));
+ assertNull(matchingTemplates.get(template));
+ assertNotEquals(existingTemplates.get(0), matchingTemplates.get(template));
}
@Test
@@ -217,16 +211,16 @@ public void testAddToTemplate() throws DAOException, DataException {
Template template = new Template();
template.setTitle("testTemplate");
ServiceManager.getTemplateService().save(template);
- Assert.assertEquals(0, template.getProcesses().size());
- Assert.assertNull(firstProcess.getTemplate());
- Assert.assertNull(secondProcess.getTemplate());
+ assertEquals(0, template.getProcesses().size());
+ assertNull(firstProcess.getTemplate());
+ assertNull(secondProcess.getTemplate());
migrationService.addProcessesToTemplate(template, processes);
template = ServiceManager.getTemplateService().getById(template.getId());
- Assert.assertEquals(2, template.getProcesses().size());
- Assert.assertEquals(5, (long) firstProcess.getTemplate().getId());
- Assert.assertEquals(5, (long) secondProcess.getTemplate().getId());
+ assertEquals(2, template.getProcesses().size());
+ assertEquals(5, (long) firstProcess.getTemplate().getId());
+ assertEquals(5, (long) secondProcess.getTemplate().getId());
}
@Test
@@ -235,15 +229,15 @@ public void addProcessesToTemplateTest() throws DAOException, DataException {
Template secondTemplate = ServiceManager.getTemplateService().getById(2);
List firstTemplateProcesses = firstTemplate.getProcesses();
- Assert.assertEquals(2, firstTemplateProcesses.size());
- Assert.assertEquals(0, secondTemplate.getProcesses().size());
- Assert.assertEquals(1, (long) firstTemplateProcesses.get(0).getTemplate().getId());
+ assertEquals(2, firstTemplateProcesses.size());
+ assertEquals(0, secondTemplate.getProcesses().size());
+ assertEquals(1, (long) firstTemplateProcesses.get(0).getTemplate().getId());
migrationService.addProcessesToTemplate(secondTemplate, firstTemplateProcesses);
- Assert.assertEquals(2, firstTemplateProcesses.size());
+ assertEquals(2, firstTemplateProcesses.size());
secondTemplate = ServiceManager.getTemplateService().getById(2);
- Assert.assertEquals(2, secondTemplate.getProcesses().size());
- Assert.assertEquals(2, (long) firstTemplateProcesses.get(0).getTemplate().getId());
+ assertEquals(2, secondTemplate.getProcesses().size());
+ assertEquals(2, (long) firstTemplateProcesses.get(0).getTemplate().getId());
}
@Test
@@ -253,36 +247,31 @@ public void testCreateTemplatesForProcesses() throws DAOException {
Map> templatesForProcesses = migrationService.createTemplatesForProcesses(processes,
workflow);
- Assert.assertEquals(1, templatesForProcesses.size());
- Assert.assertEquals(processes.get(0).getDocket(), templatesForProcesses.keySet().iterator().next().getDocket());
- Assert.assertEquals(processes.get(0).getRuleset(),
- templatesForProcesses.keySet().iterator().next().getRuleset());
- Assert.assertEquals(2, templatesForProcesses.values().iterator().next().size());
+ assertEquals(1, templatesForProcesses.size());
+ assertEquals(processes.get(0).getDocket(), templatesForProcesses.keySet().iterator().next().getDocket());
+ assertEquals(processes.get(0).getRuleset(), templatesForProcesses.keySet().iterator().next().getRuleset());
+ assertEquals(2, templatesForProcesses.values().iterator().next().size());
}
@Test
public void testCreateTaskString() throws DAOException {
- Assert.assertEquals("Finished, Closed, Progress, Open, Locked" + MigrationService.SEPARATOR + "9c43055e",
- migrationService.createTaskString(ServiceManager.getProcessService().getById(1).getTasks()));
+ assertEquals("Finished, Closed, Progress, Open, Locked" + MigrationService.SEPARATOR + "9c43055e", migrationService.createTaskString(ServiceManager.getProcessService().getById(1).getTasks()));
List secondTasks = ServiceManager.getProcessService().getById(2).getTasks();
- Assert.assertEquals("Additional, Processed and Some, Next Open" + MigrationService.SEPARATOR + "848a8483",
- migrationService.createTaskString(secondTasks));
+ assertEquals("Additional, Processed and Some, Next Open" + MigrationService.SEPARATOR + "848a8483", migrationService.createTaskString(secondTasks));
secondTasks.get(0).setTitle("test/test");
- Assert.assertEquals("test/test, Processed and Some, Next Open" + MigrationService.SEPARATOR + "56f49a2b",
- migrationService.createTaskString(secondTasks));
- Assert.assertEquals(MigrationService.SEPARATOR + "0",
- migrationService.createTaskString(ServiceManager.getProcessService().getById(3).getTasks()));
+ assertEquals("test/test, Processed and Some, Next Open" + MigrationService.SEPARATOR + "56f49a2b", migrationService.createTaskString(secondTasks));
+ assertEquals(MigrationService.SEPARATOR + "0", migrationService.createTaskString(ServiceManager.getProcessService().getById(3).getTasks()));
}
@Test
public void testTitleIsValid() throws DAOException {
Template newTemplate = new Template();
newTemplate.setClient(ServiceManager.getClientService().getById(1));
- Assert.assertFalse(migrationService.isTitleValid(newTemplate));
+ assertFalse(migrationService.isTitleValid(newTemplate));
newTemplate.setTitle("test");
- Assert.assertTrue(migrationService.isTitleValid(newTemplate));
+ assertTrue(migrationService.isTitleValid(newTemplate));
newTemplate.setTitle("First template");
- Assert.assertFalse(migrationService.isTitleValid(newTemplate));
+ assertFalse(migrationService.isTitleValid(newTemplate));
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/security/SecurityAccessServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/security/SecurityAccessServiceIT.java
index ba03d7dd26d..7b4b27aee87 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/security/SecurityAccessServiceIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/security/SecurityAccessServiceIT.java
@@ -11,13 +11,15 @@
package org.kitodo.production.services.security;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Collection;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.SecurityTestUtils;
import org.kitodo.data.database.beans.User;
@@ -28,19 +30,19 @@
public class SecurityAccessServiceIT {
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
MockDatabase.startNode();
MockDatabase.insertForAuthenticationTesting();
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
MockDatabase.stopNode();
MockDatabase.cleanDatabase();
}
- @After
+ @AfterEach
public void cleanContext() {
SecurityTestUtils.cleanSecurityContext();
}
@@ -51,23 +53,20 @@ public void shouldGetAuthorities() throws DAOException {
SecurityTestUtils.addUserDataToSecurityContext(user, 1);
Collection extends GrantedAuthority> authorities = SecurityContextHolder.getContext().getAuthentication()
.getAuthorities();
- Assert.assertEquals("Security context holder does not hold the corresponding authorities", 172,
- authorities.size());
+ assertEquals(172, authorities.size(), "Security context holder does not hold the corresponding authorities");
}
@Test
public void hasAuthorityTest() throws DAOException {
User user = ServiceManager.getUserService().getByLogin("kowal");
SecurityTestUtils.addUserDataToSecurityContext(user, 1);
- Assert.assertTrue("The authority \"editClient\" was not found for authenticated user",
- ServiceManager.getSecurityAccessService().hasAuthorityGlobal("editClient"));
+ assertTrue(ServiceManager.getSecurityAccessService().hasAuthorityGlobal("editClient"), "The authority \"editClient\" was not found for authenticated user");
}
@Test
public void hasAuthorityForClientTest() throws DAOException {
User user = ServiceManager.getUserService().getByLogin("kowal");
SecurityTestUtils.addUserDataToSecurityContext(user,1);
- Assert.assertTrue("Checking if user has edit project authority for first client returned wrong value",
- ServiceManager.getSecurityAccessService().hasAuthorityForClient("editProject"));
+ assertTrue(ServiceManager.getSecurityAccessService().hasAuthorityForClient("editProject"), "Checking if user has edit project authority for first client returned wrong value");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/validation/MetadataValidationServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/validation/MetadataValidationServiceIT.java
index 64be0855bab..39d82aaf6a1 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/validation/MetadataValidationServiceIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/validation/MetadataValidationServiceIT.java
@@ -11,6 +11,10 @@
package org.kitodo.production.services.validation;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.io.IOException;
import java.net.URI;
@@ -18,7 +22,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface;
import org.kitodo.api.dataformat.Workpiece;
@@ -47,15 +50,15 @@ public class MetadataValidationServiceIT {
public void shouldValidateMetadataByURIAndWarnAboutMissingMedia() {
ValidationResult result = getValidationResultByURI(TEST_META);
List validationMessages = new ArrayList<>(result.getResultMessages());
- Assertions.assertEquals(1, validationMessages.size(), WRONG_NUMBER_MESSAGE);
- Assertions.assertTrue(validationMessages.contains(NO_MEDIA_ASSIGNED_MESSAGE), WRONG_VALIDATION_MESSAGE);
- Assertions.assertEquals(State.WARNING, result.getState(), WRONG_STATE_MESSAGE);
+ assertEquals(1, validationMessages.size(), WRONG_NUMBER_MESSAGE);
+ assertTrue(validationMessages.contains(NO_MEDIA_ASSIGNED_MESSAGE), WRONG_VALIDATION_MESSAGE);
+ assertEquals(State.WARNING, result.getState(), WRONG_STATE_MESSAGE);
}
@Test
public void shouldValidateMetadataByURIAndRaiseError() {
ValidationResult result = getValidationResultByURI(TEST_KALLIOPE_PARENT);
- Assertions.assertEquals(State.ERROR, result.getState(), WRONG_STATE_MESSAGE);
+ assertEquals(State.ERROR, result.getState(), WRONG_STATE_MESSAGE);
}
@Test
@@ -68,10 +71,10 @@ public void shouldValidateMetadataByWorkpieceAndWarnAboutMissingMediaAndID() thr
List validationMessages = new ArrayList<>(result.getResultMessages());
// the number of expected warnings is 2 instead of 1 here because validating by workpiece additionally adds a
// warning for missing process IDs in the workpiece
- Assertions.assertEquals(2, validationMessages.size(), WRONG_NUMBER_MESSAGE);
- Assertions.assertTrue(validationMessages.contains(NO_MEDIA_ASSIGNED_MESSAGE), WRONG_VALIDATION_MESSAGE);
- Assertions.assertTrue(validationMessages.contains(MISSING_ID_MESSAGE), WRONG_VALIDATION_MESSAGE);
- Assertions.assertEquals(State.WARNING, result.getState(), WRONG_STATE_MESSAGE);
+ assertEquals(2, validationMessages.size(), WRONG_NUMBER_MESSAGE);
+ assertTrue(validationMessages.contains(NO_MEDIA_ASSIGNED_MESSAGE), WRONG_VALIDATION_MESSAGE);
+ assertTrue(validationMessages.contains(MISSING_ID_MESSAGE), WRONG_VALIDATION_MESSAGE);
+ assertEquals(State.WARNING, result.getState(), WRONG_STATE_MESSAGE);
}
@Test
@@ -81,8 +84,8 @@ public void shouldValidateMetadataByWorkpieceWithoutWarning() throws IOException
ruleset.load(new File(TestConstants.TEST_RULESET));
Workpiece workpiece = ServiceManager.getMetsService().loadWorkpiece(metsUri);
ValidationResult result = ServiceManager.getMetadataValidationService().validate(workpiece, ruleset, false);
- Assertions.assertTrue(result.getResultMessages().isEmpty(), SHOULD_NOT_PRODUCE_WARNINGS_MESSAGE);
- Assertions.assertEquals(State.SUCCESS, result.getState(), SHOULD_SUCCEED_MESSAGE);
+ assertTrue(result.getResultMessages().isEmpty(), SHOULD_NOT_PRODUCE_WARNINGS_MESSAGE);
+ assertEquals(State.SUCCESS, result.getState(), SHOULD_SUCCEED_MESSAGE);
}
@Test
@@ -92,8 +95,8 @@ public void shouldValidateAndRaiseErrorAndLaxValidation() throws IOException, DA
ruleset.load(new File(TestConstants.TEST_RULESET));
Workpiece workpiece = ServiceManager.getMetsService().loadWorkpiece(metsUri);
ValidationResult result = ServiceManager.getMetadataValidationService().validate(workpiece, ruleset, false);
- Assertions.assertFalse(result.getResultMessages().isEmpty(), SHOULD_PRODUCE_ERRORS_MESSAGE);
- Assertions.assertEquals(State.ERROR, result.getState(), SHOULD_FAIL_MESSAGE);
+ assertFalse(result.getResultMessages().isEmpty(), SHOULD_PRODUCE_ERRORS_MESSAGE);
+ assertEquals(State.ERROR, result.getState(), SHOULD_FAIL_MESSAGE);
}
private ValidationResult getValidationResultByURI(String metadataFile) {
diff --git a/Kitodo/src/test/java/org/kitodo/production/services/workflow/WorkflowControllerServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/workflow/WorkflowControllerServiceIT.java
index 8747b824acf..c4855a3a7d1 100644
--- a/Kitodo/src/test/java/org/kitodo/production/services/workflow/WorkflowControllerServiceIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/services/workflow/WorkflowControllerServiceIT.java
@@ -11,10 +11,10 @@
package org.kitodo.production.services.workflow;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.File;
import java.io.IOException;
@@ -24,10 +24,10 @@
import java.util.Objects;
import org.apache.commons.lang3.SystemUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.kitodo.ExecutionPermission;
import org.kitodo.MockDatabase;
import org.kitodo.SecurityTestUtils;
@@ -65,7 +65,7 @@ public class WorkflowControllerServiceIT {
private static int workflowTestProcessId2 = -1;
private static final String METADATA_TEST_FILENAME = "testMetadataForNonBlockingParallelTasksTest.xml";
- @Before
+ @BeforeEach
public void prepareDatabase() throws Exception {
MockDatabase.startNode();
MockDatabase.insertProcessesForWorkflowFull();
@@ -87,7 +87,7 @@ public void prepareDatabase() throws Exception {
}
}
- @After
+ @AfterEach
public void cleanDatabase() throws Exception {
ProcessTestUtils.removeTestProcess(workflowTestProcessId);
ProcessTestUtils.removeTestProcess(workflowTestProcessId2);
@@ -111,8 +111,7 @@ public void shouldSetTaskStatusUp() throws Exception {
Task task = taskService.getById(10);
workflowService.setTaskStatusUp(task);
- assertEquals("Task '" + task.getTitle() + "' status was not set up!", TaskStatus.OPEN,
- task.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, task.getProcessingStatus(), "Task '" + task.getTitle() + "' status was not set up!");
workflowService.setTaskStatusDown(task);
taskService.save(task);
@@ -122,22 +121,17 @@ public void shouldSetTaskStatusUp() throws Exception {
public void shouldSetTasksStatusUp() throws Exception {
Process process = ServiceManager.getProcessService().getById(1);
List tasks = process.getTasks();
- assertEquals("Task '" + tasks.get(3).getTitle() + "' status should be OPEN!", TaskStatus.OPEN,
- tasks.get(3).getProcessingStatus());
- assertEquals("Task '" + tasks.get(2).getTitle() + "' status should be INWORK!", TaskStatus.INWORK,
- tasks.get(2).getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, tasks.get(3).getProcessingStatus(), "Task '" + tasks.get(3).getTitle() + "' status should be OPEN!");
+ assertEquals(TaskStatus.INWORK, tasks.get(2).getProcessingStatus(), "Task '" + tasks.get(2).getTitle() + "' status should be INWORK!");
workflowService.setTasksStatusUp(process);
for (Task task : process.getTasks()) {
if (Objects.equals(task.getId(), 9)) {
- assertEquals("Task '" + task.getTitle() + "' status was not set up!", TaskStatus.INWORK,
- task.getProcessingStatus());
+ assertEquals(TaskStatus.INWORK, task.getProcessingStatus(), "Task '" + task.getTitle() + "' status was not set up!");
} else if (Objects.equals(task.getId(), 10)) {
- assertEquals("Task '" + task.getTitle() + "' status should not be set up!", TaskStatus.LOCKED,
- task.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, task.getProcessingStatus(), "Task '" + task.getTitle() + "' status should not be set up!");
} else {
- assertEquals("Task '" + task.getTitle() + "' status was not set up!", TaskStatus.DONE,
- task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' status was not set up!");
}
}
}
@@ -147,17 +141,13 @@ public void shouldSetTasksStatusDown() throws Exception {
Process process = ServiceManager.getProcessService().getById(1);
//Due to testszenario there are multiple current tasks, so task with id 2 is set down twice (inwork->open->locked)
List tasks = process.getTasks();
- assertEquals("Task '" + tasks.get(3).getTitle() + "' status should be OPEN!", TaskStatus.OPEN,
- tasks.get(3).getProcessingStatus());
- assertEquals("Task '" + tasks.get(2).getTitle() + "' status should be INWORK!", TaskStatus.INWORK,
- tasks.get(2).getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, tasks.get(3).getProcessingStatus(), "Task '" + tasks.get(3).getTitle() + "' status should be OPEN!");
+ assertEquals(TaskStatus.INWORK, tasks.get(2).getProcessingStatus(), "Task '" + tasks.get(2).getTitle() + "' status should be INWORK!");
workflowService.setTasksStatusDown(process);
tasks = process.getTasks();
- assertEquals("Task '" + tasks.get(3).getTitle() + "' status was not set down!", TaskStatus.LOCKED,
- tasks.get(3).getProcessingStatus());
- assertEquals("Task '" + tasks.get(2).getTitle() + "' status was not set down!", TaskStatus.LOCKED,
- tasks.get(2).getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, tasks.get(3).getProcessingStatus(), "Task '" + tasks.get(3).getTitle() + "' status was not set down!");
+ assertEquals(TaskStatus.LOCKED, tasks.get(2).getProcessingStatus(), "Task '" + tasks.get(2).getTitle() + "' status was not set down!");
}
@Test
@@ -165,11 +155,10 @@ public void shouldClose() throws Exception {
Task task = taskService.getById(9);
workflowService.close(task);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
Task nextTask = taskService.getById(10);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
}
@Test
@@ -178,26 +167,22 @@ public void shouldCloseForProcessWithParallelTasks() throws Exception {
ProcessTestUtils.copyTestMetadataFile(task.getProcess().getId(), ProcessTestUtils.testFileChildProcessToKeep);
workflowService.close(task);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
// Task 2 and 4 are set up to open because they are concurrent and conditions
// were evaluated to true
Task nextTask = taskService.getById(20);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
// Task 3 has XPath which evaluates to false - it gets immediately closed
nextTask = taskService.getById(21);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to done!", TaskStatus.DONE,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to done!");
nextTask = taskService.getById(22);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
nextTask = taskService.getById(23);
- assertEquals("Task '" + nextTask.getTitle() + "' was set up to open!", TaskStatus.LOCKED,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was set up to open!");
ProcessTestUtils.removeTestProcess(task.getProcess().getId());
}
@@ -208,21 +193,18 @@ public void shouldCloseForInWorkProcessWithParallelTasks() throws Exception {
ProcessTestUtils.copyTestMetadataFile(task.getProcess().getId(), ProcessTestUtils.testFileChildProcessToKeep);
workflowService.close(task);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
// Task 3 has XPath which evaluates to false - it gets immediately closed
Task nextTask = taskService.getById(26);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to done!", TaskStatus.DONE,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to done!");
// Task 3 and 4 are concurrent - 3 got immediately finished, 4 is set to open
nextTask = taskService.getById(27);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
nextTask = taskService.getById(28);
- assertEquals("Task '" + nextTask.getTitle() + "' was set up to open!", TaskStatus.LOCKED,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was set up to open!");
ProcessTestUtils.removeTestProcess(task.getProcess().getId());
}
@@ -231,19 +213,16 @@ public void shouldCloseForInWorkProcessWithBlockingParallelTasks() throws Except
Task task = taskService.getById(30);
workflowService.close(task);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
Task nextTask = taskService.getById(31);
- assertEquals("Task '" + nextTask.getTitle() + "' is not in work!", TaskStatus.INWORK,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.INWORK, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' is not in work!");
nextTask = taskService.getById(32);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set to locked!", TaskStatus.LOCKED,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set to locked!");
nextTask = taskService.getById(33);
- assertEquals("Task '" + nextTask.getTitle() + "' was set up to open!", TaskStatus.LOCKED,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was set up to open!");
}
@Test
@@ -251,19 +230,16 @@ public void shouldCloseForInWorkProcessWithNonBlockingParallelTasks() throws Exc
Task task = taskService.getById(35);
workflowService.close(task);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
Task nextTask = taskService.getById(36);
- assertEquals("Task '" + nextTask.getTitle() + "' is not in work!", TaskStatus.INWORK,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.INWORK, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' is not in work!");
nextTask = taskService.getById(37);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
nextTask = taskService.getById(38);
- assertEquals("Task '" + nextTask.getTitle() + "' was set up to open!", TaskStatus.LOCKED,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was set up to open!");
}
@Test
@@ -271,40 +247,35 @@ public void shouldCloseForAlmostFinishedProcessWithParallelTasks() throws Except
Task task = taskService.getById(42);
workflowService.close(task);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
Task nextTask = taskService.getById(43);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
}
//TODO: find out why it doesn't work in github ci
- @Ignore("Doesn't work on gitHub ci")
+ @Disabled("Doesn't work on gitHub ci")
@Test
public void shouldCloseAndAssignNextForProcessWithParallelTasks() throws Exception {
Task task = taskService.getById(44);
workflowService.close(task);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
// Task 2 and 4 are set up to open because they are concurrent and conditions
// were evaluated to true
Task nextTask = taskService.getById(45);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
// Task 3 has XPath which evaluates to false - it gets immediately closed
nextTask = taskService.getById(46);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to done!", TaskStatus.DONE,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to done!");
nextTask = taskService.getById(47);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
nextTask = taskService.getById(48);
- assertEquals("Task '" + nextTask.getTitle() + "' was set up to open!", TaskStatus.LOCKED,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was set up to open!");
fileService.createDirectory(URI.create("9"), "images");
@@ -314,8 +285,7 @@ public void shouldCloseAndAssignNextForProcessWithParallelTasks() throws Excepti
// Task 4 should be kept open
Task nextConcurrentTask = taskService.getById(47);
- assertEquals("Task '" + nextConcurrentTask.getTitle() + "' was not kept to open!", TaskStatus.OPEN,
- nextConcurrentTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextConcurrentTask.getProcessingStatus(), "Task '" + nextConcurrentTask.getTitle() + "' was not kept to open!");
}
@Test
@@ -327,26 +297,22 @@ public void shouldCloseForProcessWithScriptParallelTasks() throws Exception {
Task task = taskService.getById(54);
workflowService.close(task);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
// Task 2 and 4 are set up to open because they are concurrent and conditions
// were evaluated to true
Task nextTask = taskService.getById(55);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
// Task 3 has Script which evaluates to false - it gets immediately closed
nextTask = taskService.getById(56);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to done!", TaskStatus.DONE,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to done!");
nextTask = taskService.getById(57);
- assertEquals("Task '" + nextTask.getTitle() + "' was not set up to open!", TaskStatus.OPEN,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was not set up to open!");
nextTask = taskService.getById(58);
- assertEquals("Task '" + nextTask.getTitle() + "' was set up to open!", TaskStatus.LOCKED,
- nextTask.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, nextTask.getProcessingStatus(), "Task '" + nextTask.getTitle() + "' was set up to open!");
}
@Test
@@ -376,18 +342,12 @@ public void shouldCloseForProcessWithSkippedTask() throws DataException, DAOExce
workflowService.close(taskToClose);
- assertEquals("Task '" + taskToClose.getTitle() + "' was not closed!", TaskStatus.DONE,
- taskToClose.getProcessingStatus());
- assertEquals("Task '" + skippedTask.getTitle() + "' was not skipped!", TaskStatus.DONE,
- skippedTask.getProcessingStatus());
- assertEquals("Task '" + secondSkippedTask.getTitle() + "' was not skipped!", TaskStatus.DONE,
- secondSkippedTask.getProcessingStatus());
- assertEquals("Task '" + taskToOpen.getTitle() + "' was not opened!", TaskStatus.OPEN,
- taskToOpen.getProcessingStatus());
- assertEquals("Task '" + secondTaskToOpen.getTitle() + "' was not opened!", TaskStatus.OPEN,
- secondTaskToOpen.getProcessingStatus());
- assertEquals("Task '" + thirdTaskToSkip.getTitle() + "' was not skipped!", TaskStatus.DONE,
- thirdTaskToSkip.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, taskToClose.getProcessingStatus(), "Task '" + taskToClose.getTitle() + "' was not closed!");
+ assertEquals(TaskStatus.DONE, skippedTask.getProcessingStatus(), "Task '" + skippedTask.getTitle() + "' was not skipped!");
+ assertEquals(TaskStatus.DONE, secondSkippedTask.getProcessingStatus(), "Task '" + secondSkippedTask.getTitle() + "' was not skipped!");
+ assertEquals(TaskStatus.OPEN, taskToOpen.getProcessingStatus(), "Task '" + taskToOpen.getTitle() + "' was not opened!");
+ assertEquals(TaskStatus.OPEN, secondTaskToOpen.getProcessingStatus(), "Task '" + secondTaskToOpen.getTitle() + "' was not opened!");
+ assertEquals(TaskStatus.DONE, thirdTaskToSkip.getProcessingStatus(), "Task '" + thirdTaskToSkip.getTitle() + "' was not skipped!");
process.getTasks().clear();
ProcessTestUtils.removeTestProcess(processId);
@@ -412,7 +372,7 @@ public void shouldAssignTaskToUser() throws Exception {
Task task = taskService.getById(6);
workflowService.assignTaskToUser(task);
- assertEquals("Incorrect user was assigned to the task!", Integer.valueOf(1), task.getProcessingUser().getId());
+ assertEquals(Integer.valueOf(1), task.getProcessingUser().getId(), "Incorrect user was assigned to the task!");
fileService.delete(URI.create("1/images"));
fileService.delete(URI.create("1"));
@@ -423,9 +383,8 @@ public void shouldUnassignTaskFromUser() throws Exception {
Task task = taskService.getById(6);
workflowService.unassignTaskFromUser(task);
- assertNull("User was not unassigned from the task!", task.getProcessingUser());
- assertEquals("Task was not set up to open after unassing of the user!", TaskStatus.OPEN,
- task.getProcessingStatus());
+ assertNull(task.getProcessingUser(), "User was not unassigned from the task!");
+ assertEquals(TaskStatus.OPEN, task.getProcessingStatus(), "Task was not set up to open after unassing of the user!");
}
@Test
@@ -447,19 +406,14 @@ public void shouldReportProblem() throws Exception {
workflowService.reportProblem(problem, TaskEditType.MANUAL_SINGLE);
- assertEquals(
- "Report of problem was incorrect - task '" + correctionTask.getTitle() + "' is not set up to open!",
- TaskStatus.OPEN, correctionTask.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, correctionTask.getProcessingStatus(), "Report of problem was incorrect - task '" + correctionTask.getTitle() + "' is not set up to open!");
- assertTrue(
- "Report of problem was incorrect - task '" + correctionTask.getTitle() + "' is not a correction task!",
- correctionTask.isCorrection());
+ assertTrue(correctionTask.isCorrection(), "Report of problem was incorrect - task '" + correctionTask.getTitle() + "' is not a correction task!");
Process process = currentTask.getProcess();
for (Task task : process.getTasks()) {
if (correctionTask.getOrdering() < task.getOrdering() && task.getOrdering() < currentTask.getOrdering()) {
- assertEquals("Report of problem was incorrect - tasks between were not set up to locked!",
- TaskStatus.LOCKED, task.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, task.getProcessingStatus(), "Report of problem was incorrect - tasks between were not set up to locked!");
}
}
}
@@ -488,17 +442,16 @@ public void shouldSolveProblem() throws Exception {
for (Task task : process.getTasks()) {
if (correctionComment.getCorrectionTask().getOrdering() < task.getOrdering()
&& task.getOrdering() < correctionComment.getCurrentTask().getOrdering()) {
- assertEquals("Solving reported problem was unsuccessful - tasks between '"
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Solving reported problem was unsuccessful - tasks between '"
+ correctionTask.getTitle() + "' and '" + currentTask.getTitle()
- + "' were not set to processing status DONE!", TaskStatus.DONE,
- task.getProcessingStatus());
+ + "' were not set to processing status DONE!");
}
}
- assertEquals("Solving reported problem was unsuccessful - correction task '" + correctionTask.getTitle()
- + "' was not set to processing status DONE!", TaskStatus.DONE, correctionComment.getCorrectionTask().getProcessingStatus());
+ assertEquals(TaskStatus.DONE, correctionComment.getCorrectionTask().getProcessingStatus(), "Solving reported problem was unsuccessful - correction task '" + correctionTask.getTitle()
+ + "' was not set to processing status DONE!");
- assertEquals("Solving reported problem was unsuccessful - current task '" + currentTask.getTitle()
- + "' was not set to processing status 'OPEN'!", TaskStatus.OPEN, correctionComment.getCurrentTask().getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, correctionComment.getCurrentTask().getProcessingStatus(), "Solving reported problem was unsuccessful - current task '" + currentTask.getTitle()
+ + "' was not set to processing status 'OPEN'!");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/production/version/KitodoVersionTest.java b/Kitodo/src/test/java/org/kitodo/production/version/KitodoVersionTest.java
index 080c5b61ee1..dde8224f736 100644
--- a/Kitodo/src/test/java/org/kitodo/production/version/KitodoVersionTest.java
+++ b/Kitodo/src/test/java/org/kitodo/production/version/KitodoVersionTest.java
@@ -11,20 +11,21 @@
package org.kitodo.production.version;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.jar.Manifest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class KitodoVersionTest {
private static final String VERSION = "1.2.3";
private static final String BUILD_DATE = "17-Februrary-2011";
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void shouldThrowExceptionIfKitodoSectionIsMissingInManifest() {
- KitodoVersion.setupFromManifest(new Manifest());
+ assertThrows(IllegalArgumentException.class, () -> KitodoVersion.setupFromManifest(new Manifest()));
}
@Test
@@ -32,8 +33,7 @@ public void attributeVersionShouldBeEqualToImplementationVersion() {
Manifest manifest = createManifestWithValues();
KitodoVersion.setupFromManifest(manifest);
- assertEquals("Version attribute should be equal to Implementation-Version as specified in the given Manifest.",
- VERSION, KitodoVersion.getVersion());
+ assertEquals(VERSION, KitodoVersion.getVersion(), "Version attribute should be equal to Implementation-Version as specified in the given Manifest.");
}
@Test
@@ -41,9 +41,7 @@ public void attributeBuildVersionShouldBeEqualToImplementationVersion() {
Manifest manifest = createManifestWithValues();
KitodoVersion.setupFromManifest(manifest);
- assertEquals(
- "BuildVersion attribute should be equal to Implementation-Version as specified in the given Manifest.",
- VERSION, KitodoVersion.getBuildVersion());
+ assertEquals(VERSION, KitodoVersion.getBuildVersion(), "BuildVersion attribute should be equal to Implementation-Version as specified in the given Manifest.");
}
@Test
@@ -51,9 +49,7 @@ public void attributeBuildDateShouldBeEqualToImplementationBuildDate() {
Manifest manifest = createManifestWithValues();
KitodoVersion.setupFromManifest(manifest);
- assertEquals(
- "BuildDate attribute should be equal to Implementation-Build-Date as specified in the given Manifest.",
- BUILD_DATE, KitodoVersion.getBuildDate());
+ assertEquals(BUILD_DATE, KitodoVersion.getBuildDate(), "BuildDate attribute should be equal to Implementation-Build-Date as specified in the given Manifest.");
}
private Manifest createManifestWithValues() {
diff --git a/Kitodo/src/test/java/org/kitodo/production/workflow/model/ConverterIT.java b/Kitodo/src/test/java/org/kitodo/production/workflow/model/ConverterIT.java
index c483abc2c93..d5a60561eab 100644
--- a/Kitodo/src/test/java/org/kitodo/production/workflow/model/ConverterIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/workflow/model/ConverterIT.java
@@ -1,18 +1,28 @@
+/*
+ * (c) Kitodo. Key to digital objects e. V.
+ *
+ * This file is part of the Kitodo project.
+ *
+ * It is licensed under GNU General Public License version 3 or later.
+ *
+ * For the full copyright and license information, please read the
+ * GPL3-License.txt file that was distributed with this source code.
+ */
+
package org.kitodo.production.workflow.model;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.data.database.beans.Task;
import org.kitodo.data.database.beans.Template;
@@ -21,16 +31,13 @@
public class ConverterIT {
- @Rule
- public final ExpectedException exception = ExpectedException.none();
-
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
MockDatabase.startNode();
MockDatabase.insertRolesFull();
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
MockDatabase.stopNode();
MockDatabase.cleanDatabase();
@@ -41,13 +48,12 @@ public void shouldValidateConditionalWorkflowTaskList() throws Exception {
Converter converter = new Converter("gateway-test1");
List tasks = converter.validateWorkflowTaskList();
- assertEquals("Process definition - workflow was read incorrectly!", 5, tasks.size());
+ assertEquals(5, tasks.size(), "Process definition - workflow was read incorrectly!");
tasks.sort(Comparator.comparingInt(Task::getOrdering).thenComparing(Task::getWorkflowId));
assertCorrectTask(tasks.get(0), "Task1", 1);
- assertFalse("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(0).isLast());
+ assertFalse(tasks.get(0).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
assertCorrectTask(tasks.get(1), "ScriptTask", 2, "/mets:mets/mets:metsHdr");
@@ -56,8 +62,7 @@ public void shouldValidateConditionalWorkflowTaskList() throws Exception {
assertCorrectTask(tasks.get(3), "Task4", 2, "/mets:mets/mets:dmdSec/mets:mdWrap/mets:xmlData/kitodo:kitodo");
assertCorrectTask(tasks.get(4), "Task5", 3);
- assertTrue("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(4).isLast());
+ assertTrue(tasks.get(4).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
}
@Test
@@ -66,18 +71,16 @@ public void shouldConvertConditionalWorkflowToTemplate() throws Exception {
Template template = new Template();
converter.convertWorkflowToTemplate(template);
- assertEquals("Process definition - workflow was read incorrectly!", 5, template.getTasks().size());
+ assertEquals(5, template.getTasks().size(), "Process definition - workflow was read incorrectly!");
List tasks = template.getTasks();
tasks.sort(Comparator.comparingInt(Task::getOrdering).thenComparing(Task::getWorkflowId));
assertCorrectTask(tasks.get(0), "Task1", 1);
- assertFalse("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(0).isLast());
+ assertFalse(tasks.get(0).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
assertCorrectTask(tasks.get(0), "Task1", 1);
- assertFalse("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(0).isLast());
+ assertFalse(tasks.get(0).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
assertCorrectTask(tasks.get(1), "ScriptTask", 2, "/mets:mets/mets:metsHdr");
@@ -86,8 +89,7 @@ public void shouldConvertConditionalWorkflowToTemplate() throws Exception {
assertCorrectTask(tasks.get(3), "Task4", 2, "/mets:mets/mets:dmdSec/mets:mdWrap/mets:xmlData/kitodo:kitodo");
assertCorrectTask(tasks.get(4), "Task5", 3);
- assertTrue("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(4).isLast());
+ assertTrue(tasks.get(4).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
}
@Test
@@ -95,10 +97,8 @@ public void shouldNotConvertConditionalWorkflowToTemplate() throws Exception {
Converter converter = new Converter("gateway-test2");
Template template = new Template();
- exception.expect(WorkflowException.class);
- exception.expectMessage(Helper.getTranslation("workflowExceptionParallelBranch",
- "Task9"));
- converter.convertWorkflowToTemplate(template);
+ Exception exception = assertThrows(WorkflowException.class, () -> converter.convertWorkflowToTemplate(template));
+ assertEquals(Helper.getTranslation("workflowExceptionParallelBranch", "Task9"), exception.getMessage());
}
@Test
@@ -106,10 +106,8 @@ public void shouldNotConvertWorkflowWithoutRoleToTemplate() throws Exception {
Converter converter = new Converter("gateway-test4");
Template template = new Template();
- exception.expect(WorkflowException.class);
- exception.expectMessage(Helper.getTranslation("workflowExceptionMissingRoleAssignment",
- "Task1"));
- converter.convertWorkflowToTemplate(template);
+ Exception exception = assertThrows(WorkflowException.class, () -> converter.convertWorkflowToTemplate(template));
+ assertEquals(Helper.getTranslation("workflowExceptionMissingRoleAssignment", "Task1"), exception.getMessage());
}
@Test
@@ -118,32 +116,28 @@ public void shouldConvertConditionalWorkflowWithTwoEndsToTemplate() throws Excep
Template template = new Template();
converter.convertWorkflowToTemplate(template);
- assertEquals("Process definition - workflow was read incorrectly!", 7, template.getTasks().size());
+ assertEquals(7, template.getTasks().size(), "Process definition - workflow was read incorrectly!");
List tasks = template.getTasks();
tasks.sort(Comparator.comparingInt(Task::getOrdering).thenComparing(Task::getWorkflowId));
assertCorrectTask(tasks.get(0), "Task1", 1);
- assertFalse("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(0).isLast());
+ assertFalse(tasks.get(0).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
assertCorrectTask(tasks.get(1), "Task2", 2);
assertCorrectTask(tasks.get(2), "Task3", 3, "type=2");
- assertFalse("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(2).isLast());
+ assertFalse(tasks.get(2).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
assertCorrectTask(tasks.get(3), "Task7", 3, "type=1");
- assertTrue("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(3).isLast());
+ assertTrue(tasks.get(3).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
assertCorrectTask(tasks.get(4), "Task4", 4, "type=2");
assertCorrectTask(tasks.get(5), "Task5", 4, "type=2");
assertCorrectTask(tasks.get(6), "Task6", 5, "type=2");
- assertTrue("Process definition - workflow's task last property were determined incorrectly!",
- tasks.get(6).isLast());
+ assertTrue(tasks.get(6).isLast(), "Process definition - workflow's task last property were determined incorrectly!");
}
private void assertCorrectTask(Task task, String title, int ordering) {
@@ -151,12 +145,10 @@ private void assertCorrectTask(Task task, String title, int ordering) {
}
private void assertCorrectTask(Task task, String title, int ordering, String workflowCondition) {
- assertEquals("Process definition - workflow's task title was read incorrectly!", title, task.getTitle());
- assertEquals("Process definition - workflow's task ordering was determined incorrectly!", ordering,
- task.getOrdering().intValue());
+ assertEquals(title, task.getTitle(), "Process definition - workflow's task title was read incorrectly!");
+ assertEquals(ordering, task.getOrdering().intValue(), "Process definition - workflow's task ordering was determined incorrectly!");
if (Objects.nonNull(workflowCondition)) {
- assertEquals("Process definition - workflow's task conditions were determined incorrectly!", workflowCondition,
- task.getWorkflowCondition().getValue());
+ assertEquals(workflowCondition, task.getWorkflowCondition().getValue(), "Process definition - workflow's task conditions were determined incorrectly!");
}
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/production/workflow/model/ReaderIT.java b/Kitodo/src/test/java/org/kitodo/production/workflow/model/ReaderIT.java
index 81b026bcfa9..454943326c5 100644
--- a/Kitodo/src/test/java/org/kitodo/production/workflow/model/ReaderIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/workflow/model/ReaderIT.java
@@ -11,21 +11,20 @@
package org.kitodo.production.workflow.model;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.camunda.bpm.model.bpmn.instance.Task;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.kitodo.FileLoader;
import org.kitodo.MockDatabase;
import org.kitodo.exceptions.WorkflowException;
@@ -34,10 +33,7 @@
public class ReaderIT {
- @Rule
- public final ExpectedException exception = ExpectedException.none();
-
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
MockDatabase.startNode();
MockDatabase.insertRolesFull();
@@ -45,7 +41,7 @@ public static void setUp() throws Exception {
FileLoader.createExtendedDiagramTestFile();
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
FileLoader.deleteExtendedDiagramTestFile();
@@ -58,7 +54,7 @@ public void shouldLoadProcess() throws Exception {
Reader reader = new Reader("extended-test");
boolean result = Objects.nonNull(reader.getModelInstance());
- assertTrue("Process definition was not loaded!", result);
+ assertTrue(result, "Process definition was not loaded!");
}
@Test
@@ -67,7 +63,7 @@ public void shouldReadWorkflow() throws Exception {
reader.readWorkflowTasks();
Map tasks = reader.getTasks();
- assertEquals("Process definition - workflow was read incorrectly!", 2, tasks.size());
+ assertEquals(2, tasks.size(), "Process definition - workflow was read incorrectly!");
Set> taskEntries = tasks.entrySet();
Map.Entry[] entry = new Map.Entry[2];
@@ -88,7 +84,7 @@ public void shouldReadConditionalWorkflow() throws Exception {
reader.readWorkflowTasks();
Map tasks = reader.getTasks();
- assertEquals("Process definition - workflow was read incorrectly!", 5, tasks.size());
+ assertEquals(5, tasks.size(), "Process definition - workflow was read incorrectly!");
for (Map.Entry entry : tasks.entrySet()) {
Task task = entry.getKey();
@@ -97,8 +93,7 @@ public void shouldReadConditionalWorkflow() throws Exception {
switch (title) {
case "Task1":
assertCorrectTask(task, taskInfo, "Task1", 1, "");
- assertFalse("Process definition - workflow's task last property were determined incorrectly!",
- taskInfo.isLast());
+ assertFalse(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!");
break;
case "ScriptTask":
assertCorrectTask(task, taskInfo, "ScriptTask", 2, "${type==1}");
@@ -111,8 +106,7 @@ public void shouldReadConditionalWorkflow() throws Exception {
break;
case "Task5":
assertCorrectTask(task, taskInfo, "Task5", 3, "");
- assertTrue("Process definition - workflow's task last property were determined incorrectly!",
- taskInfo.isLast());
+ assertTrue(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!");
break;
default:
fail("Task should have one of the above titles!");
@@ -125,10 +119,8 @@ public void shouldReadConditionalWorkflow() throws Exception {
public void shouldNotReadConditionalWorkflow() throws Exception {
Reader reader = new Reader("gateway-test2");
- exception.expect(WorkflowException.class);
- exception.expectMessage(Helper.getTranslation("workflowExceptionParallelBranch",
- "Task9"));
- reader.readWorkflowTasks();
+ Exception exception = assertThrows(WorkflowException.class, () -> reader.readWorkflowTasks());
+ assertEquals(Helper.getTranslation("workflowExceptionParallelBranch", "Task9"), exception.getMessage());
}
@Test
@@ -137,7 +129,7 @@ public void shouldReadConditionalWorkflowWithTwoEnds() throws Exception {
reader.readWorkflowTasks();
Map tasks = reader.getTasks();
- assertEquals("Process definition - workflow was read incorrectly!", 7, tasks.size());
+ assertEquals(7, tasks.size(), "Process definition - workflow was read incorrectly!");
for (Map.Entry entry : tasks.entrySet()) {
Task task = entry.getKey();
@@ -146,16 +138,14 @@ public void shouldReadConditionalWorkflowWithTwoEnds() throws Exception {
switch (title) {
case "Task1":
assertCorrectTask(task, taskInfo, "Task1", 1, "");
- assertFalse("Process definition - workflow's task last property were determined incorrectly!",
- taskInfo.isLast());
+ assertFalse(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!");
break;
case "Task2":
assertCorrectTask(task, taskInfo, "Task2", 2, "");
break;
case "Task3":
assertCorrectTask(task, taskInfo, "Task3", 3, "type=2");
- assertFalse("Process definition - workflow's task last property were determined incorrectly!",
- taskInfo.isLast());
+ assertFalse(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!");
break;
case "Task4":
assertCorrectTask(task, taskInfo, "Task4", 4, "type=2");
@@ -165,13 +155,11 @@ public void shouldReadConditionalWorkflowWithTwoEnds() throws Exception {
break;
case "Task6":
assertCorrectTask(task, taskInfo, "Task6", 5, "type=2");
- assertTrue("Process definition - workflow's task last property were determined incorrectly!",
- taskInfo.isLast());
+ assertTrue(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!");
break;
case "Task7":
assertCorrectTask(task, taskInfo, "Task7", 3, "type=1");
- assertTrue("Process definition - workflow's task last property were determined incorrectly!",
- taskInfo.isLast());
+ assertTrue(taskInfo.isLast(), "Process definition - workflow's task last property were determined incorrectly!");
break;
default:
fail("Task should have one of the above titles!");
@@ -184,14 +172,12 @@ public void shouldReadConditionalWorkflowWithTwoEnds() throws Exception {
public void shouldNotReadWorkflowWithLoop() throws Exception {
Reader reader = new Reader("gateway-test6");
- exception.expect(WorkflowException.class);
- exception.expectMessage(Helper.getTranslation("workflowExceptionLoop", "Task1"));
- reader.readWorkflowTasks();
+ Exception exception = assertThrows(WorkflowException.class, () -> reader.readWorkflowTasks());
+ assertEquals(Helper.getTranslation("workflowExceptionLoop", "Task1"), exception.getMessage());
}
private void assertCorrectTask(Task task, TaskInfo taskInfo, String title, int ordering, String condition) {
- assertEquals("Process definition - workflow's task title was read incorrectly!", title, task.getName());
- assertEquals("Process definition - workflow's task ordering was determined incorrectly!", ordering,
- taskInfo.getOrdering());
+ assertEquals(title, task.getName(), "Process definition - workflow's task title was read incorrectly!");
+ assertEquals(ordering, taskInfo.getOrdering(), "Process definition - workflow's task ordering was determined incorrectly!");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/production/workflow/model/UpdaterIT.java b/Kitodo/src/test/java/org/kitodo/production/workflow/model/UpdaterIT.java
index 6ff5f33542b..172c9701aaf 100644
--- a/Kitodo/src/test/java/org/kitodo/production/workflow/model/UpdaterIT.java
+++ b/Kitodo/src/test/java/org/kitodo/production/workflow/model/UpdaterIT.java
@@ -11,22 +11,24 @@
package org.kitodo.production.workflow.model;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.data.database.beans.Template;
import org.kitodo.production.services.ServiceManager;
public class UpdaterIT {
- @BeforeClass
+ @BeforeAll
public static void prepareDatabase() throws Exception {
MockDatabase.startNode();
MockDatabase.insertProcessesFull();
}
- @AfterClass
+ @AfterAll
public static void cleanDatabase() throws Exception {
MockDatabase.stopNode();
MockDatabase.cleanDatabase();
@@ -37,6 +39,6 @@ public void shouldUpdateProcessesAssignedToTemplate() throws Exception {
Template template = ServiceManager.getTemplateService().getById(1);
Updater updater = new Updater(template);
- updater.updateProcessesAssignedToTemplate();
+ assertDoesNotThrow(() -> updater.updateProcessesAssignedToTemplate());
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/AddingST.java b/Kitodo/src/test/java/org/kitodo/selenium/AddingST.java
index 1931c8b5f57..0d348225e1f 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/AddingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/AddingST.java
@@ -12,10 +12,12 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+import com.xebialabs.restito.server.StubServer;
import java.io.File;
import java.io.IOException;
@@ -23,14 +25,13 @@
import java.util.Optional;
import java.util.concurrent.TimeUnit;
-import com.xebialabs.restito.server.StubServer;
import org.apache.commons.lang3.SystemUtils;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.data.database.beans.Client;
import org.kitodo.data.database.beans.Docket;
@@ -76,7 +77,7 @@ public class AddingST extends BaseTestSelenium {
private static final String PICA_XML = "picaxml";
private static final String TEST_FILE_PATH = "src/test/resources/sruTestRecord.xml";
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
processesPage = Pages.getProcessesPage();
projectsPage = Pages.getProjectsPage();
@@ -93,7 +94,7 @@ public static void setup() throws Exception {
break;
}
}
- assertTrue("Should find exactly one second process!", secondProcessId > 0);
+ assertTrue(secondProcessId > 0, "Should find exactly one second process!");
ProcessTestUtils.copyTestMetadataFile(secondProcessId, TEST_METADATA_FILE);
server = new StubServer(MockDatabase.PORT).run();
setupServer();
@@ -108,18 +109,18 @@ private static void setupServer() throws IOException {
* Remove unsuitable parent test process.
* @throws DAOException when test process cannot be removed
*/
- @AfterClass
+ @AfterAll
public static void removeUnsuitableParentTestProcess() throws DAOException {
ProcessTestUtils.removeTestProcess(secondProcessId);
server.stop();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
if (Browser.isAlertPresent()) {
@@ -130,22 +131,20 @@ public void logout() throws Exception {
@Test
public void addBatchTest() throws Exception {
processesPage.createNewBatch();
- await().untilAsserted(() -> assertEquals("Batch was inserted!", 1,
- ServiceManager.getBatchService().getByQuery("FROM Batch WHERE title = 'SeleniumBatch'").size()));
+ await().untilAsserted(() -> assertEquals(1, ServiceManager.getBatchService().getByQuery("FROM Batch WHERE title = 'SeleniumBatch'").size(), "Batch was inserted!"));
}
@Test
public void addProjectTest() throws Exception {
Project project = ProjectGenerator.generateProject();
projectsPage.createNewProject();
- assertEquals("Header for create new project is incorrect", "Neues Projekt",
- Pages.getProjectEditPage().getHeaderText());
+ assertEquals("Neues Projekt", Pages.getProjectEditPage().getHeaderText(), "Header for create new project is incorrect");
Pages.getProjectEditPage().insertProjectData(project).save();
- assertTrue("Redirection after save was not successful", projectsPage.isAt());
+ assertTrue(projectsPage.isAt(), "Redirection after save was not successful");
boolean projectAvailable = Pages.getProjectsPage().getProjectsTitles().contains(project.getTitle());
- assertTrue("Created Project was not listed at projects table!", projectAvailable);
+ assertTrue(projectAvailable, "Created Project was not listed at projects table!");
}
@Test
@@ -153,44 +152,42 @@ public void addTemplateTest() throws Exception {
Template template = new Template();
template.setTitle("MockTemplate");
projectsPage.createNewTemplate();
- assertEquals("Header for create new template is incorrect", "Neue Produktionsvorlage",
- Pages.getTemplateEditPage().getHeaderText());
+ assertEquals("Neue Produktionsvorlage", Pages.getTemplateEditPage().getHeaderText(), "Header for create new template is incorrect");
Pages.getTemplateEditPage().insertTemplateData(template).save();
await().until(() -> projectsPage.countListedTemplates() == 3);
boolean templateAvailable = projectsPage.getTemplateTitles().contains(template.getTitle());
- assertTrue("Created Template was not listed at templates table!", templateAvailable);
+ assertTrue(templateAvailable, "Created Template was not listed at templates table!");
}
@Test
public void addProcessesTest() throws Exception {
projectsPage.createNewProcess();
- assertEquals("Header for create new process is incorrect", "Einen neuen Vorgang anlegen (Produktionsvorlage: 'First template')",
- Pages.getProcessFromTemplatePage().getHeaderText());
+ assertEquals("Einen neuen Vorgang anlegen (Produktionsvorlage: 'First template')", Pages.getProcessFromTemplatePage().getHeaderText(), "Header for create new process is incorrect");
String generatedTitle = Pages.getProcessFromTemplatePage().createProcess();
boolean processAvailable = processesPage.getProcessTitles().contains(generatedTitle);
- assertTrue("Created Process was not listed at processes table!", processAvailable);
+ assertTrue(processAvailable, "Created Process was not listed at processes table!");
ProcessService processService = ServiceManager.getProcessService();
Optional optionalProcess = processService.getAll().stream().filter(process -> generatedTitle
.equals(process.getTitle())).findAny();
- assertTrue("Generated process not found in database", optionalProcess.isPresent());
+ assertTrue(optionalProcess.isPresent(), "Generated process not found in database");
Process generatedProcess = optionalProcess.get();
- assertNull("Created Process unexpectedly got a parent!", generatedProcess.getParent());
+ assertNull(generatedProcess.getParent(), "Created Process unexpectedly got a parent!");
projectsPage.createNewProcess();
String generatedChildTitle = Pages.getProcessFromTemplatePage()
.createProcessAsChild(generatedProcess.getTitle());
boolean childProcessAvailable = processesPage.getProcessTitles().contains(generatedChildTitle);
- assertTrue("Created Process was not listed at processes table!", childProcessAvailable);
+ assertTrue(childProcessAvailable, "Created Process was not listed at processes table!");
Optional optionalChildProcess = processService.getAll().stream().filter(process -> generatedChildTitle
.equals(process.getTitle())).findAny();
- assertTrue("Generated child process not found in database", optionalChildProcess.isPresent());
+ assertTrue(optionalChildProcess.isPresent(), "Generated child process not found in database");
Process generatedChildProcess = optionalChildProcess.get();
- assertEquals("Created Process has a wrong parent!", generatedProcess, generatedChildProcess.getParent());
+ assertEquals(generatedProcess, generatedChildProcess.getParent(), "Created Process has a wrong parent!");
ProcessTestUtils.removeTestProcess(generatedProcess.getId());
}
@@ -198,7 +195,7 @@ public void addProcessesTest() throws Exception {
public void addProcessAsChildNotPossible() throws Exception {
projectsPage.createNewProcess();
boolean errorMessageShowing = Pages.getProcessFromTemplatePage().createProcessAsChildNotPossible();
- assertTrue("There was no error!", errorMessageShowing);
+ assertTrue(errorMessageShowing, "There was no error!");
Pages.getProcessFromTemplatePage().cancel();
}
@@ -207,14 +204,13 @@ public void addProcessFromCatalogTest() throws Exception {
assumeTrue(!SystemUtils.IS_OS_WINDOWS);
projectsPage.createNewProcess();
- assertEquals("Header for create new process is incorrect", "Einen neuen Vorgang anlegen (Produktionsvorlage: 'First template')",
- Pages.getProcessFromTemplatePage().getHeaderText());
+ assertEquals("Einen neuen Vorgang anlegen (Produktionsvorlage: 'First template')", Pages.getProcessFromTemplatePage().getHeaderText(), "Header for create new process is incorrect");
String generatedTitle = Pages.getProcessFromTemplatePage().createProcessFromCatalog();
boolean processAvailable = processesPage.getProcessTitles().contains(generatedTitle);
- assertTrue("Created Process was not listed at processes table!", processAvailable);
+ assertTrue(processAvailable, "Created Process was not listed at processes table!");
int index = processesPage.getProcessTitles().indexOf(generatedTitle);
- assertTrue("Process table does not contain ID or new process", index >= 0);
+ assertTrue(index >= 0, "Process table does not contain ID or new process");
int processId = Integer.parseInt(processesPage.getProcessIds().get(index));
ProcessTestUtils.removeTestProcess(processId);
}
@@ -224,18 +220,16 @@ public void addWorkflowTest() throws Exception {
Workflow workflow = new Workflow();
workflow.setTitle("testWorkflow");
projectsPage.createNewWorkflow();
- assertEquals("Header for create new workflow is incorrect", "Neuen Workflow anlegen",
- Pages.getWorkflowEditPage().getHeaderText());
+ assertEquals("Neuen Workflow anlegen", Pages.getWorkflowEditPage().getHeaderText(), "Header for create new workflow is incorrect");
Pages.getWorkflowEditPage().insertWorkflowData(workflow).save();
- assertTrue("Redirection after save was not successful", AddingST.projectsPage.isAt());
+ assertTrue(AddingST.projectsPage.isAt(), "Redirection after save was not successful");
await("Wait for visible search results").atMost(20, TimeUnit.SECONDS).ignoreExceptions()
- .untilAsserted(() -> assertEquals("There should be no processes found", 3,
- AddingST.projectsPage.getWorkflowTitles().size()));
+ .untilAsserted(() -> assertEquals(3, AddingST.projectsPage.getWorkflowTitles().size(), "There should be no processes found"));
List workflowTitles = AddingST.projectsPage.getWorkflowTitles();
boolean workflowAvailable = workflowTitles.contains("testWorkflow");
- assertTrue("Created Workflow was not listed at workflows table!", workflowAvailable);
+ assertTrue(workflowAvailable, "Created Workflow was not listed at workflows table!");
new File("src/test/resources/diagrams/testWorkflow.bpmn20.xml").delete();
new File("src/test/resources/diagrams/testWorkflow.svg").delete();
@@ -246,15 +240,14 @@ public void addDocketTest() throws Exception {
Docket docket = new Docket();
docket.setTitle("MockDocket");
projectsPage.createNewDocket();
- assertEquals("Header for create new docket is incorrect", "Neuen Laufzettel anlegen",
- Pages.getDocketEditPage().getHeaderText());
+ assertEquals("Neuen Laufzettel anlegen", Pages.getDocketEditPage().getHeaderText(), "Header for create new docket is incorrect");
Pages.getDocketEditPage().insertDocketData(docket).save();
- assertTrue("Redirection after save was not successful", projectsPage.isAt());
+ assertTrue(projectsPage.isAt(), "Redirection after save was not successful");
List docketTitles = projectsPage.getDocketTitles();
boolean docketAvailable = docketTitles.contains(docket.getTitle());
- assertTrue("Created Docket was not listed at dockets table!", docketAvailable);
+ assertTrue(docketAvailable, "Created Docket was not listed at dockets table!");
}
@Test
@@ -262,55 +255,51 @@ public void addRulesetTest() throws Exception {
Ruleset ruleset = new Ruleset();
ruleset.setTitle("MockRuleset");
projectsPage.createNewRuleset();
- assertEquals("Header for create new ruleset is incorrect", "Neuen Regelsatz anlegen",
- Pages.getRulesetEditPage().getHeaderText());
+ assertEquals("Neuen Regelsatz anlegen", Pages.getRulesetEditPage().getHeaderText(), "Header for create new ruleset is incorrect");
Pages.getRulesetEditPage().insertRulesetData(ruleset).save();
- assertTrue("Redirection after save was not successful", projectsPage.isAt());
+ assertTrue(projectsPage.isAt(), "Redirection after save was not successful");
List rulesetTitles = projectsPage.getRulesetTitles();
boolean rulesetAvailable = rulesetTitles.contains(ruleset.getTitle());
- assertTrue("Created Ruleset was not listed at rulesets table!", rulesetAvailable);
+ assertTrue(rulesetAvailable, "Created Ruleset was not listed at rulesets table!");
}
- @Ignore("broken: this test often causes unintentional javascript warning popups when adding roles to the user")
+ @Disabled("broken: this test often causes unintentional javascript warning popups when adding roles to the user")
@Test
public void addUserTest() throws Exception {
User user = UserGenerator.generateUser();
usersPage.createNewUser();
- assertEquals("Header for create new user is incorrect", "Neuen Benutzer anlegen",
- userEditPage.getHeaderText());
+ assertEquals("Neuen Benutzer anlegen", userEditPage.getHeaderText(), "Header for create new user is incorrect");
userEditPage.insertUserData(user);
userEditPage.addUserToRole(ServiceManager.getRoleService().getById(2).getTitle());
userEditPage.addUserToClient(ServiceManager.getClientService().getById(2).getName());
userEditPage.save();
- assertTrue("Redirection after save was not successful", usersPage.isAt());
+ assertTrue(usersPage.isAt(), "Redirection after save was not successful");
User insertedUser = ServiceManager.getUserService().getByLogin(user.getLogin());
Pages.getTopNavigation().logout();
Pages.getLoginPage().performLogin(insertedUser);
Pages.getTopNavigation().selectSessionClient(1);
- assertEquals(ServiceManager.getClientService().getById(2).getName(),
- Pages.getTopNavigation().getSessionClient());
+ assertEquals(ServiceManager.getClientService().getById(2).getName(), Pages.getTopNavigation().getSessionClient());
}
@Test
public void addLdapGroupTest() throws Exception {
LdapGroup ldapGroup = LdapGroupGenerator.generateLdapGroup();
usersPage.createNewLdapGroup();
- assertEquals("Header for create new LDAP group is incorrect", "Neue LDAP-Gruppe anlegen",
- Pages.getLdapGroupEditPage().getHeaderText());
+ assertEquals("Neue LDAP-Gruppe anlegen", Pages.getLdapGroupEditPage().getHeaderText(), "Header for create new LDAP group is incorrect");
Pages.getLdapGroupEditPage().insertLdapGroupData(ldapGroup).save();
- assertTrue("Redirection after save was not successful", usersPage.isAt());
+ assertTrue(usersPage.isAt(), "Redirection after save was not successful");
boolean ldapGroupAvailable = usersPage.getLdapGroupNames().contains(ldapGroup.getTitle());
- assertTrue("Created ldap group was not listed at ldap group table!", ldapGroupAvailable);
+ assertTrue(ldapGroupAvailable, "Created ldap group was not listed at ldap group table!");
LdapGroup actualLdapGroup = usersPage.editLdapGroup(ldapGroup.getTitle()).readLdapGroup();
- assertEquals("Saved ldap group is giving wrong data at edit page!", ldapGroup, actualLdapGroup);
+ assertEquals(ldapGroup, actualLdapGroup, "Saved ldap group is giving wrong data at edit page!");
}
@Test
@@ -318,14 +307,13 @@ public void addClientTest() throws Exception {
Client client = new Client();
client.setName("MockClient");
usersPage.createNewClient();
- assertEquals("Header for create new client is incorrect", "Neuen Mandanten anlegen",
- Pages.getClientEditPage().getHeaderText());
+ assertEquals("Neuen Mandanten anlegen", Pages.getClientEditPage().getHeaderText(), "Header for create new client is incorrect");
Pages.getClientEditPage().insertClientData(client).save();
- assertTrue("Redirection after save was not successful", usersPage.isAt());
+ assertTrue(usersPage.isAt(), "Redirection after save was not successful");
boolean clientAvailable = usersPage.getClientNames().contains(client.getName());
- assertTrue("Created Client was not listed at clients table!", clientAvailable);
+ assertTrue(clientAvailable, "Created Client was not listed at clients table!");
}
@Test
@@ -334,29 +322,26 @@ public void addRoleTest() throws Exception {
role.setTitle("MockRole");
usersPage.createNewRole();
- assertEquals("Header for create new role is incorrect", "Neue Rolle anlegen",
- roleEditPage.getHeaderText());
+ assertEquals("Neue Rolle anlegen", roleEditPage.getHeaderText(), "Header for create new role is incorrect");
roleEditPage.setRoleTitle(role.getTitle()).assignAllGlobalAuthorities()
.assignAllClientAuthorities();
roleEditPage.save();
- assertTrue("Redirection after save was not successful", usersPage.isAt());
+ assertTrue(usersPage.isAt(), "Redirection after save was not successful");
List roleTitles = usersPage.getRoleTitles();
- assertTrue("New role was not saved", roleTitles.contains(role.getTitle()));
+ assertTrue(roleTitles.contains(role.getTitle()), "New role was not saved");
int availableGlobalAuthorities = ServiceManager.getAuthorityService().getAllAssignableGlobal().size();
int assignedGlobalAuthorities = usersPage.editRole(role.getTitle())
.countAssignedGlobalAuthorities();
- assertEquals("Assigned authorities of the new role were not saved!", availableGlobalAuthorities,
- assignedGlobalAuthorities);
+ assertEquals(availableGlobalAuthorities, assignedGlobalAuthorities, "Assigned authorities of the new role were not saved!");
String actualTitle = Pages.getRoleEditPage().getRoleTitle();
- assertEquals("New Name of role was not saved", role.getTitle(), actualTitle);
+ assertEquals(role.getTitle(), actualTitle, "New Name of role was not saved");
int availableClientAuthorities = ServiceManager.getAuthorityService().getAllAssignableToClients().size();
int assignedClientAuthorities = usersPage.editRole(role.getTitle())
.countAssignedClientAuthorities();
- assertEquals("Assigned client authorities of the new role were not saved!", availableClientAuthorities,
- assignedClientAuthorities);
+ assertEquals(availableClientAuthorities, assignedClientAuthorities, "Assigned client authorities of the new role were not saved!");
}
@Test
@@ -366,8 +351,8 @@ public void addCustomImportconfigurationWithUrlParameters() throws Exception {
importConfigurationEditPage.save();
ImportConfiguration importConfiguration = ServiceManager.getImportConfigurationService().getById(4);
List urlParameters = importConfiguration.getUrlParameters();
- assertEquals("Wrong number of custom URL parameters", 1, urlParameters.size());
- assertEquals("Wrong URL parameter key", "testkey", urlParameters.get(0).getParameterKey());
- assertEquals("Wrong URL parameter value", "testvalue", urlParameters.get(0).getParameterValue());
+ assertEquals(1, urlParameters.size(), "Wrong number of custom URL parameters");
+ assertEquals("testkey", urlParameters.get(0).getParameterKey(), "Wrong URL parameter key");
+ assertEquals("testvalue", urlParameters.get(0).getParameterValue(), "Wrong URL parameter value");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/CalendarST.java b/Kitodo/src/test/java/org/kitodo/selenium/CalendarST.java
index cc089f9356a..c4cf78a081f 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/CalendarST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/CalendarST.java
@@ -11,17 +11,17 @@
package org.kitodo.selenium;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
-import org.junit.After;
-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.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.data.database.beans.User;
import org.kitodo.data.database.exceptions.DAOException;
@@ -42,7 +42,7 @@ public class CalendarST extends BaseTestSelenium {
private static final String NEWSPAPER_TEST_METADATA_FILE = "testmetaNewspaper.xml";
private static final String NEWSPAPER_TEST_PROCESS_TITLE = "NewspaperOverallProcess";
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
processesPage = Pages.getProcessesPage();
calendarPage = Pages.getCalendarPage();
@@ -51,19 +51,19 @@ public static void setup() throws Exception {
ProcessTestUtils.copyTestMetadataFile(newspaperTestProcessId, NEWSPAPER_TEST_METADATA_FILE);
}
- @Before
+ @BeforeEach
public void login() throws Exception {
User calendarUser = ServiceManager.getUserService().getByLogin("kowal");
Pages.getLoginPage().goTo().performLogin(calendarUser);
}
- @After
+ @AfterEach
public void logout() throws Exception {
calendarPage.closePage();
Pages.getTopNavigation().logout();
}
- @AfterClass
+ @AfterAll
public static void cleanup() throws CustomResponseException, DAOException, DataException, IOException {
ProcessTestUtils.removeTestProcess(newspaperTestProcessId);
}
@@ -75,12 +75,12 @@ public void createProcessFromCalendar() throws Exception {
calendarPage.addBlock();
calendarPage.addIssue("Morning issue");
calendarPage.addIssue("Evening issue");
- assertEquals("Number of issues in the calendar does not match", 4, calendarPage.countIssues());
+ assertEquals(4, calendarPage.countIssues(), "Number of issues in the calendar does not match");
calendarPage.addMetadataToThis();
calendarPage.addMetadataToAll();
List morningIssueMetadata = calendarPage.getMetadata("Morning issue");
List eveningIssueMetadata = calendarPage.getMetadata("Evening issue");
- assertEquals("Metadata for morning issue is incorrect", Arrays.asList("Signatur", "Process title"), morningIssueMetadata);
- assertEquals("Metadata for evening issue is incorrect", List.of("Signatur"), eveningIssueMetadata);
+ assertEquals(Arrays.asList("Signatur", "Process title"), morningIssueMetadata, "Metadata for morning issue is incorrect");
+ assertEquals(List.of("Signatur"), eveningIssueMetadata, "Metadata for evening issue is incorrect");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/ConfigConversionST.java b/Kitodo/src/test/java/org/kitodo/selenium/ConfigConversionST.java
index 3a1e16142a1..accf18a3af9 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/ConfigConversionST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/ConfigConversionST.java
@@ -12,16 +12,16 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
-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.kitodo.data.database.beans.ImportConfiguration;
import org.kitodo.data.database.exceptions.DAOException;
import org.kitodo.production.services.ServiceManager;
@@ -38,12 +38,12 @@ public class ConfigConversionST extends BaseTestSelenium {
private static final String GBV = "GBV";
private static final String K10PLUS = "K10Plus";
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/EditingST.java b/Kitodo/src/test/java/org/kitodo/selenium/EditingST.java
index ed4abc482e1..0c59f446c50 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/EditingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/EditingST.java
@@ -12,16 +12,16 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.data.database.beans.Process;
import org.kitodo.production.services.ServiceManager;
import org.kitodo.selenium.testframework.BaseTestSelenium;
@@ -40,19 +40,19 @@ public class EditingST extends BaseTestSelenium {
private static ProjectsPage projectsPage;
private static UsersPage usersPage;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
processesPage = Pages.getProcessesPage();
projectsPage = Pages.getProjectsPage();
usersPage = Pages.getUsersPage();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
if (Browser.isAlertPresent()) {
@@ -63,25 +63,23 @@ public void logout() throws Exception {
@Test
public void editProcessTest() throws Exception {
processesPage.editProcess().changeProcessData();
- assertEquals("Header for edit process is incorrect", "First process\n(ID: 1)",
- Pages.getProcessEditPage().getHeaderText());
+ assertEquals("First process\n(ID: 1)", Pages.getProcessEditPage().getHeaderText(), "Header for edit process is incorrect");
Pages.getProcessEditPage().save();
- assertTrue("Redirection after save was not successful", processesPage.isAt());
+ assertTrue(processesPage.isAt(), "Redirection after save was not successful");
Process processAfterEdit = ServiceManager.getProcessService().getById(1);
- assertEquals("Incorrect amount of template properties", 4, processAfterEdit.getTemplates().size());
+ assertEquals(4, processAfterEdit.getTemplates().size(), "Incorrect amount of template properties");
}
@Test
public void editBatchTest() throws Exception {
processesPage.editBatch();
- await().untilAsserted(() -> assertEquals("Batch was not renamed!", 1,
- ServiceManager.getBatchService().getByQuery("FROM Batch WHERE title = 'SeleniumBatch'").size()));
+ await().untilAsserted(() -> assertEquals(1, ServiceManager.getBatchService().getByQuery("FROM Batch WHERE title = 'SeleniumBatch'").size(), "Batch was not renamed!"));
- assertEquals("Process was not removed from batch", 1, ServiceManager.getBatchService()
- .getByQuery("FROM Batch WHERE title = 'SeleniumBatch'").get(0).getProcesses().size());
+ assertEquals(1, ServiceManager.getBatchService()
+ .getByQuery("FROM Batch WHERE title = 'SeleniumBatch'").get(0).getProcesses().size(), "Process was not removed from batch");
}
@Test
@@ -89,8 +87,7 @@ public void editProjectTest() throws Exception {
final String newProjectTitle = "newTitle";
ProjectEditPage projectEditPage = projectsPage.editProject();
- assertEquals("Header for edit project is incorrect", "Projekt bearbeiten (First project)",
- Pages.getProjectEditPage().getHeaderText());
+ assertEquals("Projekt bearbeiten (First project)", Pages.getProjectEditPage().getHeaderText(), "Header for edit project is incorrect");
assertFalse(projectEditPage.areElementsEnabled());
@@ -100,7 +97,7 @@ public void editProjectTest() throws Exception {
projectEditPage.toggleProjectActiveCheckbox();
projectEditPage.save();
boolean projectAvailable = Pages.getProjectsPage().getProjectsTitles().contains(newProjectTitle);
- assertTrue("Title was not changed", projectAvailable);
+ assertTrue(projectAvailable, "Title was not changed");
List projectsActiveStates = projectsPage.getProjectsActiveStates();
assertTrue(projectsActiveStates.contains("fa fa-minus-square-o fa-lg checkbox-unchecked"));
@@ -115,72 +112,62 @@ public void editProjectTest() throws Exception {
public void editTemplateTest() throws Exception {
projectsPage = projectsPage.goToTemplateTab();
List templateDetails = projectsPage.getTemplateDetails();
- assertTrue("The first project should be assigned to this template", templateDetails.contains("First project"));
- assertFalse("The template is already assigned to second Project",
- templateDetails.stream().anyMatch(listString -> listString.contains("Second project")));
+ assertTrue(templateDetails.contains("First project"), "The first project should be assigned to this template");
+ assertFalse(templateDetails.stream().anyMatch(listString -> listString.contains("Second project")), "The template is already assigned to second Project");
TemplateEditPage editTemplatePage = projectsPage.editTemplate();
- assertEquals("Header for edit template is incorrect", "Produktionsvorlage bearbeiten (Fourth template)",
- Pages.getTemplateEditPage().getHeaderText());
+ assertEquals("Produktionsvorlage bearbeiten (Fourth template)", Pages.getTemplateEditPage().getHeaderText(), "Header for edit template is incorrect");
editTemplatePage.addSecondProject();
templateDetails = editTemplatePage.save().getTemplateDetails();
- assertTrue("The second project should be assigned to this template",
- templateDetails.stream().anyMatch(listString -> listString.contains("Second project")));
+ assertTrue(templateDetails.stream().anyMatch(listString -> listString.contains("Second project")), "The second project should be assigned to this template");
}
@Test
public void editWorkflowTest() throws Exception {
String status = projectsPage.goToWorkflowTab().getWorkflowStatusForWorkflow();
- assertEquals("Status is not correct", "Entwurf", status);
+ assertEquals("Entwurf", status, "Status is not correct");
WorkflowEditPage workflowEditPage = projectsPage.editWorkflow();
workflowEditPage.changeWorkflowStatusToActive();
- assertEquals("Header for edit workflow is incorrect", "Workflow bearbeiten (test)",
- Pages.getWorkflowEditPage().getHeaderText());
+ assertEquals("Workflow bearbeiten (test)", Pages.getWorkflowEditPage().getHeaderText(), "Header for edit workflow is incorrect");
projectsPage = workflowEditPage.save();
status = projectsPage.goToWorkflowTab().getWorkflowStatusForWorkflow();
- assertEquals("Status change was not saved", "Aktiv", status);
+ assertEquals("Aktiv", status, "Status change was not saved");
}
@Test
public void editDocketTest() throws Exception {
projectsPage.editDocket();
- assertEquals("Header for edit docket is incorrect", "Laufzettel bearbeiten (default)",
- Pages.getDocketEditPage().getHeaderText());
+ assertEquals("Laufzettel bearbeiten (default)", Pages.getDocketEditPage().getHeaderText(), "Header for edit docket is incorrect");
}
@Test
public void editRulesetTest() throws Exception {
projectsPage.editRuleset();
- assertEquals("Header for edit ruleset is incorrect", "Regelsatz bearbeiten (SLUBDD)",
- Pages.getRulesetEditPage().getHeaderText());
+ assertEquals("Regelsatz bearbeiten (SLUBDD)", Pages.getRulesetEditPage().getHeaderText(), "Header for edit ruleset is incorrect");
}
@Test
public void editUserTest() throws Exception {
usersPage.editUser();
- assertEquals("Header for edit user is incorrect", "Benutzer bearbeiten (null, Removable user)",
- Pages.getUserEditPage().getHeaderText());
+ assertEquals("Benutzer bearbeiten (null, Removable user)", Pages.getUserEditPage().getHeaderText(), "Header for edit user is incorrect");
}
@Test
public void editRoleTest() throws Exception {
usersPage.editRole();
- assertEquals("Header for edit role is incorrect", "Rolle bearbeiten (Admin)",
- Pages.getRoleEditPage().getHeaderText());
+ assertEquals("Rolle bearbeiten (Admin)", Pages.getRoleEditPage().getHeaderText(), "Header for edit role is incorrect");
}
@Test
public void editLdapGroupTest() throws Exception {
usersPage.editLdapGroup();
- assertEquals("Header for edit LDAP group is incorrect", "LDAP-Gruppe bearbeiten (LG)",
- Pages.getLdapGroupEditPage().getHeaderText());
+ assertEquals("LDAP-Gruppe bearbeiten (LG)", Pages.getLdapGroupEditPage().getHeaderText(), "Header for edit LDAP group is incorrect");
}
@Test
public void editClientTest() throws Exception {
usersPage.editClient();
- assertEquals("Header for edit client is incorrect", "Mandant bearbeiten",
- Pages.getClientEditPage().getHeaderText());
+ assertEquals("Mandant bearbeiten", Pages.getClientEditPage().getHeaderText(), "Header for edit client is incorrect");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/ImportingST.java b/Kitodo/src/test/java/org/kitodo/selenium/ImportingST.java
index 791042a7fcc..a54a7fb8444 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/ImportingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/ImportingST.java
@@ -12,20 +12,21 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import com.xebialabs.restito.server.StubServer;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import com.xebialabs.restito.server.StubServer;
-import org.junit.After;
-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.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.data.database.exceptions.DAOException;
import org.kitodo.data.exceptions.DataException;
@@ -50,7 +51,7 @@ public class ImportingST extends BaseTestSelenium {
private static ProcessesPage processesPage;
private static int multiVolumeWorkId = -1;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
projectsPage = Pages.getProjectsPage();
processesPage = Pages.getProcessesPage();
@@ -64,12 +65,12 @@ public static void setup() throws Exception {
setupServer();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
if (Browser.isAlertPresent()) {
@@ -77,7 +78,7 @@ public void logout() throws Exception {
}
}
- @AfterClass
+ @AfterAll
public static void cleanup() throws DAOException, DataException, IOException {
ProcessService.deleteProcess(multiVolumeWorkId);
server.stop();
@@ -99,13 +100,11 @@ private static void setupServer() throws IOException {
public void checkDefaultValuesTest() throws Exception {
projectsPage.createNewProcess();
Select catalogSelectMenu = new Select(importPage.getCatalogMenu());
- assertEquals("Wrong default catalog selected", TestConstants.K10PLUS,
- catalogSelectMenu.getFirstSelectedOption().getAttribute("label"));
+ assertEquals(TestConstants.K10PLUS, catalogSelectMenu.getFirstSelectedOption().getAttribute("label"), "Wrong default catalog selected");
importPage.selectGBV();
Select searchFieldSelectMenu = new Select(importPage.getSearchFieldMenu());
- assertEquals("Wrong default search field selected", TestConstants.PPN,
- searchFieldSelectMenu.getFirstSelectedOption().getAttribute("label"));
+ assertEquals(TestConstants.PPN, searchFieldSelectMenu.getFirstSelectedOption().getAttribute("label"), "Wrong default search field selected");
}
/**
@@ -116,14 +115,14 @@ public void checkDefaultValuesTest() throws Exception {
@Test
public void checkSearchButtonActivatedText() throws Exception {
projectsPage.createNewProcess();
- assertFalse("'Search' button should be deactivated until import configuration, search field and "
- + "search term have been selected", importPage.getSearchButton().isEnabled());
+ assertFalse(importPage.getSearchButton().isEnabled(), "'Search' button should be deactivated until import configuration, search field and "
+ + "search term have been selected");
importPage.enterTestSearchValue("12345");
await("Wait for 'Search' button to be enabled").pollDelay(700, TimeUnit.MILLISECONDS)
.atMost(30, TimeUnit.SECONDS).ignoreExceptions()
.until(() -> importPage.getSearchButton().isEnabled());
- assertTrue("'Search' button should be activated when import configuration, search field and "
- + "search term have been selected", importPage.getSearchButton().isEnabled());
+ assertTrue(importPage.getSearchButton().isEnabled(), "'Search' button should be activated when import configuration, search field and "
+ + "search term have been selected");
}
/**
@@ -138,20 +137,18 @@ public void checkDefaultChildProcessImportConfiguration() throws Exception {
await("Wait for filter to be applied")
.pollDelay(100, TimeUnit.MILLISECONDS)
.atMost(5, TimeUnit.SECONDS).ignoreExceptions()
- .untilAsserted(() -> assertEquals("Wrong number of filtered processes", 1,
- processesPage.getProcessTitles().size()));
+ .untilAsserted(() -> assertEquals(1, processesPage.getProcessTitles().size(), "Wrong number of filtered processes"));
processesPage.createChildProcess();
Select templateProcessMenu = new Select(importPage.getTemplateProcessMenu());
- assertEquals("Wrong default child import configuration selected", TEST_VOLUME,
- templateProcessMenu.getFirstSelectedOption().getAttribute("label"));
+ assertEquals(TEST_VOLUME, templateProcessMenu.getFirstSelectedOption().getAttribute("label"), "Wrong default child import configuration selected");
}
@Test
public void checkOrderOfImportConfigurations() throws Exception {
projectsPage.createNewProcess();
List importConfigurationNames = importPage.getImportConfigurationsTitles();
- assertEquals("Wrong title of first import configuration", TestConstants.GBV, importConfigurationNames.get(1));
- assertEquals("Wrong title of second import configuration", TestConstants.K10PLUS, importConfigurationNames.get(2));
+ assertEquals(TestConstants.GBV, importConfigurationNames.get(1), "Wrong title of first import configuration");
+ assertEquals(TestConstants.K10PLUS, importConfigurationNames.get(2), "Wrong title of second import configuration");
}
/**
@@ -161,29 +158,26 @@ public void checkOrderOfImportConfigurations() throws Exception {
public void checkHierarchyImport() throws Exception {
projectsPage.createNewProcess();
Select catalogSelectMenu = new Select(importPage.getCatalogMenu());
- assertEquals("Wrong default catalog selected", TestConstants.K10PLUS,
- catalogSelectMenu.getFirstSelectedOption().getAttribute("label"));
+ assertEquals(TestConstants.K10PLUS, catalogSelectMenu.getFirstSelectedOption().getAttribute("label"), "Wrong default catalog selected");
importPage.selectKalliope();
Select searchFieldSelectMenu = new Select(importPage.getSearchFieldMenu());
- assertEquals("Wrong default search field selected", TestConstants.IDENTIFIER,
- searchFieldSelectMenu.getFirstSelectedOption().getAttribute("label"));
+ assertEquals(TestConstants.IDENTIFIER, searchFieldSelectMenu.getFirstSelectedOption().getAttribute("label"), "Wrong default search field selected");
importPage.enterTestSearchValue(TestConstants.KALLIOPE_PARENT_ID);
importPage.activateChildProcessImport();
importPage.decreaseImportDepth();
importPage.getSearchButton().click();
- assertTrue("Hierarchy panel should be visible", importPage.isHierarchyPanelVisible());
+ assertTrue(importPage.isHierarchyPanelVisible(), "Hierarchy panel should be visible");
importPage.addPpnAndTitle();
String parentTitle = importPage.getProcessTitle();
Pages.getProcessFromTemplatePage().save();
processesPage.applyFilter(parentTitle);
- assertEquals("Exactly one imported parent process should be displayed", 1,
- processesPage.countListedProcesses());
+ assertEquals(1, processesPage.countListedProcesses(), "Exactly one imported parent process should be displayed");
List processIds = processesPage.getProcessIds();
- assertEquals("Exactly one process ID should be visible", 1, processIds.size());
+ assertEquals(1, processIds.size(), "Exactly one process ID should be visible");
int processId = Integer.parseInt(processIds.get(0));
processesPage.filterByChildren();
List childProcessIds = processesPage.getProcessIds();
- assertEquals("Wrong number of child processes", 3, childProcessIds.size());
+ assertEquals(3, childProcessIds.size(), "Wrong number of child processes");
ProcessTestUtils.removeTestProcess(processId);
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/IndexingST.java b/Kitodo/src/test/java/org/kitodo/selenium/IndexingST.java
index 2e642792d94..1bf39087a62 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/IndexingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/IndexingST.java
@@ -12,34 +12,34 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.with;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import org.awaitility.Durations;
-import org.junit.After;
-import org.junit.Assert;
-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.kitodo.selenium.testframework.BaseTestSelenium;
import org.kitodo.selenium.testframework.Pages;
public class IndexingST extends BaseTestSelenium {
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
}
@Test
public void reindexingTest() throws Exception {
- Assert.assertTrue(true);
+ assertTrue(true);
Pages.getSystemPage().goTo().startReindexingAll();
Predicate isIndexingFinished = (d) -> {
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/ListingST.java b/Kitodo/src/test/java/org/kitodo/selenium/ListingST.java
index d5cde2c43a2..5bc7d38d0c0 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/ListingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/ListingST.java
@@ -11,14 +11,14 @@
package org.kitodo.selenium;
-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 java.util.List;
-import org.junit.AfterClass;
-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.Test;
import org.kitodo.SecurityTestUtils;
import org.kitodo.data.database.beans.User;
import org.kitodo.production.services.ServiceManager;
@@ -39,7 +39,7 @@ public class ListingST extends BaseTestSelenium {
private static TasksPage tasksPage;
private static UsersPage usersPage;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
desktopPage = Pages.getDesktopPage();
processesPage = Pages.getProcessesPage();
@@ -48,7 +48,7 @@ public static void setup() throws Exception {
usersPage = Pages.getUsersPage();
}
- @BeforeClass
+ @BeforeAll
public static void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
@@ -56,7 +56,7 @@ public static void login() throws Exception {
SecurityTestUtils.addUserDataToSecurityContext(user, 1);
}
- @AfterClass
+ @AfterAll
public static void cleanSecurityContext() {
SecurityTestUtils.cleanSecurityContext();
}
@@ -64,7 +64,7 @@ public static void cleanSecurityContext() {
@Test
public void securityAccessTest() throws Exception {
boolean expectedTrue = Pages.getTopNavigation().isShowingAllLinks();
- assertTrue("Top navigation is not showing that current user is admin", expectedTrue);
+ assertTrue(expectedTrue, "Top navigation is not showing that current user is admin");
}
@Test
@@ -73,14 +73,14 @@ public void listDesktopTest() throws Exception {
long processesInDatabase = ServiceManager.getProcessService().countResults(null);
long processesDisplayed = desktopPage.countListedProcesses();
- assertEquals("Displayed wrong number of processes", processesInDatabase, processesDisplayed);
+ assertEquals(processesInDatabase, processesDisplayed, "Displayed wrong number of processes");
int projectsInDatabase = ServiceManager.getProjectService()
.getByQuery(
"FROM Project AS p INNER JOIN p.users AS u WITH u.id = 1 INNER JOIN p.client AS c WITH c.id = 1")
.size();
int projectsDisplayed = desktopPage.countListedProjects();
- assertEquals("Displayed wrong number of projects", projectsInDatabase, projectsDisplayed);
+ assertEquals(projectsInDatabase, projectsDisplayed, "Displayed wrong number of projects");
String query = "SELECT t FROM Task AS t INNER JOIN t.roles AS r WITH r.id = 1"
+ " INNER JOIN t.process AS p WITH p.id IS NOT NULL WHERE (t.processingUser = 1 OR r.id = 1)"
@@ -88,48 +88,48 @@ public void listDesktopTest() throws Exception {
int tasksInDatabase = ServiceManager.getTaskService().getByQuery(query).size();
int tasksDisplayed = desktopPage.countListedTasks();
- assertEquals("Displayed wrong number of tasks", tasksInDatabase, tasksDisplayed);
+ assertEquals(tasksInDatabase, tasksDisplayed, "Displayed wrong number of tasks");
int statisticsDisplayed = desktopPage.countListedStatistics();
- assertEquals("Displayed wrong number of statistics", 9, statisticsDisplayed);
+ assertEquals(9, statisticsDisplayed, "Displayed wrong number of statistics");
List statistics = desktopPage.getStatistics();
long countInDatabase = ServiceManager.getTaskService().countDatabaseRows();
long countDisplayed = Long.parseLong(statistics.get(0));
- assertEquals("Displayed wrong count for task statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for task statistics");
countInDatabase = ServiceManager.getUserService().countDatabaseRows();
countDisplayed = Long.parseLong(statistics.get(1));
- assertEquals("Displayed wrong count for user statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for user statistics");
countInDatabase = ServiceManager.getProcessService().countDatabaseRows();
countDisplayed = Long.parseLong(statistics.get(2));
- assertEquals("Displayed wrong count for process statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for process statistics");
countInDatabase = ServiceManager.getDocketService().countDatabaseRows();
countDisplayed = Long.parseLong(statistics.get(3));
- assertEquals("Displayed wrong count for docket statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for docket statistics");
countInDatabase = ServiceManager.getProjectService().countDatabaseRows();
countDisplayed = Long.parseLong(statistics.get(4));
- assertEquals("Displayed wrong count for project statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for project statistics");
countInDatabase = ServiceManager.getRulesetService().countDatabaseRows();
countDisplayed = Long.parseLong(statistics.get(5));
- assertEquals("Displayed wrong count for ruleset statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for ruleset statistics");
countInDatabase = ServiceManager.getTemplateService().countDatabaseRows();
countDisplayed = Long.parseLong(statistics.get(6));
- assertEquals("Displayed wrong count for template statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for template statistics");
countInDatabase = ServiceManager.getRoleService().countDatabaseRows();
countDisplayed = Long.parseLong(statistics.get(7));
- assertEquals("Displayed wrong count for role statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for role statistics");
countInDatabase = ServiceManager.getWorkflowService().countDatabaseRows();
countDisplayed = Long.parseLong(statistics.get(8));
- assertEquals("Displayed wrong count for workflow statistics", countInDatabase, countDisplayed);
+ assertEquals(countInDatabase, countDisplayed, "Displayed wrong count for workflow statistics");
}
@Test
@@ -142,15 +142,15 @@ public void listTasksTest() throws Exception {
int tasksInDatabase = ServiceManager.getTaskService().getByQuery(query).size();
int tasksDisplayed = tasksPage.countListedTasks();
- assertEquals("Displayed wrong number of tasks", tasksInDatabase, tasksDisplayed);
+ assertEquals(tasksInDatabase, tasksDisplayed, "Displayed wrong number of tasks");
List detailsTask = tasksPage.getTaskDetails();
- assertEquals("Displayed wrong number of task's details", 5, detailsTask.size());
- assertEquals("Displayed wrong task's priority", "false", detailsTask.get(0));
- assertEquals("Displayed wrong task's processing begin", "2017-01-25 00:00:00", detailsTask.get(1));
- assertEquals("Displayed wrong task's processing update", "", detailsTask.get(2));
- assertEquals("Displayed wrong task's processing user", "Nowak, Adam", detailsTask.get(3));
- assertEquals("Displayed wrong task's edit type", "manuell, regulärer Workflow", detailsTask.get(4));
+ assertEquals(5, detailsTask.size(), "Displayed wrong number of task's details");
+ assertEquals("false", detailsTask.get(0), "Displayed wrong task's priority");
+ assertEquals("2017-01-25 00:00:00", detailsTask.get(1), "Displayed wrong task's processing begin");
+ assertEquals("", detailsTask.get(2), "Displayed wrong task's processing update");
+ assertEquals("Nowak, Adam", detailsTask.get(3), "Displayed wrong task's processing user");
+ assertEquals("manuell, regulärer Workflow", detailsTask.get(4), "Displayed wrong task's edit type");
tasksPage.applyFilterShowOnlyOpenTasks();
@@ -159,7 +159,7 @@ public void listTasksTest() throws Exception {
+ "t.processingStatus = 1 AND t.typeAutomatic = 0";
tasksInDatabase = ServiceManager.getTaskService().getByQuery(query).size();
tasksDisplayed = tasksPage.countListedTasks();
- assertEquals("Displayed wrong number of tasks with applied filter", tasksInDatabase, tasksDisplayed);
+ assertEquals(tasksInDatabase, tasksDisplayed, "Displayed wrong number of tasks with applied filter");
}
@Test
@@ -170,15 +170,15 @@ public void listProjectsTest() throws Exception {
"FROM Project AS p INNER JOIN p.users AS u WITH u.id = 1 INNER JOIN p.client AS c WITH c.id = 1")
.size();
int projectsDisplayed = projectsPage.countListedProjects();
- assertEquals("Displayed wrong number of projects", projectsInDatabase, projectsDisplayed);
+ assertEquals(projectsInDatabase, projectsDisplayed, "Displayed wrong number of projects");
List detailsProject = projectsPage.getProjectDetails();
- assertEquals("Displayed wrong number of project's details", 1, detailsProject.size());
- assertEquals("Displayed wrong project's METS owner", "Test Owner", detailsProject.get(0));
+ assertEquals(1, detailsProject.size(), "Displayed wrong number of project's details");
+ assertEquals("Test Owner", detailsProject.get(0), "Displayed wrong project's METS owner");
List templatesProject = projectsPage.getProjectTemplates();
- assertEquals("Displayed wrong number of project's templates", 2, templatesProject.size());
- assertEquals("Displayed wrong project's template", "Fourth template", templatesProject.get(0));
+ assertEquals(2, templatesProject.size(), "Displayed wrong number of project's templates");
+ assertEquals("Fourth template", templatesProject.get(0), "Displayed wrong project's template");
int templatesInDatabase = ServiceManager.getTemplateService().getAllForSelectedClient().size();
int templatesDisplayed = projectsPage.countListedTemplates();
@@ -193,15 +193,15 @@ public void listProjectsTest() throws Exception {
int workflowsInDatabase = ServiceManager.getWorkflowService().getAllForSelectedClient().size();
int workflowsDisplayed = projectsPage.countListedWorkflows();
- assertEquals("Displayed wrong number of workflows", workflowsInDatabase, workflowsDisplayed);
+ assertEquals(workflowsInDatabase, workflowsDisplayed, "Displayed wrong number of workflows");
int docketsInDatabase = ServiceManager.getDocketService().getAllForSelectedClient().size();
int docketsDisplayed = projectsPage.countListedDockets();
- assertEquals("Displayed wrong number of dockets", docketsInDatabase, docketsDisplayed);
+ assertEquals(docketsInDatabase, docketsDisplayed, "Displayed wrong number of dockets");
int rulesetsInDatabase = ServiceManager.getRulesetService().getAllForSelectedClient().size();
int rulesetsDisplayed = projectsPage.countListedRulesets();
- assertEquals("Displayed wrong number of rulesets", rulesetsInDatabase, rulesetsDisplayed);
+ assertEquals(rulesetsInDatabase, rulesetsDisplayed, "Displayed wrong number of rulesets");
}
@Test
@@ -209,11 +209,11 @@ public void listProcessesTest() throws Exception {
processesPage.goTo();
long processesInDatabase = ServiceManager.getProcessService().countResults(null);
long processesDisplayed = processesPage.countListedProcesses();
- assertEquals("Displayed wrong number of processes", processesInDatabase, processesDisplayed);
+ assertEquals(processesInDatabase, processesDisplayed, "Displayed wrong number of processes");
int batchesInDatabase = ServiceManager.getBatchService().getAll().size();
int batchesDisplayed = processesPage.countListedBatches();
- assertEquals("Displayed wrong number of batches", batchesInDatabase, batchesDisplayed);
+ assertEquals(batchesInDatabase, batchesDisplayed, "Displayed wrong number of batches");
}
@Test
@@ -221,19 +221,19 @@ public void listUsersTest() throws Exception {
usersPage.goTo();
int usersInDatabase = ServiceManager.getUserService().getAll().size();
int usersDisplayed = usersPage.countListedUsers();
- assertEquals("Displayed wrong number of users", usersInDatabase, usersDisplayed);
+ assertEquals(usersInDatabase, usersDisplayed, "Displayed wrong number of users");
int rolesInDatabase = ServiceManager.getRoleService().getAll().size();
int rolesDisplayed = usersPage.countListedRoles();
- assertEquals("Displayed wrong number of roles", rolesInDatabase, rolesDisplayed);
+ assertEquals(rolesInDatabase, rolesDisplayed, "Displayed wrong number of roles");
int clientsInDatabase = ServiceManager.getClientService().getAll().size();
int clientsDisplayed = usersPage.countListedClients();
- assertEquals("Displayed wrong number of clients", clientsInDatabase, clientsDisplayed);
+ assertEquals(clientsInDatabase, clientsDisplayed, "Displayed wrong number of clients");
int ldapGroupsInDatabase = ServiceManager.getLdapGroupService().getAll().size();
int ldapGroupsDisplayed = usersPage.countListedLdapGroups();
- assertEquals("Displayed wrong number of ldap groups!", ldapGroupsInDatabase, ldapGroupsDisplayed);
+ assertEquals(ldapGroupsInDatabase, ldapGroupsDisplayed, "Displayed wrong number of ldap groups!");
}
/**
@@ -245,16 +245,13 @@ public void listUsersTest() throws Exception {
@Test
public void listTemplatesTest() throws Exception {
projectsPage.goToTemplateTab();
- assertEquals("Wrong number of templates before hiding first template", 2,
- projectsPage.getTemplateTitles().size());
+ assertEquals(2, projectsPage.getTemplateTitles().size(), "Wrong number of templates before hiding first template");
TemplateEditPage editTemplatePage = projectsPage.editTemplate();
editTemplatePage.hideTemplate();
editTemplatePage.save();
- assertEquals("Wrong number of templates after hiding first template", 1,
- projectsPage.getTemplateTitles().size());
+ assertEquals(1, projectsPage.getTemplateTitles().size(), "Wrong number of templates after hiding first template");
projectsPage.goToTemplateTab();
projectsPage.toggleHiddenTemplates();
- assertEquals("Wrong number of templates after toggling hidden templates", 2,
- projectsPage.getTemplateTitles().size());
+ assertEquals(2, projectsPage.getTemplateTitles().size(), "Wrong number of templates after toggling hidden templates");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/ListingSessionClientST.java b/Kitodo/src/test/java/org/kitodo/selenium/ListingSessionClientST.java
index d6bdbc0824b..f244d149864 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/ListingSessionClientST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/ListingSessionClientST.java
@@ -11,14 +11,13 @@
package org.kitodo.selenium;
-import static org.junit.Assert.assertEquals;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.SecurityTestUtils;
import org.kitodo.data.database.beans.User;
import org.kitodo.selenium.testframework.BaseTestSelenium;
@@ -31,20 +30,17 @@ public class ListingSessionClientST extends BaseTestSelenium {
private static ProjectsPage projectsPage;
- @Rule
- public final ExpectedException exception = ExpectedException.none();
-
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
projectsPage = Pages.getProjectsPage();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLogin(ServiceManager.getUserService().getById(2));
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
if (Browser.isAlertPresent()) {
@@ -64,10 +60,9 @@ public void listProjectsForUserWithFirstSessionClientTest() throws Exception {
int projectsInDatabase = ServiceManager.getProjectService()
.getByQuery("FROM Project AS p INNER JOIN p.users AS u WITH u.id = 2 INNER JOIN p.client AS c WITH c.id = 1").size();
int projectsDisplayed = projectsPage.countListedProjects();
- assertEquals("Displayed wrong number of projects", projectsInDatabase, projectsDisplayed);
+ assertEquals(projectsInDatabase, projectsDisplayed, "Displayed wrong number of projects");
- exception.expect(IndexOutOfBoundsException.class);
- projectsPage.countListedTemplates();
+ assertThrows(IndexOutOfBoundsException.class, () -> projectsPage.countListedTemplates());
SecurityTestUtils.cleanSecurityContext();
}
@@ -84,23 +79,22 @@ public void listProjectsForUserWithSecondSessionClientTest() throws Exception {
int projectsInDatabase = ServiceManager.getProjectService()
.getByQuery("FROM Project AS p INNER JOIN p.users AS u WITH u.id = 2 INNER JOIN p.client AS c WITH c.id = 2").size();
int projectsDisplayed = projectsPage.countListedProjects();
- assertEquals("Displayed wrong number of projects", projectsInDatabase, projectsDisplayed);
+ assertEquals(projectsInDatabase, projectsDisplayed, "Displayed wrong number of projects");
// TODO: rewrite query for active templates
//int templatesInDatabase = ServiceManager.getTemplateService().getActiveTemplates().size();
int templatesDisplayed = projectsPage.countListedTemplates();
- assertEquals("Displayed wrong number of templates", 2, templatesDisplayed);
+ assertEquals(2, templatesDisplayed, "Displayed wrong number of templates");
int workflowsInDatabase = ServiceManager.getWorkflowService().getAllForSelectedClient().size();
int workflowsDisplayed = projectsPage.countListedWorkflows();
- assertEquals("Displayed wrong number of workflows", workflowsInDatabase, workflowsDisplayed);
+ assertEquals(workflowsInDatabase, workflowsDisplayed, "Displayed wrong number of workflows");
int docketsInDatabase = ServiceManager.getDocketService().getAllForSelectedClient().size();
int docketsDisplayed = projectsPage.countListedDockets();
- assertEquals("Displayed wrong number of dockets", docketsInDatabase, docketsDisplayed);
+ assertEquals(docketsInDatabase, docketsDisplayed, "Displayed wrong number of dockets");
- exception.expect(IndexOutOfBoundsException.class);
- projectsPage.countListedRulesets();
+ assertThrows(IndexOutOfBoundsException.class, () -> projectsPage.countListedRulesets());
SecurityTestUtils.cleanSecurityContext();
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/LoginST.java b/Kitodo/src/test/java/org/kitodo/selenium/LoginST.java
index d3d27b7b836..641fa5bff81 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/LoginST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/LoginST.java
@@ -11,9 +11,10 @@
package org.kitodo.selenium;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.kitodo.data.elasticsearch.exceptions.CustomResponseException;
import org.kitodo.data.exceptions.DataException;
import org.kitodo.production.services.ServiceManager;
@@ -23,7 +24,7 @@
public class LoginST extends BaseTestSelenium {
- @BeforeClass
+ @BeforeAll
public static void manipulateIndex() throws DataException, CustomResponseException {
// remove one process from index but not from DB to provoke index warning
ServiceManager.getProcessService().removeFromIndex(1, true);
@@ -33,12 +34,12 @@ public static void manipulateIndex() throws DataException, CustomResponseExcepti
public void indexWarningTest() throws Exception {
// log into Kitodo with non-admin user to be redirected to 'checks' page
Pages.getLoginPage().goTo().performLogin(ServiceManager.getUserService().getById(2));
- Assert.assertEquals("http://localhost:8080/kitodo/pages/checks.jsf", Browser.getCurrentUrl());
+ assertEquals("http://localhost:8080/kitodo/pages/checks.jsf", Browser.getCurrentUrl());
Pages.getPostLoginChecksPage().logout();
// log into kitodo with admin user to be redirected to 'system' page
Pages.getLoginPage().goTo().performLoginAsAdmin();
- Assert.assertEquals("http://localhost:8080/kitodo/pages/system.jsf?tabIndex=2", Browser.getCurrentUrl());
+ assertEquals("http://localhost:8080/kitodo/pages/system.jsf?tabIndex=2", Browser.getCurrentUrl());
Pages.getTopNavigation().logout();
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/ManagementST.java b/Kitodo/src/test/java/org/kitodo/selenium/ManagementST.java
index 4d16999a3ce..0b5eb77a3ba 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/ManagementST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/ManagementST.java
@@ -12,13 +12,13 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.concurrent.TimeUnit;
-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.kitodo.selenium.testframework.BaseTestSelenium;
import org.kitodo.selenium.testframework.Browser;
import org.kitodo.selenium.testframework.Pages;
@@ -26,12 +26,12 @@
public class ManagementST extends BaseTestSelenium {
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
if (Browser.isAlertPresent()) {
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/MassImportST.java b/Kitodo/src/test/java/org/kitodo/selenium/MassImportST.java
index 7b868a275bb..5802ce94ce4 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/MassImportST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/MassImportST.java
@@ -11,18 +11,19 @@
package org.kitodo.selenium;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.constants.StringConstants;
import org.kitodo.selenium.testframework.BaseTestSelenium;
@@ -44,7 +45,7 @@ public class MassImportST extends BaseTestSelenium {
private static final String CSV_UPLOAD_FILE_EXTENSION = ".csv";
private static final String CSV_CELL_SELECTOR = "#editForm\\:recordsTable_data tr .ui-cell-editor-output";
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
massImportPage = Pages.getMassImportPage();
csvUploadFile = createCsvFile();
@@ -52,14 +53,14 @@ public static void setup() throws Exception {
MockDatabase.insertImportConfigurations();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
Pages.getProjectsPage().goTo();
Pages.getProjectsPage().clickMassImportAction();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
if (Browser.isAlertPresent()) {
@@ -67,7 +68,7 @@ public void logout() throws Exception {
}
}
- @AfterClass
+ @AfterAll
public static void cleanup() throws IOException {
deleteCsvFile();
}
@@ -81,14 +82,14 @@ public void handleCsvFileUpload() throws InterruptedException {
Thread.sleep(Browser.getDelayAfterLogout());
List csvRows = Browser.getDriver().findElement(By.id("editForm:recordsTable_data"))
.findElements(By.tagName("tr"));
- Assert.assertEquals("CSV file not parsed correctly", 3, csvRows.size());
+ assertEquals(3, csvRows.size(), "CSV file not parsed correctly");
List csvCells = Browser.getDriver().findElements(By.cssSelector(CSV_CELL_SELECTOR));
- Assert.assertEquals("CSV lines should not be segmented correctly into multiple cells when using wrong CSV "
- + "separator", 3, csvCells.size());
+ assertEquals(3, csvCells.size(), "CSV lines should not be segmented correctly into multiple cells when using wrong CSV "
+ + "separator");
massImportPage.updateSeparator(StringConstants.COMMA_DELIMITER.trim());
List updatedCsvCells = Browser.getDriver().findElements(By.cssSelector(CSV_CELL_SELECTOR));
- Assert.assertEquals("CSV lines should be segmented correctly into multiple cells when using correct CSV "
- + "separator", 9, updatedCsvCells.size());
+ assertEquals(9, updatedCsvCells.size(), "CSV lines should be segmented correctly into multiple cells when using correct CSV "
+ + "separator");
}
private static File createCsvFile() throws IOException {
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java b/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java
index c20caaad108..51e7c06dfa3 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/MetadataST.java
@@ -12,9 +12,9 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.nio.file.Files;
@@ -24,11 +24,10 @@
import java.util.List;
import java.util.concurrent.TimeUnit;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.config.ConfigCore;
import org.kitodo.data.database.beans.Process;
@@ -109,7 +108,7 @@ private static void prepareCreateStructureProcess() throws DAOException, DataExc
* @throws DataException when retrieving test project for test processes fails.
* @throws IOException when copying test metadata or image files fails.
*/
- @BeforeClass
+ @BeforeAll
public static void prepare() throws DAOException, DataException, IOException {
MockDatabase.insertFoldersForSecondProject();
prepareMetadataLockProcess();
@@ -128,7 +127,7 @@ public static void prepare() throws DAOException, DataException, IOException {
public void hideStructureDataTest() throws Exception {
login("verylast");
Pages.getProcessesPage().goTo().editMetadata(MockDatabase.METADATA_LOCK_TEST_PROCESS_TITLE);
- Assert.assertFalse(Pages.getMetadataEditorPage().isStructureTreeFormVisible());
+ assertFalse(Pages.getMetadataEditorPage().isStructureTreeFormVisible());
Pages.getMetadataEditorPage().save();
}
@@ -148,8 +147,7 @@ public void removeMetadataLockTest() throws Exception {
Pages.getTopNavigation().logout();
login("verylast");
Pages.getProcessesPage().goTo().editMetadata(MockDatabase.METADATA_LOCK_TEST_PROCESS_TITLE);
- Assert.assertTrue("Unable to open metadata editor that was not closed by 'close' button",
- Browser.getCurrentUrl().contains("metadataEditor.jsf"));
+ assertTrue(Browser.getCurrentUrl().contains("metadataEditor.jsf"), "Unable to open metadata editor that was not closed by 'close' button");
}
/**
@@ -160,17 +158,13 @@ public void removeMetadataLockTest() throws Exception {
public void changeProcessLinkOrderTest() throws Exception {
login("kowal");
Pages.getProcessesPage().goTo().editParentProcessMetadata();
- Assert.assertTrue("Wrong initial order of linked child processes",
- Pages.getMetadataEditorPage().getNameOfFirstLinkedChildProcess().endsWith(FIRST_CHILD_PROCESS_TITLE));
- Assert.assertTrue("Wrong initial order of linked child processes",
- Pages.getMetadataEditorPage().getSecondRootElementChildLabel().endsWith(SECOND_CHILD_PROCESS_TITLE));
+ assertTrue(Pages.getMetadataEditorPage().getNameOfFirstLinkedChildProcess().endsWith(FIRST_CHILD_PROCESS_TITLE), "Wrong initial order of linked child processes");
+ assertTrue(Pages.getMetadataEditorPage().getSecondRootElementChildLabel().endsWith(SECOND_CHILD_PROCESS_TITLE), "Wrong initial order of linked child processes");
Pages.getMetadataEditorPage().changeOrderOfLinkedChildProcesses();
Pages.getMetadataEditorPage().saveAndExit();
Pages.getProcessesPage().goTo().editParentProcessMetadata();
- Assert.assertTrue("Wrong resulting order of linked child processes",
- Pages.getMetadataEditorPage().getNameOfFirstLinkedChildProcess().endsWith(SECOND_CHILD_PROCESS_TITLE));
- Assert.assertTrue("Wrong resulting order of linked child processes",
- Pages.getMetadataEditorPage().getSecondRootElementChildLabel().endsWith(FIRST_CHILD_PROCESS_TITLE));
+ assertTrue(Pages.getMetadataEditorPage().getNameOfFirstLinkedChildProcess().endsWith(SECOND_CHILD_PROCESS_TITLE), "Wrong resulting order of linked child processes");
+ assertTrue(Pages.getMetadataEditorPage().getSecondRootElementChildLabel().endsWith(FIRST_CHILD_PROCESS_TITLE), "Wrong resulting order of linked child processes");
}
/**
@@ -182,14 +176,11 @@ public void changeProcessLinkOrderTest() throws Exception {
public void toggleAllStructureNodesTest() throws Exception {
login("kowal");
Pages.getProcessesPage().goTo().editMetadata(MockDatabase.METADATA_LOCK_TEST_PROCESS_TITLE);
- Assert.assertEquals("Number of visible nodes is wrong initially", 2,
- Pages.getMetadataEditorPage().getNumberOfDisplayedStructureElements());
+ assertEquals(2, Pages.getMetadataEditorPage().getNumberOfDisplayedStructureElements(), "Number of visible nodes is wrong initially");
Pages.getMetadataEditorPage().collapseAll();
- Assert.assertEquals("Number of visible nodes after collapsing all is wrong", 1,
- Pages.getMetadataEditorPage().getNumberOfDisplayedStructureElements());
+ assertEquals(1, Pages.getMetadataEditorPage().getNumberOfDisplayedStructureElements(), "Number of visible nodes after collapsing all is wrong");
Pages.getMetadataEditorPage().expandAll();
- Assert.assertEquals("Number of visible nodes after expanding all is wrong", 2,
- Pages.getMetadataEditorPage().getNumberOfDisplayedStructureElements());
+ assertEquals(2, Pages.getMetadataEditorPage().getNumberOfDisplayedStructureElements(), "Number of visible nodes after expanding all is wrong");
}
/**
@@ -199,8 +190,7 @@ public void toggleAllStructureNodesTest() throws Exception {
public void totalNumberOfScansTest() throws Exception {
login("kowal");
Pages.getProcessesPage().goTo().editMetadata(MockDatabase.MEDIA_RENAMING_TEST_PROCESS_TITLE);
- assertEquals("Total number of scans is not correct", "(3 Medien)",
- Pages.getMetadataEditorPage().getNumberOfScans());
+ assertEquals("(3 Medien)", Pages.getMetadataEditorPage().getNumberOfScans(), "Total number of scans is not correct");
}
/**
@@ -226,8 +216,8 @@ public void showPaginationByDefaultTest() throws Exception {
public void updateMediaReferencesTest() throws Exception {
login("kowal");
Pages.getProcessesPage().goTo().editMetadata(MockDatabase.MEDIA_REFERENCES_TEST_PROCESS_TITLE);
- assertTrue("Media references updated dialog not visible", Pages.getMetadataEditorPage()
- .isFileReferencesUpdatedDialogVisible());
+ assertTrue(Pages.getMetadataEditorPage()
+ .isFileReferencesUpdatedDialogVisible(), "Media references updated dialog not visible");
Pages.getMetadataEditorPage().acknowledgeFileReferenceChanges();
}
@@ -240,14 +230,12 @@ public void updateMediaReferencesTest() throws Exception {
public void renameMediaFilesTest() throws Exception {
login("kowal");
Pages.getProcessesPage().goTo().editMetadata(MockDatabase.MEDIA_RENAMING_TEST_PROCESS_TITLE);
- assertEquals("Second child node in structure tree has wrong label BEFORE renaming media files",
- FIRST_STRUCTURE_TREE_NODE_LABEL, Pages.getMetadataEditorPage().getSecondRootElementChildLabel());
+ assertEquals(FIRST_STRUCTURE_TREE_NODE_LABEL, Pages.getMetadataEditorPage().getSecondRootElementChildLabel(), "Second child node in structure tree has wrong label BEFORE renaming media files");
Pages.getMetadataEditorPage().renameMedia();
- assertTrue("'Renaming media files was successful' dialog is not visible", Pages.getMetadataEditorPage()
- .isRenamingMediaFilesDialogVisible());
+ assertTrue(Pages.getMetadataEditorPage()
+ .isRenamingMediaFilesDialogVisible(), "'Renaming media files was successful' dialog is not visible");
Pages.getMetadataEditorPage().acknowledgeRenamingMediaFiles();
- assertEquals("Second child node in structure tree has wrong label AFTER renaming media files",
- SECOND_STRUCTURE_TREE_NODE_LABEL, Pages.getMetadataEditorPage().getSecondRootElementChildLabel());
+ assertEquals(SECOND_STRUCTURE_TREE_NODE_LABEL, Pages.getMetadataEditorPage().getSecondRootElementChildLabel(), "Second child node in structure tree has wrong label AFTER renaming media files");
}
/**
@@ -274,8 +262,7 @@ public void dragAndDropPageTest() throws Exception {
WebElement thumbnailOverlay = secondThumbnail.findElement(By.className("thumbnail-overlay"));
await().ignoreExceptions().pollDelay(300, TimeUnit.MILLISECONDS).atMost(5, TimeUnit.SECONDS)
.until(thumbnailOverlay::isDisplayed);
- Assert.assertEquals("Last thumbnail has wrong overlay before drag'n'drop action",
- "Bild 1, Seite -", thumbnailOverlay.getText().strip());
+ assertEquals("Bild 1, Seite -", thumbnailOverlay.getText().strip(), "Last thumbnail has wrong overlay before drag'n'drop action");
// drop position for drag'n'drop action
WebElement dropPosition = Browser.getDriver()
.findElement(By.id("imagePreviewForm:unstructuredMediaList:2:unstructuredPageDropArea"));
@@ -295,8 +282,7 @@ public void dragAndDropPageTest() throws Exception {
thumbnailOverlay = secondThumbnail.findElement(By.className("thumbnail-overlay"));
await().ignoreExceptions().pollDelay(300, TimeUnit.MILLISECONDS).atMost(5, TimeUnit.SECONDS)
.until(thumbnailOverlay::isDisplayed);
- Assert.assertEquals("Last thumbnail has wrong overlay after drag'n'drop action",
- "Bild 2, Seite -", thumbnailOverlay.getText().strip());
+ assertEquals("Bild 2, Seite -", thumbnailOverlay.getText().strip(), "Last thumbnail has wrong overlay after drag'n'drop action");
}
/**
@@ -323,7 +309,7 @@ public void createStructureElementTest() throws Exception {
.findElement(By.id("buttonForm:saveExit"))::isDisplayed);
WebElement contextMenu = Browser.getDriver().findElement(By.id("contextMenuLogicalTree"));
List menuItems = contextMenu.findElements(By.className("ui-menuitem"));
- assertEquals("Wrong number of context menu items", 3, menuItems.size());
+ assertEquals(3, menuItems.size(), "Wrong number of context menu items");
// click "add element" option
menuItems.get(0).click();
// open "structure element type selection" menu
@@ -341,14 +327,14 @@ public void createStructureElementTest() throws Exception {
.until(Browser.getDriver().findElement(By.id("buttonForm:saveExit"))::isEnabled);
structureTree = Browser.getDriver().findElement(By.id("logicalTree"));
WebElement firstChild = structureTree.findElement(By.id("logicalTree:0_0"));
- Assert.assertEquals("Added structure element has wrong type!", structureType, firstChild.getText());
+ assertEquals(structureType, firstChild.getText(), "Added structure element has wrong type!");
}
/**
* Close metadata editor and logout after every test.
* @throws Exception when page navigation fails
*/
- @After
+ @AfterEach
public void closeEditorAndLogout() throws Exception {
Pages.getMetadataEditorPage().closeEditor();
Pages.getTopNavigation().logout();
@@ -361,7 +347,7 @@ public void closeEditorAndLogout() throws Exception {
* @throws DataException when dummy process cannot be removed from index
* @throws IOException when deleting test files fails.
*/
- @AfterClass
+ @AfterAll
public static void cleanup() throws DAOException, CustomResponseException, DataException, IOException {
for (int processId : processHierarchyTestProcessIds) {
ProcessService.deleteProcess(processId);
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/MigrationST.java b/Kitodo/src/test/java/org/kitodo/selenium/MigrationST.java
index 9271582ca5e..58595d93d4c 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/MigrationST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/MigrationST.java
@@ -12,17 +12,17 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.net.URI;
import java.util.concurrent.TimeUnit;
-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.kitodo.config.ConfigCore;
import org.kitodo.data.database.beans.Process;
import org.kitodo.data.database.beans.Workflow;
@@ -38,12 +38,12 @@ public class MigrationST extends BaseTestSelenium {
private String randomWorkflowName;
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
FileService fileService = ServiceManager.getFileService();
String diagramDirectory = ConfigCore.getKitodoDiagramDirectory();
@@ -65,7 +65,7 @@ public void testMigration() throws Exception {
ServiceManager.getProcessService().save(process);
SystemPage systemPage = Pages.getSystemPage().goTo();
- assertNull("wrong template", process.getTemplate());
+ assertNull(process.getTemplate(), "wrong template");
systemPage.startWorkflowMigration();
systemPage.selectProjects();
assertEquals("Finished, Closed, Progress, Open, Locked", systemPage.getAggregatedTasks(2));
@@ -78,16 +78,15 @@ public void testMigration() throws Exception {
String newTemplateTitle = "newTemplate";
systemPage.createNewTemplateFromPopup(newTemplateTitle);
await().pollDelay(700, TimeUnit.MILLISECONDS).atMost(30, TimeUnit.SECONDS)
- .ignoreExceptions().untilAsserted(() -> assertEquals("template of process should have changed", 5,
- (long) ServiceManager.getProcessService().getById(1).getTemplate().getId()));
+ .ignoreExceptions().untilAsserted(() -> assertEquals(5, (long) ServiceManager.getProcessService().getById(1).getTemplate().getId(), "template of process should have changed"));
WorkflowService workflowService = ServiceManager.getWorkflowService();
Workflow workflow = workflowService.getById(4);
final long numberOfTemplates = workflow.getTemplates().size();
final long workflowTemplateId = workflow.getTemplates().get(0).getId();
String processTemplateTitle = ServiceManager.getProcessService().getById(1).getTemplate().getTitle();
- assertEquals("only one template should be assigned", 1, numberOfTemplates);
- assertEquals("wrong template", 5, workflowTemplateId);
- assertEquals("wrong title for template", newTemplateTitle, processTemplateTitle);
+ assertEquals(1, numberOfTemplates, "only one template should be assigned");
+ assertEquals(5, workflowTemplateId, "wrong template");
+ assertEquals(newTemplateTitle, processTemplateTitle, "wrong title for template");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/ProcessesSelectingST.java b/Kitodo/src/test/java/org/kitodo/selenium/ProcessesSelectingST.java
index 68e027c95fb..ef1ae9eec7c 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/ProcessesSelectingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/ProcessesSelectingST.java
@@ -13,10 +13,10 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.data.database.beans.User;
import org.kitodo.production.services.ServiceManager;
import org.kitodo.selenium.testframework.BaseTestSelenium;
@@ -31,7 +31,7 @@ public class ProcessesSelectingST extends BaseTestSelenium {
* Set up process selecting tests.
* @throws Exception as exception
*/
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
User user = ServiceManager.getUserService().getById(1);
@@ -40,12 +40,12 @@ public static void setup() throws Exception {
processesPage = Pages.getProcessesPage();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/ProcessesSortingST.java b/Kitodo/src/test/java/org/kitodo/selenium/ProcessesSortingST.java
index 8d8794b8d5a..2b2f436a9d5 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/ProcessesSortingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/ProcessesSortingST.java
@@ -15,10 +15,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.data.database.beans.Task;
import org.kitodo.data.database.enums.TaskStatus;
import org.kitodo.production.services.ServiceManager;
@@ -41,7 +41,7 @@ public class ProcessesSortingST extends BaseTestSelenium {
/**
* Set up process sorting tests.
*/
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
processesPage = Pages.getProcessesPage();
@@ -52,12 +52,12 @@ public static void setup() throws Exception {
ServiceManager.getTaskService().save(task, true);
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/RemovingST.java b/Kitodo/src/test/java/org/kitodo/selenium/RemovingST.java
index b38d65d6263..f42f1eb4b01 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/RemovingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/RemovingST.java
@@ -11,18 +11,18 @@
package org.kitodo.selenium;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.kitodo.production.services.ServiceManager;
import org.kitodo.selenium.testframework.BaseTestSelenium;
import org.kitodo.selenium.testframework.Pages;
import org.kitodo.selenium.testframework.pages.ProcessesPage;
import org.kitodo.selenium.testframework.pages.ProjectsPage;
import org.kitodo.selenium.testframework.pages.UsersPage;
-import org.kitodo.production.services.ServiceManager;
-
-import static org.junit.Assert.assertTrue;
public class RemovingST extends BaseTestSelenium {
@@ -30,19 +30,19 @@ public class RemovingST extends BaseTestSelenium {
private static ProcessesPage processesPage;
private static ProjectsPage projectsPage;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
usersPage = Pages.getUsersPage();
processesPage = Pages.getProcessesPage();
projectsPage = Pages.getProjectsPage();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
}
@@ -51,65 +51,59 @@ public void logout() throws Exception {
public void removeBatchTest() throws Exception {
int batchesDisplayed = processesPage.countListedBatches();
long batchesInDatabase = ServiceManager.getBatchService().countDatabaseRows();
- assertTrue("Batch list is empty", batchesDisplayed > 0 && batchesInDatabase > 0);
+ assertTrue(batchesDisplayed > 0 && batchesInDatabase > 0, "Batch list is empty");
processesPage.deleteBatch();
- assertTrue("Removal of batch was not successful!",
- processesPage.countListedBatches() == batchesDisplayed - 1
- && ServiceManager.getBatchService().countDatabaseRows() == batchesInDatabase - 1);
+ assertTrue(processesPage.countListedBatches() == batchesDisplayed - 1
+ && ServiceManager.getBatchService().countDatabaseRows() == batchesInDatabase - 1, "Removal of batch was not successful!");
}
@Test
public void removeUserTest() throws Exception {
int usersDisplayed = usersPage.countListedUsers();
long usersInDatabase = ServiceManager.getUserService().countDatabaseRows();
- assertTrue("User list is empty", usersDisplayed > 0 && usersInDatabase > 0);
+ assertTrue(usersDisplayed > 0 && usersInDatabase > 0, "User list is empty");
usersPage.deleteRemovableUser();
- assertTrue("Removal of first user was not successful!",
- usersPage.countListedUsers() == usersDisplayed - 1
- && ServiceManager.getUserService().countDatabaseRows() == usersInDatabase - 1);
+ assertTrue(usersPage.countListedUsers() == usersDisplayed - 1
+ && ServiceManager.getUserService().countDatabaseRows() == usersInDatabase - 1, "Removal of first user was not successful!");
}
@Test
public void removeRoleTest() throws Exception {
int rolesDisplayed = usersPage.countListedRoles();
long rolesInDatabase = ServiceManager.getRoleService().countDatabaseRows();
- assertTrue("Role list is empty", rolesDisplayed > 0 && rolesInDatabase > 0);
+ assertTrue(rolesDisplayed > 0 && rolesInDatabase > 0, "Role list is empty");
usersPage.deleteRemovableRole();
- assertTrue("Removal of first role was not successful!",
- usersPage.countListedRoles() == rolesDisplayed - 1
- && ServiceManager.getRoleService().countDatabaseRows() == rolesInDatabase - 1);
+ assertTrue(usersPage.countListedRoles() == rolesDisplayed - 1
+ && ServiceManager.getRoleService().countDatabaseRows() == rolesInDatabase - 1, "Removal of first role was not successful!");
}
@Test
public void removeClientTest() throws Exception {
int clientsDisplayed = usersPage.countListedClients();
long clientsInDatabase = ServiceManager.getClientService().countDatabaseRows();
- assertTrue("Client list is empty", clientsDisplayed > 0 && clientsInDatabase > 0);
+ assertTrue(clientsDisplayed > 0 && clientsInDatabase > 0, "Client list is empty");
usersPage.deleteRemovableClient();
- assertTrue("Removal of first client was not successful!",
- usersPage.countListedClients() == clientsDisplayed - 1
- && ServiceManager.getClientService().countDatabaseRows() == clientsInDatabase - 1);
+ assertTrue(usersPage.countListedClients() == clientsDisplayed - 1
+ && ServiceManager.getClientService().countDatabaseRows() == clientsInDatabase - 1, "Removal of first client was not successful!");
}
@Test
public void removeDocketTest() throws Exception {
int docketsDisplayed = projectsPage.countListedDockets();
long docketsInDatabase = ServiceManager.getDocketService().countDatabaseRows();
- assertTrue("Docket list is empty", docketsDisplayed > 0 && docketsInDatabase > 0);
+ assertTrue(docketsDisplayed > 0 && docketsInDatabase > 0, "Docket list is empty");
projectsPage.deleteDocket();
- assertTrue("Removal of first docket was not successful!",
- projectsPage.countListedDockets() == docketsDisplayed - 1
- && ServiceManager.getDocketService().countDatabaseRows() == docketsInDatabase - 1);
+ assertTrue(projectsPage.countListedDockets() == docketsDisplayed - 1
+ && ServiceManager.getDocketService().countDatabaseRows() == docketsInDatabase - 1, "Removal of first docket was not successful!");
}
@Test
public void removeRulesetTest() throws Exception {
int rulesetsDisplayed = projectsPage.countListedRulesets();
long rulesetsInDatabase = ServiceManager.getRulesetService().countDatabaseRows();
- assertTrue("Ruleset list is empty", rulesetsDisplayed > 0 && rulesetsInDatabase > 0);
+ assertTrue(rulesetsDisplayed > 0 && rulesetsInDatabase > 0, "Ruleset list is empty");
projectsPage.deleteRuleset();
- assertTrue("Removal of ruleset was not successful!",
- projectsPage.countListedRulesets() == rulesetsDisplayed - 1
- && ServiceManager.getRulesetService().countDatabaseRows() == rulesetsInDatabase - 1);
+ assertTrue(projectsPage.countListedRulesets() == rulesetsDisplayed - 1
+ && ServiceManager.getRulesetService().countDatabaseRows() == rulesetsInDatabase - 1, "Removal of ruleset was not successful!");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/SearchingST.java b/Kitodo/src/test/java/org/kitodo/selenium/SearchingST.java
index a6f25e98441..ad1ac536df6 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/SearchingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/SearchingST.java
@@ -12,15 +12,15 @@
package org.kitodo.selenium;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.selenium.testframework.BaseTestSelenium;
import org.kitodo.selenium.testframework.Browser;
import org.kitodo.selenium.testframework.Pages;
@@ -41,7 +41,7 @@ public class SearchingST extends BaseTestSelenium {
private static ProcessesPage processesPage;
private static TasksPage tasksPage;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
desktopPage = Pages.getDesktopPage();
searchResultPage = Pages.getSearchResultPage();
@@ -50,7 +50,7 @@ public static void setup() throws Exception {
tasksPage = Pages.getTasksPage();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
@@ -61,7 +61,7 @@ public void login() throws Exception {
* @throws Exception
* if topNavigationElement is not found
*/
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
if (Browser.isAlertPresent()) {
@@ -73,15 +73,15 @@ public void logout() throws Exception {
public void searchForProcesses() throws Exception {
desktopPage.searchInSearchField("process");
int numberOfResults = searchResultPage.getNumberOfResults();
- assertEquals("There should be two processes found", 2, numberOfResults);
+ assertEquals(2, numberOfResults, "There should be two processes found");
searchResultPage.searchInSearchField("Second");
await("Wait for visible search results").atMost(20, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
- () -> assertEquals("There should be two processes found", 2, searchResultPage.getNumberOfResults()));
+ () -> assertEquals(2, searchResultPage.getNumberOfResults(), "There should be two processes found"));
searchResultPage.searchInSearchField("möhö");
await("Wait for visible search results").atMost(20, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
- () -> assertEquals("There should be no processes found", 0, searchResultPage.getNumberOfResults()));
+ () -> assertEquals(0, searchResultPage.getNumberOfResults(), "There should be no processes found"));
}
@Test
@@ -89,13 +89,11 @@ public void searchForProcessesAndSort() throws Exception {
desktopPage.searchInSearchField("process");
searchResultPage.clickTitleColumnForSorting();
- assertEquals("First process should be top result when sorting by title", "First process",
- searchResultPage.getFirstSearchResultProcessTitle());
+ assertEquals("First process", searchResultPage.getFirstSearchResultProcessTitle(), "First process should be top result when sorting by title");
searchResultPage.clickTitleColumnForSorting();
- assertEquals("Second process should be top result when reverse-sorting by title", "Second process",
- searchResultPage.getFirstSearchResultProcessTitle());
+ assertEquals("Second process", searchResultPage.getFirstSearchResultProcessTitle(), "Second process should be top result when reverse-sorting by title");
}
@Test
@@ -104,16 +102,16 @@ public void testExtendedSearch() throws Exception {
processesPage.navigateToExtendedSearch();
SearchingST.extendedSearchPage.searchById("2");
await("Wait for visible search results").atMost(20, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
- () -> assertEquals("There should be one processes found", 1, processesPage.countListedProcesses()));
+ () -> assertEquals(1, processesPage.countListedProcesses(), "There should be one processes found"));
List processTitles = processesPage.getProcessTitles();
- assertEquals("Wrong process found", "Second process", processTitles.get(0));
+ assertEquals("Second process", processTitles.get(0), "Wrong process found");
processesPage.navigateToExtendedSearch();
processesPage = SearchingST.extendedSearchPage.seachByTaskStatus();
await("Wait for visible search results").atMost(20, TimeUnit.SECONDS).ignoreExceptions().untilAsserted(
- () -> assertEquals("There should be one process found", 1, processesPage.countListedProcesses()));
+ () -> assertEquals(1, processesPage.countListedProcesses(), "There should be one process found"));
processTitles = processesPage.getProcessTitles();
- assertEquals("Wrong process found", "Second process", processTitles.get(0));
+ assertEquals("Second process", processTitles.get(0), "Wrong process found");
}
/**
@@ -122,7 +120,7 @@ public void testExtendedSearch() throws Exception {
@Test
public void caseInsensitiveSearchForProcesses() throws Exception {
desktopPage.searchInSearchField("PrOCeSs");
- assertEquals("Two processes should match case-insensitive search", 2, searchResultPage.getNumberOfResults());
+ assertEquals(2, searchResultPage.getNumberOfResults(), "Two processes should match case-insensitive search");
}
/**
@@ -138,9 +136,8 @@ public void caseInsensitiveFilterTaskStatus() throws Exception {
.atMost(10, TimeUnit.SECONDS).ignoreExceptions()
.untilAsserted(() -> {
List processTitles = processesPage.getProcessTitles();
- assertEquals("Case insensitive filter should match only one process", 1, processTitles.size());
- assertEquals("Case insensitive filter should match \"First process\"", "First process",
- processTitles.get(0));
+ assertEquals(1, processTitles.size(), "Case insensitive filter should match only one process");
+ assertEquals("First process", processTitles.get(0), "Case insensitive filter should match \"First process\"");
});
}
@@ -152,11 +149,10 @@ public void addAndRemoveFilters() throws Exception {
processesPage.goTo();
processesPage.applyFilter("\"id:to be removed\"");
processesPage.applyFilter("\"project:Example Project\"");
- assertEquals("Number of parsed filters does not match", 2, processesPage.getParsedFilters().size());
+ assertEquals(2, processesPage.getParsedFilters().size(), "Number of parsed filters does not match");
processesPage.removeParsedFilter(0);
- assertEquals("Number of parsed filters does not match after removing filter", 1,
- processesPage.getParsedFilters().size());
+ assertEquals(1, processesPage.getParsedFilters().size(), "Number of parsed filters does not match after removing filter");
}
/**
@@ -168,14 +164,14 @@ public void filterTasksTest() throws Exception {
tasksPage.typeCharactersIntoFilter("i");
List suggestions = tasksPage.getSuggestions();
- assertEquals("Displayed wrong number of suggestions for input \"i\"", 1, suggestions.size());
- assertEquals("Displayed wrong suggestion for input \"i\"", "id:", suggestions.get(0).getText());
+ assertEquals(1, suggestions.size(), "Displayed wrong number of suggestions for input \"i\"");
+ assertEquals("id:", suggestions.get(0).getText(), "Displayed wrong suggestion for input \"i\"");
tasksPage.selectSuggestion(0);
- assertEquals("Filter input value is wrong", "id:", tasksPage.getFilterInputValue());
+ assertEquals("id:", tasksPage.getFilterInputValue(), "Filter input value is wrong");
tasksPage.typeCharactersIntoFilter("1");
tasksPage.submitFilter();
- assertEquals("Task list does not match filter", 2, tasksPage.countListedTasks());
+ assertEquals(2, tasksPage.countListedTasks(), "Task list does not match filter");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/TasksSortingST.java b/Kitodo/src/test/java/org/kitodo/selenium/TasksSortingST.java
index 4f02f43a1de..41037a2179e 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/TasksSortingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/TasksSortingST.java
@@ -11,20 +11,19 @@
package org.kitodo.selenium;
-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 org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.kitodo.selenium.testframework.BaseTestSelenium;
import org.kitodo.selenium.testframework.Pages;
import org.kitodo.selenium.testframework.pages.TasksPage;
-
/**
* Tests the task list for various requirements related to sorting it.
*/
@@ -35,17 +34,17 @@ public class TasksSortingST extends BaseTestSelenium {
private static TasksPage tasksPage;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
tasksPage = Pages.getTasksPage();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
}
@@ -59,11 +58,11 @@ public void sortByTaskTitle() throws Exception {
tasksPage.goTo();
// default first task title is "Next Open"
- assertEquals("Default task sort should be ascending by title", "Next Open", tasksPage.getFirstRowTaskTitle());
+ assertEquals("Next Open", tasksPage.getFirstRowTaskTitle(), "Default task sort should be ascending by title");
// first click on title column triggers reverse order such that top task is "Progress"
tasksPage.clickTaskTableColumnHeaderForSorting(2);
- assertEquals("Reverse order by task title not correct", "Progress", tasksPage.getFirstRowTaskTitle());
+ assertEquals("Progress", tasksPage.getFirstRowTaskTitle(), "Reverse order by task title not correct");
}
/**
@@ -76,12 +75,11 @@ public void sortByTaskProcessTitle() throws Exception {
// first click process top task "Progress" or "Open"
tasksPage.clickTaskTableColumnHeaderForSorting(3);
- assertTrue("Sorting tasks by process title not correct", tasksPage.getFirstRowTaskTitle().matches("Progress|Open"));
+ assertTrue(tasksPage.getFirstRowTaskTitle().matches("Progress|Open"), "Sorting tasks by process title not correct");
tasksPage.clickTaskTableColumnHeaderForSorting(3);
// second click process header top task "Processed and Some" or "Next Open"
- assertTrue("Reverse-sorting tasks by process title not correct",
- tasksPage.getFirstRowTaskTitle().matches("Processed and Some|Next Open"));
+ assertTrue(tasksPage.getFirstRowTaskTitle().matches("Processed and Some|Next Open"), "Reverse-sorting tasks by process title not correct");
}
/**
@@ -94,10 +92,10 @@ public void sortByTaskStatus() throws Exception {
// first click on status header should have top task "Progress" or "Processed Some" (both having the same status)
tasksPage.clickTaskTableColumnHeaderForSorting(4);
- assertTrue("Sorting tasks by status not correct", tasksPage.getFirstRowTaskTitle().matches("Progress|Processed Some"));
+ assertTrue(tasksPage.getFirstRowTaskTitle().matches("Progress|Processed Some"), "Sorting tasks by status not correct");
// second click on status header should have top task "Open" or "Next Open" (both having the same status)
tasksPage.clickTaskTableColumnHeaderForSorting(4);
- assertTrue("Sorting tasks by status not correct", tasksPage.getFirstRowTaskTitle().matches("Open|Next Open"));
+ assertTrue(tasksPage.getFirstRowTaskTitle().matches("Open|Next Open"), "Sorting tasks by status not correct");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/WorkingST.java b/Kitodo/src/test/java/org/kitodo/selenium/WorkingST.java
index a5c8778748f..a829655858e 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/WorkingST.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/WorkingST.java
@@ -11,18 +11,18 @@
package org.kitodo.selenium;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.File;
import org.apache.commons.lang3.SystemUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.data.database.beans.Task;
import org.kitodo.data.database.enums.TaskStatus;
@@ -34,14 +34,14 @@
import org.kitodo.selenium.testframework.pages.TasksPage;
import org.kitodo.production.services.ServiceManager;
-@Ignore
+@Disabled
public class WorkingST extends BaseTestSelenium {
private static CurrentTasksEditPage currentTasksEditPage;
private static ProcessesPage processesPage;
private static TasksPage tasksPage;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception {
MockDatabase.stopNode();
MockDatabase.cleanDatabase();
@@ -53,12 +53,12 @@ public static void setup() throws Exception {
tasksPage = Pages.getTasksPage();
}
- @Before
+ @BeforeEach
public void login() throws Exception {
Pages.getLoginPage().goTo().performLoginAsAdmin();
}
- @After
+ @AfterEach
public void logout() throws Exception {
Pages.getTopNavigation().logout();
if (Browser.isAlertPresent()) {
@@ -66,39 +66,39 @@ public void logout() throws Exception {
}
}
- @Ignore
+ @Disabled
@Test
public void takeOpenTaskAndGiveItBackTest() throws Exception {
Task task = ServiceManager.getTaskService().getById(9);
- assertEquals("Task cannot be taken by user!", TaskStatus.OPEN, task.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, task.getProcessingStatus(), "Task cannot be taken by user!");
tasksPage.goTo().takeOpenTask("Open", "First process");
- assertTrue("Redirection after click take task was not successful", currentTasksEditPage.isAt());
+ assertTrue(currentTasksEditPage.isAt(), "Redirection after click take task was not successful");
task = ServiceManager.getTaskService().getById(9);
- assertEquals("Task was not taken by user!", TaskStatus.INWORK, task.getProcessingStatus());
+ assertEquals(TaskStatus.INWORK, task.getProcessingStatus(), "Task was not taken by user!");
currentTasksEditPage.releaseTask();
- assertTrue("Redirection after click release task was not successful", tasksPage.isAt());
+ assertTrue(tasksPage.isAt(), "Redirection after click release task was not successful");
task = ServiceManager.getTaskService().getById(9);
- assertEquals("Task was not released by user!", TaskStatus.OPEN, task.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, task.getProcessingStatus(), "Task was not released by user!");
}
- @Ignore
+ @Disabled
@Test
public void editOwnedTaskTest() throws Exception {
assumeTrue(!SystemUtils.IS_OS_WINDOWS && !SystemUtils.IS_OS_MAC);
Task task = ServiceManager.getTaskService().getById(12);
tasksPage.goTo().editOwnedTask(task.getTitle(), task.getProcess().getTitle());
- assertTrue("Redirection after click edit own task was not successful", currentTasksEditPage.isAt());
+ assertTrue(currentTasksEditPage.isAt(), "Redirection after click edit own task was not successful");
currentTasksEditPage.closeTask();
- assertTrue("Redirection after click close task was not successful", tasksPage.isAt());
+ assertTrue(tasksPage.isAt(), "Redirection after click close task was not successful");
task = ServiceManager.getTaskService().getById(12);
- assertEquals("Task was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task was not closed!");
}
@Test
@@ -107,40 +107,35 @@ public void editOwnedTaskAndTakeNextForParallelWorkflowTest() throws Exception {
Task task = ServiceManager.getTaskService().getById(19);
tasksPage.editOwnedTask(task.getTitle(), task.getProcess().getTitle());
- assertTrue("Redirection after click edit own task was not successful", currentTasksEditPage.isAt());
+ assertTrue(currentTasksEditPage.isAt(), "Redirection after click edit own task was not successful");
currentTasksEditPage.closeTask();
- assertTrue("Redirection after click close task was not successful", tasksPage.isAt());
+ assertTrue(tasksPage.isAt(), "Redirection after click close task was not successful");
task = ServiceManager.getTaskService().getById(19);
- assertEquals("Task '" + task.getTitle() + "' was not closed!", TaskStatus.DONE, task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not closed!");
task = ServiceManager.getTaskService().getById(20);
- assertEquals("Task '" + task.getTitle() + "' cannot be taken by user!", TaskStatus.OPEN,
- task.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, task.getProcessingStatus(), "Task '" + task.getTitle() + "' cannot be taken by user!");
task = ServiceManager.getTaskService().getById(21);
- assertEquals("Task '" + task.getTitle() + "' can be taken by user!", TaskStatus.DONE,
- task.getProcessingStatus());
+ assertEquals(TaskStatus.DONE, task.getProcessingStatus(), "Task '" + task.getTitle() + "' can be taken by user!");
task = ServiceManager.getTaskService().getById(22);
- assertEquals("Task '" + task.getTitle() + "' cannot be taken by user!", TaskStatus.OPEN,
- task.getProcessingStatus());
+ assertEquals(TaskStatus.OPEN, task.getProcessingStatus(), "Task '" + task.getTitle() + "' cannot be taken by user!");
tasksPage.takeOpenTask("Task4", "Parallel");
- assertTrue("Redirection after click take task was not successful", currentTasksEditPage.isAt());
+ assertTrue(currentTasksEditPage.isAt(), "Redirection after click take task was not successful");
task = ServiceManager.getTaskService().getById(22);
- assertEquals("Task '" + task.getTitle() + "' was not taken by user!", TaskStatus.INWORK,
- task.getProcessingStatus());
+ assertEquals(TaskStatus.INWORK, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not taken by user!");
task = ServiceManager.getTaskService().getById(20);
- assertEquals("Task '" + task.getTitle() + "' was not blocked after concurrent task was taken by user!",
- TaskStatus.LOCKED, task.getProcessingStatus());
+ assertEquals(TaskStatus.LOCKED, task.getProcessingStatus(), "Task '" + task.getTitle() + "' was not blocked after concurrent task was taken by user!");
}
@Test
public void downloadDocketTest() throws Exception {
processesPage.goTo().downloadDocket();
- assertTrue("Docket file was not downloaded", new File(Browser.DOWNLOAD_DIR + "Second__process.pdf").exists());
+ assertTrue(new File(Browser.DOWNLOAD_DIR + "Second__process.pdf").exists(), "Docket file was not downloaded");
}
@Test
@@ -149,7 +144,7 @@ public void downloadLogTest() throws Exception {
processesPage.goTo().downloadLog();
File logFile = new File("src/test/resources/users/kowal/Second__process_log.xml");
- assertTrue("Log file was not downloaded", logFile.exists());
+ assertTrue(logFile.exists(), "Log file was not downloaded");
logFile.delete();
}
@@ -157,19 +152,18 @@ public void downloadLogTest() throws Exception {
@Test
public void editMetadataTest() throws Exception {
processesPage.goTo().editSecondProcessMetadata();
- assertTrue("Redirection after click edit metadata was not successful", Pages.getMetadataEditorPage().isAt());
+ assertTrue(Pages.getMetadataEditorPage().isAt(), "Redirection after click edit metadata was not successful");
}
@Test
public void downloadSearchResultAsExcelTest() throws Exception {
processesPage.goTo().downloadSearchResultAsExcel();
- assertTrue("Search result excel file was not downloaded",
- new File(Browser.DOWNLOAD_DIR + "search.xls").exists());
+ assertTrue(new File(Browser.DOWNLOAD_DIR + "search.xls").exists(), "Search result excel file was not downloaded");
}
@Test
public void downloadSearchResultAsPdfTest() throws Exception {
processesPage.goTo().downloadSearchResultAsPdf();
- assertTrue("Search result pdf file was not downloaded", new File(Browser.DOWNLOAD_DIR + "search.pdf").exists());
+ assertTrue(new File(Browser.DOWNLOAD_DIR + "search.pdf").exists(), "Search result pdf file was not downloaded");
}
}
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/BaseTestSelenium.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/BaseTestSelenium.java
index b474d88ec88..a81be0edceb 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/BaseTestSelenium.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/BaseTestSelenium.java
@@ -16,8 +16,8 @@
import org.apache.commons.lang3.SystemUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.kitodo.ExecutionPermission;
import org.kitodo.FileLoader;
import org.kitodo.MockDatabase;
@@ -29,7 +29,7 @@ public class BaseTestSelenium {
private static final Logger logger = LogManager.getLogger(BaseTestSelenium.class);
private static final File usersDirectory = new File("src/test/resources/users");
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
MockDatabase.startNode();
MockDatabase.insertProcessesFull();
@@ -50,7 +50,7 @@ public static void setUp() throws Exception {
Browser.Initialize();
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
try {
Browser.close();
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/CalendarPage.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/CalendarPage.java
index b726147de99..4b379bd85e6 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/CalendarPage.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/CalendarPage.java
@@ -12,7 +12,7 @@
package org.kitodo.selenium.testframework.pages;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import java.util.Objects;
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java
index c7af6400aed..f13552386c5 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/ProjectsPage.java
@@ -12,7 +12,7 @@
package org.kitodo.selenium.testframework.pages;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.kitodo.selenium.testframework.Browser.getCellsOfRow;
import static org.kitodo.selenium.testframework.Browser.getRowsOfTable;
import static org.kitodo.selenium.testframework.Browser.getTableDataByColumn;
diff --git a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/TasksPage.java b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/TasksPage.java
index ce685271918..0a72af430c6 100644
--- a/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/TasksPage.java
+++ b/Kitodo/src/test/java/org/kitodo/selenium/testframework/pages/TasksPage.java
@@ -12,7 +12,7 @@
package org.kitodo.selenium.testframework.pages;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.kitodo.selenium.testframework.Browser.getRowsOfTable;
import static org.kitodo.selenium.testframework.Browser.getTableDataByColumn;
import static org.kitodo.selenium.testframework.Browser.scrollWebElementIntoView;
diff --git a/Kitodo/src/test/java/test/DBConnectionTestIT.java b/Kitodo/src/test/java/test/DBConnectionTestIT.java
index 46456e39192..ed541b4dc64 100644
--- a/Kitodo/src/test/java/test/DBConnectionTestIT.java
+++ b/Kitodo/src/test/java/test/DBConnectionTestIT.java
@@ -11,22 +11,23 @@
package test;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.kitodo.MockDatabase;
import org.kitodo.production.services.ServiceManager;
public class DBConnectionTestIT {
- @BeforeClass
+ @BeforeAll
public static void prepareDatabase() throws Exception {
MockDatabase.startNode();
MockDatabase.insertProcessesFull();
}
- @AfterClass
+ @AfterAll
public static void cleanDatabase() throws Exception {
MockDatabase.stopNode();
MockDatabase.cleanDatabase();
@@ -35,9 +36,9 @@ public static void cleanDatabase() throws Exception {
@Test
public void test() throws Exception {
long counted = ServiceManager.getProcessService().count();
- Assert.assertEquals("No Process found", 3, counted);
+ assertEquals(3, counted, "No Process found");
String title = ServiceManager.getProcessService().getById(3).getTitle();
- Assert.assertEquals("DBConnectionTest", title);
+ assertEquals("DBConnectionTest", title);
}
}
diff --git a/Kitodo/src/test/java/test/MockitoTest.java b/Kitodo/src/test/java/test/MockitoTest.java
index f7f1b84ffbd..fdf5a8853bd 100644
--- a/Kitodo/src/test/java/test/MockitoTest.java
+++ b/Kitodo/src/test/java/test/MockitoTest.java
@@ -11,6 +11,7 @@
package test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
@@ -18,17 +19,16 @@
import java.util.Arrays;
import java.util.List;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.kitodo.data.database.beans.Process;
import org.kitodo.production.converter.ProcessConverter;
import org.kitodo.production.services.data.ProcessService;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public class MockitoTest {
private static Process process1;
@@ -40,7 +40,7 @@ public class MockitoTest {
@Mock
private ProcessConverter mockedProcessConverter;
- @BeforeClass
+ @BeforeAll
public static void setUp() {
process1 = new Process();
process1.setTitle("testProcess1");
@@ -54,13 +54,13 @@ public void testMock() throws Exception {
when(mockedProcessService.getAll()).thenReturn(Arrays.asList(process1, process2));
List allProcesses = mockedProcessService.getAll();
Process testProcess = allProcesses.get(1);
- Assert.assertEquals("testProcess2", testProcess.getTitle());
+ assertEquals("testProcess2", testProcess.getTitle());
}
@Test
public void testGenericMock() {
when(mockedProcessConverter.getAsObject(eq(null), eq(null), any(String.class))).thenReturn(process2);
Object object = mockedProcessConverter.getAsObject(null, null, "1");
- Assert.assertEquals(process2, object);
+ assertEquals(process2, object);
}
}