From 0c92564bdbc05baf8624a7c2db8476374491e565 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 7 Jun 2022 23:40:31 +0400 Subject: [PATCH] fix tests --- build.gradle | 14 +++++--------- src/main/resources/config.properties | 8 ++++++++ src/test/java/{ => ru/ulstu}/DbStoreTest.java | 2 ++ src/test/java/{ => ru/ulstu}/FileStoreTest.java | 2 ++ src/test/java/{ => ru/ulstu}/UserServiceTest.java | 3 ++- 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 src/main/resources/config.properties rename src/test/java/{ => ru/ulstu}/DbStoreTest.java (97%) rename src/test/java/{ => ru/ulstu}/FileStoreTest.java (97%) rename src/test/java/{ => ru/ulstu}/UserServiceTest.java (95%) diff --git a/build.gradle b/build.gradle index a303593..8e7c0bf 100644 --- a/build.gradle +++ b/build.gradle @@ -31,16 +31,12 @@ dependencies { implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jetty' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation' + implementation group: 'org.springframework.boot', name: 'spring-boot-starter-test' implementation group: 'org.slf4j', name: 'slf4j-api', version: versionSLF4J implementation group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect', version: '3.1.0' - testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: '1.7.4' - testImplementation group: 'org.powermock', name: 'powermock-api-mockito', version: '1.7.4' - testImplementation group: 'org.powermock', name: 'powermock-api-mockito-common', version: '1.7.4' - testImplementation group: 'org.mockito', name: 'mockito-all', version: '1.10.19' - testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test' -} - -test { - useJUnitPlatform() + implementation group: 'org.powermock', name: 'powermock-module-junit4', version: '1.7.4' + implementation group: 'org.powermock', name: 'powermock-api-mockito', version: '1.7.4' + implementation group: 'org.powermock', name: 'powermock-api-mockito-common', version: '1.7.4' + implementation group: 'org.mockito', name: 'mockito-all', version: '1.10.19' } \ No newline at end of file diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties new file mode 100644 index 0000000..56c009f --- /dev/null +++ b/src/main/resources/config.properties @@ -0,0 +1,8 @@ +# Possible values: file or db +targetStorage=file +fileStorage=test-users.json +dbHost=localhost +dbName=unit-test +dbPort=5432 +dbUser=postgres +dbPassword=postgres \ No newline at end of file diff --git a/src/test/java/DbStoreTest.java b/src/test/java/ru/ulstu/DbStoreTest.java similarity index 97% rename from src/test/java/DbStoreTest.java rename to src/test/java/ru/ulstu/DbStoreTest.java index 43105ab..286e204 100644 --- a/src/test/java/DbStoreTest.java +++ b/src/test/java/ru/ulstu/DbStoreTest.java @@ -1,3 +1,5 @@ +package ru.ulstu; + import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/src/test/java/FileStoreTest.java b/src/test/java/ru/ulstu/FileStoreTest.java similarity index 97% rename from src/test/java/FileStoreTest.java rename to src/test/java/ru/ulstu/FileStoreTest.java index be72c4f..316d89e 100644 --- a/src/test/java/FileStoreTest.java +++ b/src/test/java/ru/ulstu/FileStoreTest.java @@ -1,3 +1,5 @@ +package ru.ulstu; + import org.junit.After; import org.junit.Assert; import org.junit.Before; diff --git a/src/test/java/UserServiceTest.java b/src/test/java/ru/ulstu/UserServiceTest.java similarity index 95% rename from src/test/java/UserServiceTest.java rename to src/test/java/ru/ulstu/UserServiceTest.java index a783c9e..7356d3e 100644 --- a/src/test/java/UserServiceTest.java +++ b/src/test/java/ru/ulstu/UserServiceTest.java @@ -1,8 +1,9 @@ +package ru.ulstu; + import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; -import ru.ulstu.UserService; import ru.ulstu.entity.User; import ru.ulstu.exception.UserNotValidException; import ru.ulstu.persistence.FileStore;