diff --git a/DriveBackup/pom.xml b/DriveBackup/pom.xml index 47c5aeeb..2826766a 100644 --- a/DriveBackup/pom.xml +++ b/DriveBackup/pom.xml @@ -149,6 +149,11 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.2 + @@ -236,5 +241,17 @@ minio 8.5.9 + + org.junit.jupiter + junit-jupiter + 5.10.2 + test + + + org.mockito + mockito-core + 4.11.0 + test + diff --git a/DriveBackup/src/test/java/ratismal/drivebackup/ExampleTest.java b/DriveBackup/src/test/java/ratismal/drivebackup/ExampleTest.java new file mode 100644 index 00000000..bc2dfb4b --- /dev/null +++ b/DriveBackup/src/test/java/ratismal/drivebackup/ExampleTest.java @@ -0,0 +1,25 @@ +package ratismal.drivebackup; + +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +class ExampleTest { + + @Test + void exampleWithMockito() { + @SuppressWarnings("unchecked") + List mockedList = mock(); + + when(mockedList.get(0)).thenReturn("first"); + + assertEquals("first", mockedList.get(0)); + + assertNull(mockedList.get(999)); + } +} \ No newline at end of file diff --git a/DriveBackup/src/test/resources/junit-platform.properties b/DriveBackup/src/test/resources/junit-platform.properties new file mode 100644 index 00000000..2d850769 --- /dev/null +++ b/DriveBackup/src/test/resources/junit-platform.properties @@ -0,0 +1,4 @@ +junit.jupiter.testmethod.order.default = org.junit.jupiter.api.MethodOrderer$Random +junit.jupiter.testclass.order.default = org.junit.jupiter.api.ClassOrderer$Random +junit.jupiter.execution.parallel.enabled = true +junit.jupiter.execution.parallel.mode.default = concurrent