diff --git a/pom.xml b/pom.xml index cdb607ef9f1260dda3997d5b7188014b63921b64..2cd2cbef0b7c40ff554711fd4ae028f64a427246 100644 --- a/pom.xml +++ b/pom.xml @@ -248,17 +248,17 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>org.junit.vintage</groupId> - <artifactId>junit-vintage-engine</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-core</artifactId> - </exclusion> - </exclusions> - </dependency> +<!-- <dependency>--> +<!-- <groupId>org.junit.vintage</groupId>--> +<!-- <artifactId>junit-vintage-engine</artifactId>--> +<!-- <scope>test</scope>--> +<!-- <exclusions>--> +<!-- <exclusion>--> +<!-- <groupId>org.hamcrest</groupId>--> +<!-- <artifactId>hamcrest-core</artifactId>--> +<!-- </exclusion>--> +<!-- </exclusions>--> +<!-- </dependency>--> </dependencies> <build> diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/CategoryServiceTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/CategoryServiceTest.java index 25995796176a08af27d4d8e556f1c9f92b3c975e..566fbc0e7dbe049ff15f060455d1cd4089a4aa56 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/CategoryServiceTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/CategoryServiceTest.java @@ -5,12 +5,12 @@ import de.deadlocker8.budgetmaster.categories.CategoryRepository; import de.deadlocker8.budgetmaster.categories.CategoryService; import de.deadlocker8.budgetmaster.categories.CategoryType; import de.deadlocker8.budgetmaster.unit.helpers.LocalizedTest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.ArrayList; import java.util.List; @@ -18,9 +18,9 @@ import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @LocalizedTest -public class CategoryServiceTest +class CategoryServiceTest { private static final Category CATEGORY_NONE = new Category("No Category", "#FFFFFF", CategoryType.NONE); private static final Category CATEGORY_REST = new Category("Rest", "#FFFF00", CategoryType.REST); @@ -32,7 +32,7 @@ public class CategoryServiceTest private CategoryService categoryService; @Test - public void test_getAllCategories() + void test_getAllCategories() { List<Category> categories = new ArrayList<>(); categories.add(CATEGORY_NONE); @@ -71,7 +71,7 @@ public class CategoryServiceTest } @Test - public void test_createDefaults() + void test_createDefaults() { categoryService.createDefaults(); @@ -81,7 +81,7 @@ public class CategoryServiceTest } @Test - public void test_isDeletable_default() + void test_isDeletable_default() { Mockito.when(categoryRepository.findById(1)).thenReturn(Optional.of(CATEGORY_NONE)); @@ -89,7 +89,7 @@ public class CategoryServiceTest } @Test - public void test_isDeletable_custom() + void test_isDeletable_custom() { Category customCategory = new Category("aa", "#ff0000", CategoryType.CUSTOM); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/IconServiceTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/IconServiceTest.java index 096d9b728ed74d93e2a5a1354df62a733c33aeb8..9a4a00c1d4b6b4eaf4e586bd4f37949851e55095 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/IconServiceTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/IconServiceTest.java @@ -7,25 +7,25 @@ import de.deadlocker8.budgetmaster.categories.CategoryType; import de.deadlocker8.budgetmaster.icon.Icon; import de.deadlocker8.budgetmaster.icon.IconRepository; import de.deadlocker8.budgetmaster.icon.IconService; -import de.deadlocker8.budgetmaster.images.*; +import de.deadlocker8.budgetmaster.images.Image; +import de.deadlocker8.budgetmaster.images.ImageFileExtension; +import de.deadlocker8.budgetmaster.images.ImageRepository; import de.deadlocker8.budgetmaster.templates.Template; import de.deadlocker8.budgetmaster.unit.helpers.LocalizedTest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; - -import java.util.List; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @LocalizedTest -public class IconServiceTest +class IconServiceTest { @Mock private IconRepository iconRepository; @@ -37,14 +37,14 @@ public class IconServiceTest private IconService iconService; @Test - public void test_deleteIcon_null() + void test_deleteIcon_null() { iconService.deleteIcon(null); Mockito.verify(iconRepository, Mockito.never()).delete(Mockito.any()); } @Test - public void test_deleteIcon_withReferringAccount() + void test_deleteIcon_withReferringAccount() { final Icon icon = Mockito.spy(new Icon("fas fa-icons")); final Account account = Mockito.spy(new Account("account with icon", AccountType.CUSTOM, icon)); @@ -57,7 +57,7 @@ public class IconServiceTest } @Test - public void test_deleteIcon_withReferringTemplate() + void test_deleteIcon_withReferringTemplate() { final Icon icon = Mockito.spy(new Icon("fas fa-icons")); @@ -75,7 +75,7 @@ public class IconServiceTest } @Test - public void test_deleteIcon_withReferringCategory() + void test_deleteIcon_withReferringCategory() { final Icon icon = Mockito.spy(new Icon("fas fa-icons")); @@ -89,14 +89,14 @@ public class IconServiceTest } @Test - public void test_createIconReference_empty() + void test_createIconReference_empty() { assertThat(iconService.createIconReference(null, null)) .isEmpty(); } @Test - public void test_createIconReference_builtinIcon() + void test_createIconReference_builtinIcon() { final String builtinIdentifier = "fas fa-icons"; assertThat(iconService.createIconReference(null, builtinIdentifier)) @@ -106,7 +106,7 @@ public class IconServiceTest } @Test - public void test_createIconReference_imageIcon() + void test_createIconReference_imageIcon() { final Image image = new Image(new Byte[0], "awesomeIcon.png", ImageFileExtension.PNG); image.setID(12); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/IconizableTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/IconizableTest.java index a35316c095f739e680c97f4958b3801c7fd5e9e5..64f8ec349e42909e6dbc285fa424e2d3d1f3c4f5 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/IconizableTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/IconizableTest.java @@ -6,28 +6,24 @@ import de.deadlocker8.budgetmaster.accounts.AccountType; import de.deadlocker8.budgetmaster.icon.Icon; import de.deadlocker8.budgetmaster.icon.IconRepository; import de.deadlocker8.budgetmaster.icon.IconService; -import de.deadlocker8.budgetmaster.images.ImageRepository; import de.deadlocker8.budgetmaster.unit.helpers.LocalizedTest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @LocalizedTest -public class IconizableTest +class IconizableTest { @Mock private IconRepository iconRepository; - @Mock - private ImageRepository imageRepository; - @Mock private AccountService accountService; @@ -35,7 +31,7 @@ public class IconizableTest private IconService iconService; @Test - public void test_updateIcon_noExistingItem_noNewIcon() + void test_updateIcon_noExistingItem_noNewIcon() { final Account account = Mockito.spy(new Account("account with icon", AccountType.CUSTOM)); @@ -49,7 +45,7 @@ public class IconizableTest } @Test - public void test_updateIcon_noExistingItem_newBuiltinIcon() + void test_updateIcon_noExistingItem_newBuiltinIcon() { final Account account = Mockito.spy(new Account("account with icon", AccountType.CUSTOM)); @@ -69,7 +65,7 @@ public class IconizableTest } @Test - public void test_updateIcon_existingItem_newBuiltinIcon() + void test_updateIcon_existingItem_newBuiltinIcon() { final String builtinIdentifier = "fas fa-icons"; final Icon icon = new Icon(builtinIdentifier); @@ -91,7 +87,7 @@ public class IconizableTest } @Test - public void test_updateIcon_existingItem_noNewIcon() + void test_updateIcon_existingItem_noNewIcon() { final Icon icon = new Icon("fas fa-icons"); final Account account = new Account("account with icon", AccountType.CUSTOM, icon); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/ImageServiceTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/ImageServiceTest.java index 331b00f16a5bbcd0450e79890c5d1dd69987e3cf..32f891af48a01489d611ddcfc49297e9f7d739f0 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/ImageServiceTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/ImageServiceTest.java @@ -1,17 +1,14 @@ package de.deadlocker8.budgetmaster.unit; import de.deadlocker8.budgetmaster.images.*; -import de.deadlocker8.budgetmaster.transactions.TransactionRepository; -import de.deadlocker8.budgetmaster.transactions.TransactionService; import de.deadlocker8.budgetmaster.unit.helpers.LocalizedTest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.verification.VerificationMode; import org.springframework.mock.web.MockMultipartFile; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; @@ -19,9 +16,9 @@ import java.io.IOException; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @LocalizedTest -public class ImageServiceTest +class ImageServiceTest { @Mock private ImageRepository imageRepository; @@ -30,34 +27,34 @@ public class ImageServiceTest private ImageService imageService; @Test - public void test_getFileExtension_valid() + void test_getFileExtension_valid() { assertThat(ImageService.getFileExtension("abc.png")).isNotEmpty() .get().isEqualTo("png"); } @Test - public void test_getFileExtension_validUppercase() + void test_getFileExtension_validUppercase() { assertThat(ImageService.getFileExtension("abc.PNG")).isNotEmpty() .get().isEqualTo("png"); } @Test - public void test_getFileExtension_validMultipleDots() + void test_getFileExtension_validMultipleDots() { assertThat(ImageService.getFileExtension("abc.jpeg.png")).isNotEmpty() .get().isEqualTo("png"); } @Test - public void test_getFileExtension_noDot() + void test_getFileExtension_noDot() { assertThat(ImageService.getFileExtension("abc")).isEmpty(); } @Test - public void test_saveImageFile_noFileExtension() + void test_saveImageFile_noFileExtension() { final MultipartFile multipartFile = new MockMultipartFile("abc", "abc", "text/plain", new byte[0]); @@ -66,7 +63,7 @@ public class ImageServiceTest } @Test - public void test_saveImageFile_invalidFileExtension() + void test_saveImageFile_invalidFileExtension() { final MultipartFile multipartFile = new MockMultipartFile("abc.pdf", "abc.pdf", "text/plain", new byte[0]); @@ -75,7 +72,7 @@ public class ImageServiceTest } @Test - public void test_saveImageFile_valid() throws IOException, InvalidFileExtensionException + void test_saveImageFile_valid() throws IOException, InvalidFileExtensionException { final MultipartFile multipartFile = new MockMultipartFile("abc.png", "abc.png", "text/plain", new byte[0]); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionSearchSpecificationsTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionSearchSpecificationsTest.java index 3443d602576d82a34a847c0a96ca6f46df50d89e..04045e2bbc78d6aaaf9c61cdd91bf808a19ce81c 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionSearchSpecificationsTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionSearchSpecificationsTest.java @@ -19,22 +19,22 @@ import de.deadlocker8.budgetmaster.transactions.TransactionRepository; import de.deadlocker8.budgetmaster.transactions.TransactionSearchSpecifications; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.data.jpa.domain.Specification; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.ArrayList; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @DataJpaTest -public class TransactionSearchSpecificationsTest +class TransactionSearchSpecificationsTest { @Autowired private TransactionRepository transactionRepository; @@ -64,7 +64,7 @@ public class TransactionSearchSpecificationsTest private RepeatingOptionRepository repeatingOptionRepository; private RepeatingOption repeatingOption; - @Before + @BeforeEach public void init() { account = accountRepository.save(new Account("TestAccount", AccountType.CUSTOM)); @@ -137,7 +137,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_OnlyName() + void getMatches_OnlyName() { Search search = new Search("Test", true, false, false, false, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -148,7 +148,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_PartialName() + void getMatches_PartialName() { Search search = new Search("es", true, false, false, false, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -159,7 +159,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_IgnoreCase() + void getMatches_IgnoreCase() { Search search = new Search("tEST", true, true, true, true, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -170,7 +170,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_OnlyDescription() + void getMatches_OnlyDescription() { Search search = new Search("What", true, true, true, true, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -181,7 +181,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_OnlyCategory() + void getMatches_OnlyCategory() { Search search = new Search(category2.getName(), false, false, true, false, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -193,7 +193,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_Order() + void getMatches_Order() { Search search = new Search("", true, true, true, true, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -207,7 +207,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_Mixed() + void getMatches_Mixed() { Search search = new Search("e", true, true, true, true, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -220,7 +220,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_NoMatches() + void getMatches_NoMatches() { Search search = new Search("asuzgdzasuiduzasds", true, true, true, true, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -230,7 +230,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_SearchNothing() + void getMatches_SearchNothing() { Search search = new Search("egal", false, false, false, false, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -240,7 +240,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_SearchTagsEquals() + void getMatches_SearchTagsEquals() { Search search = new Search("MyAwesomeTag", false, false, false, true, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -251,7 +251,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_SearchTagsLike() + void getMatches_SearchTagsLike() { Search search = new Search("Awesome", false, false, false, true, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); @@ -262,7 +262,7 @@ public class TransactionSearchSpecificationsTest } @Test - public void getMatches_IgnoreTransactionsFromHiddenAccounts() + void getMatches_IgnoreTransactionsFromHiddenAccounts() { Search search = new Search("hidden", true, false, false, false, 0); Specification spec = TransactionSearchSpecifications.withDynamicQuery(search); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionServiceTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionServiceTest.java index f68e41f1f6498743de60492c0140f829ec404056..6c8c094771526d439833010d1b4b49ac6f7bf286 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionServiceTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionServiceTest.java @@ -8,20 +8,20 @@ import de.deadlocker8.budgetmaster.transactions.Transaction; import de.deadlocker8.budgetmaster.transactions.TransactionRepository; import de.deadlocker8.budgetmaster.transactions.TransactionService; import de.deadlocker8.budgetmaster.unit.helpers.LocalizedTest; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @LocalizedTest -public class TransactionServiceTest +class TransactionServiceTest { private static final Category CATEGORY_REST = new Category("Rest", "#FFFF00", CategoryType.REST); private static final Category CATEGORY_CUSTOM = new Category("CustomCategory", "#0F0F0F", CategoryType.CUSTOM); @@ -35,7 +35,7 @@ public class TransactionServiceTest private TransactionService transactionService; @Test - public void test_isDeletable_rest() + void test_isDeletable_rest() { Transaction transactionRest = new Transaction(); transactionRest.setID(1); @@ -51,7 +51,7 @@ public class TransactionServiceTest } @Test - public void test_isDeletable_custom() + void test_isDeletable_custom() { Transaction transaction = new Transaction(); transaction.setID(1); @@ -67,7 +67,7 @@ public class TransactionServiceTest } @Test - public void test_handleAmount_null() + void test_handleAmount_null() { Transaction transaction = new Transaction(); transaction.setAmount(null); @@ -80,7 +80,7 @@ public class TransactionServiceTest } @Test - public void test_handleAmount_expenditure() + void test_handleAmount_expenditure() { Transaction transaction = new Transaction(); transaction.setAmount(500); @@ -93,7 +93,7 @@ public class TransactionServiceTest } @Test - public void test_handleAmount_income() + void test_handleAmount_income() { Transaction transaction = new Transaction(); transaction.setAmount(-500); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionSpecificationsTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionSpecificationsTest.java index e76ae91d0e0fbc7a74e4697ea2e876315bd95893..67d848d4a5b5cb4d162863156c3798e27e7db59e 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionSpecificationsTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/TransactionSpecificationsTest.java @@ -18,22 +18,22 @@ import de.deadlocker8.budgetmaster.transactions.TransactionRepository; import de.deadlocker8.budgetmaster.transactions.TransactionSpecifications; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.data.jpa.domain.Specification; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.ArrayList; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @DataJpaTest -public class TransactionSpecificationsTest +class TransactionSpecificationsTest { @Autowired private TransactionRepository transactionRepository; @@ -68,8 +68,7 @@ public class TransactionSpecificationsTest private DateTime startDate = new DateTime(2018, 1, 1, 12, 0, 0, 0); - - @Before + @BeforeEach public void init() { account = accountRepository.save(new Account("TestAccount", AccountType.CUSTOM)); @@ -151,7 +150,7 @@ public class TransactionSpecificationsTest } @Test - public void getIncomesAndExpendituresAndTransfers() + void getIncomesAndExpendituresAndTransfers() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, true, true, true, null, List.of(), List.of(), null); @@ -164,7 +163,7 @@ public class TransactionSpecificationsTest } @Test - public void getIncomesAndExpenditures() + void getIncomesAndExpenditures() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, true, true, false, null, List.of(), List.of(), null); @@ -176,7 +175,7 @@ public class TransactionSpecificationsTest } @Test - public void getIncomes() + void getIncomes() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, true, false, false, null, List.of(), List.of(), null); @@ -186,7 +185,7 @@ public class TransactionSpecificationsTest } @Test - public void getExpenditures() + void getExpenditures() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, false, true, false, null, List.of(), List.of(), null); @@ -197,7 +196,7 @@ public class TransactionSpecificationsTest } @Test - public void getTransfers() + void getTransfers() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, false, false, true, null, List.of(), List.of(), null); @@ -207,7 +206,7 @@ public class TransactionSpecificationsTest } @Test - public void incomesAndExpendituresFalse() + void incomesAndExpendituresFalse() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, false, false, false, null, List.of(), List.of(), null); @@ -219,7 +218,7 @@ public class TransactionSpecificationsTest } @Test - public void getTransferBackReferences_NoReferences() + void getTransferBackReferences_NoReferences() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, true, false, true, null, List.of(), List.of(), null); @@ -229,7 +228,7 @@ public class TransactionSpecificationsTest } @Test - public void getTransferBackReferences() + void getTransferBackReferences() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account2, false, false, true, null, List.of(), List.of(), null); @@ -240,7 +239,7 @@ public class TransactionSpecificationsTest } @Test - public void getTransferBackReferences_WithStartDate() + void getTransferBackReferences_WithStartDate() { DateTime startDate2019 = new DateTime(2019, 1, 1, 12, 0, 0, 0); Specification spec = TransactionSpecifications.withDynamicQuery(startDate2019, DateTime.now(), account2, false, false, true, null, List.of(), List.of(), null); @@ -250,7 +249,7 @@ public class TransactionSpecificationsTest } @Test - public void getRepeating() + void getRepeating() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, true, true, false, true, List.of(), List.of(), null); @@ -260,7 +259,7 @@ public class TransactionSpecificationsTest } @Test - public void noRepeating() + void noRepeating() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, true, true, true, false, List.of(), List.of(), null); @@ -272,7 +271,7 @@ public class TransactionSpecificationsTest } @Test - public void noMatchingCategory() + void noMatchingCategory() { List<Integer> categoryIDs = new ArrayList<>(); categoryIDs.add(categoryUnused.getID()); @@ -283,7 +282,7 @@ public class TransactionSpecificationsTest } @Test - public void getByCategory() + void getByCategory() { List<Integer> categoryIDs = new ArrayList<>(); categoryIDs.add(category1.getID()); @@ -296,7 +295,7 @@ public class TransactionSpecificationsTest } @Test - public void getByFullName() + void getByFullName() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, true, true, true, null, List.of(), List.of(), "Repeating"); @@ -306,7 +305,7 @@ public class TransactionSpecificationsTest } @Test - public void getByPartialName() + void getByPartialName() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account, true, true, true, null, List.of(), List.of(), "tin"); @@ -316,7 +315,7 @@ public class TransactionSpecificationsTest } @Test - public void getByPartialName_ExcludeTransfersWithWrongAccount() + void getByPartialName_ExcludeTransfersWithWrongAccount() { Specification spec = TransactionSpecifications.withDynamicQuery(startDate, DateTime.now(), account2, true, true, true, null, List.of(), List.of(), "tion"); @@ -326,7 +325,7 @@ public class TransactionSpecificationsTest } @Test - public void getByTags() + void getByTags() { List<Integer> tagIDs = new ArrayList<>(); tagIDs.add(tag1.getID()); @@ -339,7 +338,7 @@ public class TransactionSpecificationsTest } @Test - public void getByMultipleTags() + void getByMultipleTags() { List<Integer> tagIDs = new ArrayList<>(); tagIDs.add(tag1.getID()); @@ -355,7 +354,7 @@ public class TransactionSpecificationsTest @Test - public void getByUnusedTags() + void getByUnusedTags() { List<Integer> tagIDs = new ArrayList<>(); tagIDs.add(tagUnused.getID()); @@ -367,7 +366,7 @@ public class TransactionSpecificationsTest } @Test - public void getRepeatingExpenditureByCategoryAndTagsAndName() + void getRepeatingExpenditureByCategoryAndTagsAndName() { List<Integer> categoryIDs = new ArrayList<>(); categoryIDs.add(category1.getID()); @@ -384,7 +383,7 @@ public class TransactionSpecificationsTest } @Test - public void getFromAllAccountsExceptTransfersWithSpecificEndDate() + void getFromAllAccountsExceptTransfersWithSpecificEndDate() { DateTime endDate = new DateTime(2018, 11, 30, 12, 0, 0, 0); Specification spec = TransactionSpecifications.withDynamicQuery(startDate, endDate, null, true, true, false, null, List.of(), List.of(), null); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/backup/LocalGitBackupTaskTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/backup/LocalGitBackupTaskTest.java index 40d456ff4da11c12187c56a9eb1e15a19c1cea7a..235e73b6111f2c1a30659d10af03c87cfd70883f 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/backup/LocalGitBackupTaskTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/backup/LocalGitBackupTaskTest.java @@ -13,15 +13,14 @@ import de.deadlocker8.budgetmaster.settings.SettingsService; import de.deadlocker8.budgetmaster.unit.helpers.Helpers; import de.thecodelabs.utils.util.OS; import org.joda.time.DateTimeUtils; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.io.IOException; import java.nio.file.Files; @@ -31,8 +30,8 @@ import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) -public class LocalGitBackupTaskTest +@ExtendWith(SpringExtension.class) +class LocalGitBackupTaskTest { @Mock private DatabaseService databaseService; @@ -40,13 +39,13 @@ public class LocalGitBackupTaskTest @Mock private SettingsService settingsService; - @Rule - public final TemporaryFolder tempFolder = new TemporaryFolder(); + @TempDir + public Path tempFolder; private static String gitExecutable; - @BeforeClass + @BeforeAll public static void setup() { if(OS.isWindows()) @@ -61,14 +60,14 @@ public class LocalGitBackupTaskTest DateTimeUtils.setCurrentMillisFixed(1612004400000L); } - @AfterClass + @AfterAll public static void cleanup() { DateTimeUtils.setCurrentMillisSystem(); } @Test - public void test_needsCleanup() + void test_needsCleanup() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_LOCAL); @@ -79,12 +78,12 @@ public class LocalGitBackupTaskTest } @Test - public void test_runBackup_repositoryNotExisting() throws IOException + void test_runBackup_repositoryNotExisting() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_LOCAL); - final Path repositoryFolder = tempFolder.newFolder().toPath().resolve(".git"); + final Path repositoryFolder = tempFolder.resolve(".git"); final LocalGitBackupTask localGitBackupTask = new LocalGitBackupTask(databaseService, settingsService); localGitBackupTask.setGitFolder(repositoryFolder); @@ -96,12 +95,12 @@ public class LocalGitBackupTaskTest } @Test - public void test_runBackup_firstCommit() throws IOException + void test_runBackup_firstCommit() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_LOCAL); - final Path repositoryFolder = tempFolder.newFolder().toPath().resolve(".git"); + final Path repositoryFolder = tempFolder.resolve(".git"); final BackupDatabase_v7 database = new BackupDatabase_v7(); Mockito.when(databaseService.getDatabaseForJsonSerialization()).thenReturn(database); @@ -124,12 +123,12 @@ public class LocalGitBackupTaskTest } @Test - public void test_runBackup_fileNotChanged() throws IOException + void test_runBackup_fileNotChanged() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_LOCAL); - final Path repositoryFolder = tempFolder.newFolder().toPath().resolve(".git"); + final Path repositoryFolder = tempFolder.resolve(".git"); final BackupDatabase_v7 database = new BackupDatabase_v7(); Mockito.when(databaseService.getDatabaseForJsonSerialization()).thenReturn(database); @@ -148,12 +147,12 @@ public class LocalGitBackupTaskTest } @Test - public void test_runBackup_fileChanged() throws IOException + void test_runBackup_fileChanged() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_LOCAL); - final Path repositoryFolder = tempFolder.newFolder().toPath().resolve(".git"); + final Path repositoryFolder = tempFolder.resolve(".git"); final BackupDatabase_v7 database = new BackupDatabase_v7(); Mockito.when(databaseService.getDatabaseForJsonSerialization()).thenReturn(database); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/backup/RemoteGitBackupTaskTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/backup/RemoteGitBackupTaskTest.java index 3f495e2e8c8f3ce07078fe9466e558446508de98..f9dd50270a3c4738f608337ec16c92bb952e471b 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/backup/RemoteGitBackupTaskTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/backup/RemoteGitBackupTaskTest.java @@ -13,24 +13,24 @@ import de.deadlocker8.budgetmaster.settings.SettingsService; import de.deadlocker8.budgetmaster.unit.helpers.Helpers; import de.thecodelabs.utils.util.OS; import org.joda.time.DateTimeUtils; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) -public class RemoteGitBackupTaskTest +@ExtendWith(SpringExtension.class) +class RemoteGitBackupTaskTest { @Mock private DatabaseService databaseService; @@ -38,13 +38,13 @@ public class RemoteGitBackupTaskTest @Mock private SettingsService settingsService; - @Rule - public final TemporaryFolder tempFolder = new TemporaryFolder(); + @TempDir + public Path tempFolder; private static String gitExecutable; - @BeforeClass + @BeforeAll public static void setup() { if(OS.isWindows()) @@ -59,14 +59,14 @@ public class RemoteGitBackupTaskTest DateTimeUtils.setCurrentMillisFixed(1612004400000L); } - @AfterClass + @AfterAll public static void cleanup() { DateTimeUtils.setCurrentMillisSystem(); } @Test - public void test_needsCleanup_false_everythingEquals() + void test_needsCleanup_false_everythingEquals() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_REMOTE); @@ -82,7 +82,7 @@ public class RemoteGitBackupTaskTest } @Test - public void test_needsCleanup_false_onlyNameChanged() + void test_needsCleanup_false_onlyNameChanged() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_REMOTE); @@ -104,7 +104,7 @@ public class RemoteGitBackupTaskTest } @Test - public void test_needsCleanup_true_urlChanged() + void test_needsCleanup_true_urlChanged() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_REMOTE); @@ -127,7 +127,7 @@ public class RemoteGitBackupTaskTest } @Test - public void test_needsCleanup_true_branchNameChanged() + void test_needsCleanup_true_branchNameChanged() { final Settings previousSettings = Settings.getDefault(); previousSettings.setAutoBackupStrategy(AutoBackupStrategy.GIT_REMOTE); @@ -150,11 +150,11 @@ public class RemoteGitBackupTaskTest } @Test - public void test_runBackup_firstCommit() throws IOException + void test_runBackup_firstCommit() throws IOException { // create fake server - final Path fakeServerFolder = tempFolder.newFolder("server").toPath(); - final Path repositoryFolder = tempFolder.newFolder().toPath().resolve(".git"); + final Path fakeServerFolder = Files.createDirectory(tempFolder.resolve("server")); + final Path repositoryFolder = Files.createDirectory(tempFolder.resolve("client")).resolve(".git"); final RemoteGitBackupTask remoteGitBackupTask = createBackupTask(repositoryFolder, fakeServerFolder); remoteGitBackupTask.run(); @@ -185,11 +185,11 @@ public class RemoteGitBackupTaskTest } @Test - public void test_runBackup_fileNotChanged() throws IOException + void test_runBackup_fileNotChanged() throws IOException { // create fake server - final Path fakeServerFolder = tempFolder.newFolder("server").toPath(); - final Path repositoryFolder = tempFolder.newFolder().toPath().resolve(".git"); + final Path fakeServerFolder = Files.createDirectory(tempFolder.resolve("server")); + final Path repositoryFolder = Files.createDirectory(tempFolder.resolve("client")).resolve(".git"); final RemoteGitBackupTask remoteGitBackupTask = createBackupTask(repositoryFolder, fakeServerFolder); remoteGitBackupTask.run(); @@ -209,11 +209,11 @@ public class RemoteGitBackupTaskTest } @Test - public void test_runBackup_fileChanged() throws IOException + void test_runBackup_fileChanged() throws IOException { // create fake server - final Path fakeServerFolder = tempFolder.newFolder("server").toPath(); - final Path repositoryFolder = tempFolder.newFolder().toPath().resolve(".git"); + final Path fakeServerFolder = Files.createDirectory(tempFolder.resolve("server")); + final Path repositoryFolder = Files.createDirectory(tempFolder.resolve("client")).resolve(".git"); final RemoteGitBackupTask remoteGitBackupTask = createBackupTask(repositoryFolder, fakeServerFolder); remoteGitBackupTask.run(); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseExportTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseExportTest.java index 1a1be2de0cbbcebf7c85cae0eea75ba1222bc7eb..adb009aa412ac2378bdfadac22ceb39390a9feac 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseExportTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseExportTest.java @@ -38,15 +38,14 @@ import de.deadlocker8.budgetmaster.transactions.TransactionRepository; import de.deadlocker8.budgetmaster.transactions.TransactionService; import de.thecodelabs.utils.util.Localization; import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -58,10 +57,10 @@ import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) -public class DatabaseExportTest +@ExtendWith(SpringExtension.class) +class DatabaseExportTest { - @Before + @BeforeEach public void before() { Localization.setDelegate(new Localization.LocalizationDelegate() @@ -111,11 +110,11 @@ public class DatabaseExportTest @InjectMocks private DatabaseService databaseService; - @Rule - public final TemporaryFolder tempFolder = new TemporaryFolder(); + @TempDir + public Path tempFolder; @Test - public void test_specialFields() throws IOException + void test_specialFields() throws IOException { // categories Mockito.when(categoryService.getAllEntitiesAsc()).thenReturn(List.of()); @@ -152,7 +151,7 @@ public class DatabaseExportTest // act - Path exportPath = tempFolder.newFile("exportTest.json").toPath(); + Path exportPath = Files.createFile(tempFolder.resolve("exportTest.json")); databaseService.exportDatabase(exportPath); @@ -165,7 +164,7 @@ public class DatabaseExportTest } @Test - public void test_exportDatabase() throws IOException + void test_exportDatabase() throws IOException { // categories Category categoryNone = new Category("NONE", "#000000", CategoryType.NONE); @@ -271,7 +270,7 @@ public class DatabaseExportTest // act - Path exportPath = tempFolder.newFile("exportTest.json").toPath(); + Path exportPath = Files.createFile(tempFolder.resolve("exportTest.json")); databaseService.exportDatabase(exportPath); // assert diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParserTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParserTest.java index d514bd46eecff44c4a4cdf7d235f0f4c9c79a340..57b0debb6dc17a6ceb5c707e75507e60e8cf277f 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParserTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParserTest.java @@ -1,13 +1,13 @@ package de.deadlocker8.budgetmaster.unit.database; -import de.deadlocker8.budgetmaster.database.InternalDatabase; import de.deadlocker8.budgetmaster.database.DatabaseParser; +import de.deadlocker8.budgetmaster.database.InternalDatabase; import de.thecodelabs.utils.util.Localization; import de.thecodelabs.utils.util.Localization.LocalizationDelegate; import de.thecodelabs.utils.util.localization.LocalizationMessageFormatter; import de.thecodelabs.utils.util.localization.formatter.JavaMessageFormatter; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URISyntaxException; @@ -19,9 +19,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class DatabaseParserTest +class DatabaseParserTest { - @Before + @BeforeEach public void before() { Localization.setDelegate(new LocalizationDelegate() @@ -48,7 +48,7 @@ public class DatabaseParserTest } @Test - public void test_v6() throws URISyntaxException, IOException + void test_v6() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser importer = new DatabaseParser(json); @@ -58,7 +58,7 @@ public class DatabaseParserTest } @Test - public void test_v5() throws URISyntaxException, IOException + void test_v5() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v5Test.json").toURI()))); DatabaseParser importer = new DatabaseParser(json); @@ -68,7 +68,7 @@ public class DatabaseParserTest } @Test - public void test_v4() throws URISyntaxException, IOException + void test_v4() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v4Test.json").toURI()))); DatabaseParser importer = new DatabaseParser(json); @@ -78,7 +78,7 @@ public class DatabaseParserTest } @Test - public void test_v3() throws URISyntaxException, IOException + void test_v3() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v3Test.json").toURI()))); DatabaseParser importer = new DatabaseParser(json); @@ -88,7 +88,7 @@ public class DatabaseParserTest } @Test - public void test_v2() throws URISyntaxException, IOException + void test_v2() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("LegacyParserTest.json").toURI()))); DatabaseParser importer = new DatabaseParser(json); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v4Test.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v4Test.java index bd0b3a64fa42906942fb1ece72d06cca846729de..1bbbac3df1bc6d8ca11add71e43c7f0756e1c46c 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v4Test.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v4Test.java @@ -6,11 +6,10 @@ import de.deadlocker8.budgetmaster.database.DatabaseParser_v4; import de.deadlocker8.budgetmaster.database.model.v4.*; import de.deadlocker8.budgetmaster.repeating.endoption.RepeatingEndAfterXTimes; import de.deadlocker8.budgetmaster.repeating.modifier.RepeatingModifierDays; -import de.deadlocker8.budgetmaster.tags.Tag; import de.thecodelabs.utils.util.Localization; import de.thecodelabs.utils.util.Localization.LocalizationDelegate; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URISyntaxException; @@ -20,12 +19,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class DatabaseParser_v4Test +class DatabaseParser_v4Test { - @Before + @BeforeEach public void before() { Localization.setDelegate(new LocalizationDelegate() @@ -46,7 +46,7 @@ public class DatabaseParser_v4Test } @Test - public void test_Categories() + void test_Categories() { try { @@ -68,7 +68,7 @@ public class DatabaseParser_v4Test } @Test - public void test_Accounts() + void test_Accounts() { try { @@ -88,7 +88,7 @@ public class DatabaseParser_v4Test } @Test - public void test_Transactions() + void test_Transactions() { try { @@ -170,7 +170,7 @@ public class DatabaseParser_v4Test } @Test - public void test_Templates() + void test_Templates() { try { @@ -225,7 +225,7 @@ public class DatabaseParser_v4Test } @Test - public void test_convertToInternalShouldFail() throws URISyntaxException, IOException + void test_convertToInternalShouldFail() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v4Test.json").toURI()))); DatabaseParser_v4 parser = new DatabaseParser_v4(json); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v5Test.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v5Test.java index 962e4f50f94768a3a673495d362b1d4fad10f585..be2ff915b268f895b97777d844313cc88aeaadaa 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v5Test.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v5Test.java @@ -4,17 +4,19 @@ import de.deadlocker8.budgetmaster.accounts.AccountState; import de.deadlocker8.budgetmaster.accounts.AccountType; import de.deadlocker8.budgetmaster.categories.CategoryType; import de.deadlocker8.budgetmaster.charts.ChartType; -import de.deadlocker8.budgetmaster.database.DatabaseParser_v4; import de.deadlocker8.budgetmaster.database.DatabaseParser_v5; -import de.deadlocker8.budgetmaster.database.model.v4.*; +import de.deadlocker8.budgetmaster.database.model.v4.BackupRepeatingEndOption_v4; +import de.deadlocker8.budgetmaster.database.model.v4.BackupRepeatingModifier_v4; +import de.deadlocker8.budgetmaster.database.model.v4.BackupRepeatingOption_v4; +import de.deadlocker8.budgetmaster.database.model.v4.BackupTag_v4; import de.deadlocker8.budgetmaster.database.model.v5.*; import de.deadlocker8.budgetmaster.images.ImageFileExtension; import de.deadlocker8.budgetmaster.repeating.endoption.RepeatingEndAfterXTimes; import de.deadlocker8.budgetmaster.repeating.modifier.RepeatingModifierDays; import de.thecodelabs.utils.util.Localization; import de.thecodelabs.utils.util.Localization.LocalizationDelegate; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URISyntaxException; @@ -28,9 +30,9 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class DatabaseParser_v5Test +class DatabaseParser_v5Test { - @Before + @BeforeEach public void before() { Localization.setDelegate(new LocalizationDelegate() @@ -51,7 +53,7 @@ public class DatabaseParser_v5Test } @Test - public void test_Charts() + void test_Charts() { try { @@ -71,7 +73,7 @@ public class DatabaseParser_v5Test } @Test - public void test_Categories() + void test_Categories() { try { @@ -91,7 +93,7 @@ public class DatabaseParser_v5Test } @Test - public void test_Accounts() + void test_Accounts() { try { @@ -115,7 +117,7 @@ public class DatabaseParser_v5Test } @Test - public void test_Images() + void test_Images() { try { @@ -136,7 +138,7 @@ public class DatabaseParser_v5Test } @Test - public void test_Templates() + void test_Templates() { try { @@ -165,7 +167,7 @@ public class DatabaseParser_v5Test } @Test - public void test_Transactions() + void test_Transactions() { try { @@ -250,7 +252,7 @@ public class DatabaseParser_v5Test } } @Test - public void test_convertToInternalShouldFail() throws URISyntaxException, IOException + void test_convertToInternalShouldFail() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v5Test.json").toURI()))); DatabaseParser_v5 parser = new DatabaseParser_v5(json); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v6Test.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v6Test.java index 834d9ff0636b80d6c4ac07a8403cfc9caf433aea..c90e64c931661347c0309fd439aff6bae55e6989 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v6Test.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v6Test.java @@ -24,8 +24,8 @@ import de.deadlocker8.budgetmaster.repeating.endoption.RepeatingEndAfterXTimes; import de.deadlocker8.budgetmaster.repeating.modifier.RepeatingModifierDays; import de.thecodelabs.utils.util.Localization; import de.thecodelabs.utils.util.Localization.LocalizationDelegate; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URISyntaxException; @@ -38,9 +38,9 @@ import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; -public class DatabaseParser_v6Test +class DatabaseParser_v6Test { - @Before + @BeforeEach public void before() { Localization.setDelegate(new LocalizationDelegate() @@ -61,7 +61,7 @@ public class DatabaseParser_v6Test } @Test - public void test_Charts() throws URISyntaxException, IOException + void test_Charts() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); @@ -74,7 +74,7 @@ public class DatabaseParser_v6Test } @Test - public void test_Categories() throws URISyntaxException, IOException + void test_Categories() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); @@ -87,7 +87,7 @@ public class DatabaseParser_v6Test } @Test - public void test_Accounts() throws URISyntaxException, IOException + void test_Accounts() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); @@ -102,7 +102,7 @@ public class DatabaseParser_v6Test } @Test - public void test_Images() throws URISyntaxException, IOException + void test_Images() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); @@ -116,7 +116,7 @@ public class DatabaseParser_v6Test } @Test - public void test_Templates() throws URISyntaxException, IOException + void test_Templates() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); @@ -135,7 +135,7 @@ public class DatabaseParser_v6Test } @Test - public void test_Transactions() throws URISyntaxException, IOException + void test_Transactions() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); @@ -203,13 +203,13 @@ public class DatabaseParser_v6Test } @Test - public void test_Upgrade_Accounts() throws URISyntaxException, IOException + void test_Upgrade_Accounts() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); BackupDatabase_v6 database = parser.parseDatabaseFromJSON(); - final BackupDatabase_v7 upgradedDatabase = (BackupDatabase_v7)database.upgrade(); + final BackupDatabase_v7 upgradedDatabase = (BackupDatabase_v7) database.upgrade(); final BackupAccount_v7 upgradedAccount1 = new BackupAccount_v7(1, "Placeholder", AccountState.FULL_ACCESS, AccountType.ALL, null); final BackupAccount_v7 upgradedAccount2 = new BackupAccount_v7(2, "Default", AccountState.FULL_ACCESS, AccountType.CUSTOM, null); @@ -221,13 +221,13 @@ public class DatabaseParser_v6Test } @Test - public void test_Upgrade_Templates() throws URISyntaxException, IOException + void test_Upgrade_Templates() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); BackupDatabase_v6 database = parser.parseDatabaseFromJSON(); - final BackupDatabase_v7 upgradedDatabase = (BackupDatabase_v7)database.upgrade(); + final BackupDatabase_v7 upgradedDatabase = (BackupDatabase_v7) database.upgrade(); final BackupTemplate_v7 upgradedTemplate = new BackupTemplate_v7("Template with icon", null, true, null, null, null, null, 3, List.of(), null); @@ -238,13 +238,13 @@ public class DatabaseParser_v6Test } @Test - public void test_Upgrade_Categories() throws URISyntaxException, IOException + void test_Upgrade_Categories() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v6Test.json").toURI()))); DatabaseParser_v6 parser = new DatabaseParser_v6(json); BackupDatabase_v6 database = parser.parseDatabaseFromJSON(); - final BackupDatabase_v7 upgradedDatabase = (BackupDatabase_v7)database.upgrade(); + final BackupDatabase_v7 upgradedDatabase = (BackupDatabase_v7) database.upgrade(); final BackupCategory_v7 upgradedCategory = new BackupCategory_v7(3, "0815", "#ffcc00", CategoryType.CUSTOM, 0); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v7Test.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v7Test.java index 0595d4d97501e95c1eb14804952a071b62812df8..d238edb7e957a3ca81537d365c4b588d78cb21e5 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v7Test.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v7Test.java @@ -20,8 +20,8 @@ import de.deadlocker8.budgetmaster.repeating.endoption.RepeatingEndAfterXTimes; import de.deadlocker8.budgetmaster.repeating.modifier.RepeatingModifierDays; import de.thecodelabs.utils.util.Localization; import de.thecodelabs.utils.util.Localization.LocalizationDelegate; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URISyntaxException; @@ -34,9 +34,9 @@ import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; -public class DatabaseParser_v7Test +class DatabaseParser_v7Test { - @Before + @BeforeEach public void before() { Localization.setDelegate(new LocalizationDelegate() @@ -57,7 +57,7 @@ public class DatabaseParser_v7Test } @Test - public void test_Charts() throws URISyntaxException, IOException + void test_Charts() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v7Test.json").toURI()))); DatabaseParser_v7 parser = new DatabaseParser_v7(json); @@ -70,7 +70,7 @@ public class DatabaseParser_v7Test } @Test - public void test_Categories() throws URISyntaxException, IOException + void test_Categories() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v7Test.json").toURI()))); DatabaseParser_v7 parser = new DatabaseParser_v7(json); @@ -83,7 +83,7 @@ public class DatabaseParser_v7Test } @Test - public void test_Accounts() throws URISyntaxException, IOException + void test_Accounts() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v7Test.json").toURI()))); DatabaseParser_v7 parser = new DatabaseParser_v7(json); @@ -98,7 +98,7 @@ public class DatabaseParser_v7Test } @Test - public void test_Images() throws URISyntaxException, IOException + void test_Images() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v7Test.json").toURI()))); DatabaseParser_v7 parser = new DatabaseParser_v7(json); @@ -112,7 +112,7 @@ public class DatabaseParser_v7Test } @Test - public void test_Templates() throws URISyntaxException, IOException + void test_Templates() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v7Test.json").toURI()))); DatabaseParser_v7 parser = new DatabaseParser_v7(json); @@ -131,7 +131,7 @@ public class DatabaseParser_v7Test } @Test - public void test_Transactions() throws URISyntaxException, IOException + void test_Transactions() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v7Test.json").toURI()))); DatabaseParser_v7 parser = new DatabaseParser_v7(json); @@ -199,7 +199,7 @@ public class DatabaseParser_v7Test } @Test - public void test_Icons() throws URISyntaxException, IOException + void test_Icons() throws URISyntaxException, IOException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v7Test.json").toURI()))); DatabaseParser_v7 parser = new DatabaseParser_v7(json); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v7_convertToInternalTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v7_convertToInternalTest.java index c149decdd94e76542ccae30adf899bf64811f613..20ca98240a5895b5378ad4df953b44a17c8c15ea 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v7_convertToInternalTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseParser_v7_convertToInternalTest.java @@ -21,8 +21,8 @@ import de.thecodelabs.utils.util.Localization; import de.thecodelabs.utils.util.Localization.LocalizationDelegate; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.net.URISyntaxException; @@ -35,9 +35,9 @@ import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; -public class DatabaseParser_v7_convertToInternalTest +class DatabaseParser_v7_convertToInternalTest { - @Before + @BeforeEach public void before() { Localization.setDelegate(new LocalizationDelegate() @@ -58,7 +58,7 @@ public class DatabaseParser_v7_convertToInternalTest } @Test - public void test_Charts() + void test_Charts() { try { @@ -79,7 +79,7 @@ public class DatabaseParser_v7_convertToInternalTest } @Test - public void test_Categories() + void test_Categories() { try { @@ -103,7 +103,7 @@ public class DatabaseParser_v7_convertToInternalTest } @Test - public void test_Accounts() + void test_Accounts() { try { @@ -135,7 +135,7 @@ public class DatabaseParser_v7_convertToInternalTest } @Test - public void test_Images() + void test_Images() { try { @@ -159,7 +159,7 @@ public class DatabaseParser_v7_convertToInternalTest } @Test - public void test_Templates() + void test_Templates() { try { @@ -194,7 +194,7 @@ public class DatabaseParser_v7_convertToInternalTest } @Test - public void test_Transactions() + void test_Transactions() { try { @@ -297,7 +297,7 @@ public class DatabaseParser_v7_convertToInternalTest } @Test - public void test_Icons() throws IOException, URISyntaxException + void test_Icons() throws IOException, URISyntaxException { String json = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("DatabaseParser_v7Test.json").toURI()))); DatabaseParser_v7 importer = new DatabaseParser_v7(json); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseServiceTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseServiceTest.java index 869248796ebd33a021709ba7227ee89e219b6a7d..9a6b6bf620a9730a38224b1cca96b1e8bccfe78f 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseServiceTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/DatabaseServiceTest.java @@ -12,11 +12,11 @@ import de.deadlocker8.budgetmaster.tags.TagService; import de.deadlocker8.budgetmaster.transactions.TransactionService; import de.deadlocker8.budgetmaster.unit.helpers.LoggerTestUtil; import org.assertj.core.groups.Tuple; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.net.URISyntaxException; import java.nio.file.Path; @@ -27,8 +27,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; -@RunWith(SpringJUnit4ClassRunner.class) -public class DatabaseServiceTest +@ExtendWith(SpringExtension.class) +class DatabaseServiceTest { @Mock private AccountService accountService; @@ -49,7 +49,7 @@ public class DatabaseServiceTest private DatabaseService databaseService; @Test - public void test_determineFilesToDelete_unlimited() throws URISyntaxException + void test_determineFilesToDelete_unlimited() throws URISyntaxException { ListAppender<ILoggingEvent> loggingAppender = LoggerTestUtil.getListAppenderForClass(DatabaseService.class); @@ -68,7 +68,7 @@ public class DatabaseServiceTest } @Test - public void test_determineFilesToDelete_limitNotReached() throws URISyntaxException + void test_determineFilesToDelete_limitNotReached() throws URISyntaxException { ListAppender<ILoggingEvent> loggingAppender = LoggerTestUtil.getListAppenderForClass(DatabaseService.class); @@ -87,7 +87,7 @@ public class DatabaseServiceTest } @Test - public void test_determineFilesToDelete_limitReachedExactly() throws URISyntaxException + void test_determineFilesToDelete_limitReachedExactly() throws URISyntaxException { ListAppender<ILoggingEvent> loggingAppender = LoggerTestUtil.getListAppenderForClass(DatabaseService.class); @@ -109,7 +109,7 @@ public class DatabaseServiceTest } @Test - public void test_determineFilesToDelete_limitReached() throws URISyntaxException + void test_determineFilesToDelete_limitReached() throws URISyntaxException { ListAppender<ILoggingEvent> loggingAppender = LoggerTestUtil.getListAppenderForClass(DatabaseService.class); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/database/ImportServiceTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/database/ImportServiceTest.java index ef03fec4e568bb41b258f43ac6416ac9b1d3f112..769a074037758e7f6987fd37c8b5f04381f6b82e 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/database/ImportServiceTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/database/ImportServiceTest.java @@ -33,12 +33,12 @@ import de.deadlocker8.budgetmaster.transactions.Transaction; import de.deadlocker8.budgetmaster.transactions.TransactionBase; import de.deadlocker8.budgetmaster.transactions.TransactionRepository; import org.joda.time.DateTime; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.ArrayList; import java.util.List; @@ -46,8 +46,8 @@ import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) -public class ImportServiceTest +@ExtendWith(SpringExtension.class) +class ImportServiceTest { @Mock private CategoryRepository categoryRepository; @@ -80,7 +80,7 @@ public class ImportServiceTest private ImportService importService; @Test - public void test_updateCategoriesForTransactions() + void test_updateCategoriesForTransactions() { Category category1 = new Category("Category1", "#ff0000", CategoryType.CUSTOM); category1.setID(3); @@ -109,7 +109,7 @@ public class ImportServiceTest } @Test - public void test_updateCategoriesForTemplates() + void test_updateCategoriesForTemplates() { Category category1 = new Category("Category1", "#ff0000", CategoryType.CUSTOM); category1.setID(3); @@ -141,7 +141,7 @@ public class ImportServiceTest } @Test - public void test_removeAlreadyUpdatedTransactions() + void test_removeAlreadyUpdatedTransactions() { Category category1 = new Category("Category1", "#ff0000", CategoryType.CUSTOM); category1.setID(3); @@ -177,7 +177,7 @@ public class ImportServiceTest } @Test - public void test_updateAccountsForTransactions() + void test_updateAccountsForTransactions() { Account account1 = new Account("Account_1", AccountType.CUSTOM); account1.setID(2); @@ -208,7 +208,7 @@ public class ImportServiceTest } @Test - public void test_updateTransferAccountsForTransactions() + void test_updateTransferAccountsForTransactions() { Account account1 = new Account("Account_1", AccountType.CUSTOM); account1.setID(2); @@ -241,7 +241,7 @@ public class ImportServiceTest } @Test - public void test_updateAccountsForTemplates() + void test_updateAccountsForTemplates() { Account account1 = new Account("Account_1", AccountType.CUSTOM); account1.setID(2); @@ -275,7 +275,7 @@ public class ImportServiceTest } @Test - public void test_updateTransferAccountsForTemplates() + void test_updateTransferAccountsForTemplates() { Account account1 = new Account("Account_1", AccountType.CUSTOM); account1.setID(2); @@ -310,7 +310,7 @@ public class ImportServiceTest } @Test - public void test_updateTagsForItem_ExistingTag() + void test_updateTagsForItem_ExistingTag() { Account account1 = new Account("Account_1", AccountType.CUSTOM); account1.setID(2); @@ -337,7 +337,7 @@ public class ImportServiceTest } @Test - public void test_updateTagsForItem_NewTag() + void test_updateTagsForItem_NewTag() { Account account1 = new Account("Account_1", AccountType.CUSTOM); account1.setID(2); @@ -367,7 +367,7 @@ public class ImportServiceTest } @Test - public void test_importFullDatabase() + void test_importFullDatabase() { // source accounts Account sourceAccount1 = new Account("Source_Account_1", AccountType.CUSTOM); @@ -519,7 +519,7 @@ public class ImportServiceTest } @Test - public void test_chartId() + void test_chartId() { Chart chart = new Chart(); chart.setID(9); @@ -546,7 +546,7 @@ public class ImportServiceTest } @Test - public void test_updateImagesForIcons() + void test_updateImagesForIcons() { Image image1 = new Image(new Byte[0], "awesomeIcon.png", ImageFileExtension.PNG); image1.setID(3); @@ -567,7 +567,7 @@ public class ImportServiceTest } @Test - public void test_importImages_notExisting() + void test_importImages_notExisting() { Image image = new Image(new Byte[0], "awesomeIcon.png", ImageFileExtension.PNG); image.setID(3); @@ -587,7 +587,7 @@ public class ImportServiceTest } @Test - public void test_importImages_alreadyExisting() + void test_importImages_alreadyExisting() { Image image = new Image(new Byte[0], "awesomeIcon.png", ImageFileExtension.PNG); image.setID(3); @@ -607,7 +607,7 @@ public class ImportServiceTest } @Test - public void test_importAccounts_icon() + void test_importAccounts_icon() { Image image = new Image(new Byte[0], "awesomeIcon.png", ImageFileExtension.PNG); image.setID(3); @@ -645,7 +645,7 @@ public class ImportServiceTest } @Test - public void test_skipTemplates() + void test_skipTemplates() { Template template = new Template(); template.setTemplateName("myTemplate"); @@ -664,7 +664,7 @@ public class ImportServiceTest } @Test - public void test_skipCarts() + void test_skipCarts() { Chart chart = new Chart(); chart.setID(9); @@ -687,7 +687,7 @@ public class ImportServiceTest } @Test - public void test_errorWhileImportingCategory_shouldBeCollected() + void test_errorWhileImportingCategory_shouldBeCollected() { Category category1 = new Category("Category1", "#ff0000", CategoryType.CUSTOM); category1.setID(3); @@ -709,7 +709,7 @@ public class ImportServiceTest } @Test - public void test_updateIconsForAccounts() + void test_updateIconsForAccounts() { Image image1 = new Image(new Byte[0], "awesomeIcon.png", ImageFileExtension.PNG); image1.setID(3); diff --git a/src/test/java/de/deadlocker8/budgetmaster/unit/repeating/RepeatingOptionTest.java b/src/test/java/de/deadlocker8/budgetmaster/unit/repeating/RepeatingOptionTest.java index 12a64880ba26ad10987f6b76f0df8df3b66eda9f..f44b7e850eed3f2087f2b9aaf5f0161b672058e3 100644 --- a/src/test/java/de/deadlocker8/budgetmaster/unit/repeating/RepeatingOptionTest.java +++ b/src/test/java/de/deadlocker8/budgetmaster/unit/repeating/RepeatingOptionTest.java @@ -8,7 +8,7 @@ import de.deadlocker8.budgetmaster.repeating.modifier.RepeatingModifierDays; import de.deadlocker8.budgetmaster.repeating.modifier.RepeatingModifierMonths; import de.deadlocker8.budgetmaster.repeating.modifier.RepeatingModifierYears; import org.joda.time.DateTime; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -16,12 +16,12 @@ import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -public class RepeatingOptionTest +class RepeatingOptionTest { // test repeating every X days @Test - public void test_GetRepeatingDates_Every3Days_EndAfter3Times() + void test_GetRepeatingDates_Every3Days_EndAfter3Times() { DateTime startDate = new DateTime(2018, 4, 22, 12, 0); RepeatingOption repeatingOption = new RepeatingOption(startDate, @@ -41,7 +41,7 @@ public class RepeatingOptionTest } @Test - public void test_GetRepeatingDates_Every3Days_EndAfterDate() + void test_GetRepeatingDates_Every3Days_EndAfterDate() { DateTime startDate = new DateTime(2018, 4, 22, 12, 0); DateTime endDate = new DateTime(2018, 4, 28, 12, 0); @@ -61,7 +61,7 @@ public class RepeatingOptionTest } @Test - public void test_GetRepeatingDates_Every3Days_EndNever() + void test_GetRepeatingDates_Every3Days_EndNever() { DateTime startDate = new DateTime(2018, 4, 22, 12, 0); RepeatingOption repeatingOption = new RepeatingOption(startDate, @@ -83,7 +83,7 @@ public class RepeatingOptionTest // test repeating every X months @Test - public void test_GetRepeatingDates_Every2Month_EndAfter5Times() + void test_GetRepeatingDates_Every2Month_EndAfter5Times() { DateTime startDate = new DateTime(2018, 4, 30, 12, 0); RepeatingOption repeatingOption = new RepeatingOption(startDate, @@ -105,7 +105,7 @@ public class RepeatingOptionTest } @Test - public void test_GetRepeatingDates_Every2Month_EndAfterDate() + void test_GetRepeatingDates_Every2Month_EndAfterDate() { DateTime startDate = new DateTime(2018, 4, 30, 12, 0); DateTime endDate = new DateTime(2018, 9, 28, 12, 0); @@ -125,7 +125,7 @@ public class RepeatingOptionTest } @Test - public void test_GetRepeatingDates_Every2Month_EndNever() + void test_GetRepeatingDates_Every2Month_EndNever() { DateTime startDate = new DateTime(2018, 4, 30, 12, 0); RepeatingOption repeatingOption = new RepeatingOption(startDate, @@ -146,7 +146,7 @@ public class RepeatingOptionTest // test repeating every X years @Test - public void test_GetRepeatingDates_EveryYear_EndAfter2Times() + void test_GetRepeatingDates_EveryYear_EndAfter2Times() { DateTime startDate = new DateTime(2018, 4, 30, 12, 0); RepeatingOption repeatingOption = new RepeatingOption(startDate, @@ -165,7 +165,7 @@ public class RepeatingOptionTest } @Test - public void test_GetRepeatingDates_EveryYear_EndAfterDate() + void test_GetRepeatingDates_EveryYear_EndAfterDate() { DateTime startDate = new DateTime(2018, 4, 30, 12, 0); DateTime endDate = new DateTime(2019, 9, 28, 12, 0); @@ -184,7 +184,7 @@ public class RepeatingOptionTest } @Test - public void test_GetRepeatingDates_EveryYear_EndNever() + void test_GetRepeatingDates_EveryYear_EndNever() { DateTime startDate = new DateTime(2018, 4, 30, 12, 0); RepeatingOption repeatingOption = new RepeatingOption(startDate,