Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • deadlocker8/BudgetMaster
1 result
Select Git revision
Loading items
Show changes
Showing
with 314 additions and 90 deletions
<#macro scripts>
<#import "/spring.ftl" as s>
<script src="<@s.url '/webjars/jquery/3.7.1/jquery.min.js'/>"></script>
<script src="<@s.url '/webjars/materializecss/1.0.0/js/materialize.min.js'/>"></script>
<script src="<@s.url '/webjars/mousetrap/1.6.5/mousetrap.js'/>"></script>
<script src="<@s.url '/webjars/jquery/jquery.min.js'/>"></script>
<script src="<@s.url '/webjars/materializecss/js/materialize.min.js'/>"></script>
<script src="<@s.url '/webjars/mousetrap/mousetrap.js'/>"></script>
<script>
rootURL = "<@s.url ''/>"
</script>
......
......@@ -109,7 +109,7 @@
<!-- Scripts-->
<#import "../helpers/scripts.ftl" as scripts>
<@scripts.scripts/>
<script src="<@s.url '/webjars/sortablejs/1.15.3/Sortable.min.js'/>"></script>
<script src="<@s.url '/webjars/sortablejs/Sortable.min.js'/>"></script>
<script src="<@s.url '/js/reports.js'/>"></script>
<script src="<@s.url '/js/globalDatePicker.js'/>"></script>
<script src="<@s.url '/js/filter.js'/>"></script>
......
......@@ -105,7 +105,7 @@
<!-- Scripts-->
<#import "../helpers/scripts.ftl" as scripts>
<@scripts.scripts/>
<script src="<@s.url '/webjars/vanilla-picker/2.12.3/dist/vanilla-picker.min.js'/>"></script>
<script src="<@s.url '/webjars/vanilla-picker/dist/vanilla-picker.min.js'/>"></script>
<script src="<@s.url '/js/helpers.js'/>"></script>
<script src="<@s.url '/js/transactions.js'/>"></script>
<script src="<@s.url '/js/templates.js'/>"></script>
......
......@@ -53,7 +53,7 @@
<#import "../helpers/scripts.ftl" as scripts>
<@scripts.scripts/>
<script src="<@s.url '/webjars/sortablejs/1.15.3/Sortable.min.js'/>"></script>
<script src="<@s.url '/webjars/sortablejs/Sortable.min.js'/>"></script>
<script src="<@s.url '/js/templates.js'/>"></script>
</@header.body>
</html>
\ No newline at end of file
......@@ -8,7 +8,7 @@
<@header.style "transactionImport"/>
<@header.style "collapsible"/>
<#import "/spring.ftl" as s>
<link rel="stylesheet" href="<@s.url '/webjars/datatables/2.1.0/css/dataTables.dataTables.min.css'/>"/>
<link rel="stylesheet" href="<@s.url '/webjars/datatables/css/dataTables.dataTables.min.css'/>"/>
</head>
<@header.body>
<#import "../helpers/navbar.ftl" as navbar>
......@@ -73,7 +73,7 @@
<!-- Scripts-->
<#import "../helpers/scripts.ftl" as scripts>
<@scripts.scripts/>
<script src="<@s.url '/webjars/datatables/2.1.0/js/dataTables.min.js'/>"></script>
<script src="<@s.url '/webjars/datatables/js/dataTables.min.js'/>"></script>
<script src="<@s.url '/js/transactionImport.js'/>"></script>
</@header.body>
</html>
......@@ -7,5 +7,5 @@ public class TestConstants
// empty
}
public static final String POSTGRES_VERSION = "postgres:17.0";
public static final String POSTGRES_VERSION = "postgres:17.4";
}
......@@ -45,15 +45,21 @@ class AccountTest extends SeleniumTestBase
// delete account "zzzz" if existing
driver.get(helper.getUrl() + "/accounts");
ensureHiddenAccountsAreIncludedInFilter();
List<WebElement> accountRows = driver.findElements(By.cssSelector(".account-container tr"));
for(WebElement row : accountRows)
{
final List<WebElement> columns = row.findElements(By.tagName("td"));
final String name = columns.get(2).getText();
if(columns.isEmpty())
{
continue;
}
final String name = columns.get(3).getText();
if(name.equals("zzzz"))
{
columns.get(4).findElements(By.tagName("a")).get(1).click();
columns.get(5).findElements(By.tagName("a")).get(1).click();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".modal-content h4"), "Delete Account"));
......@@ -90,6 +96,7 @@ class AccountTest extends SeleniumTestBase
// assert
assertThat(driver.getCurrentUrl()).endsWith("/accounts");
ensureHiddenAccountsAreIncludedInFilter();
accountRows = driver.findElements(By.cssSelector(".account-container tr"));
assertThat(accountRows).hasSize(numberOfAccountsBefore);
......@@ -119,15 +126,17 @@ class AccountTest extends SeleniumTestBase
// assert
assertThat(driver.getCurrentUrl()).endsWith("/accounts");
ensureHiddenAccountsAreIncludedInFilter();
List<WebElement> accountRows = driver.findElements(By.cssSelector(".account-container tr"));
assertThat(accountRows).hasSize(6);
assertAccountColumns(accountRows.get(0).findElements(By.tagName("td")), true, true, AccountState.FULL_ACCESS, "Default Account", "");
assertAccountColumns(accountRows.get(1).findElements(By.tagName("td")), true, false, AccountState.FULL_ACCESS, "DefaultAccount0815", "");
assertAccountColumns(accountRows.get(2).findElements(By.tagName("td")), false, false, AccountState.HIDDEN, "hidden account", "");
assertAccountColumns(accountRows.get(3).findElements(By.tagName("td")), false, false, AccountState.READ_ONLY, "read only account", "");
assertAccountColumns(accountRows.get(4).findElements(By.tagName("td")), true, false, AccountState.FULL_ACCESS, "sfsdf", "");
assertAccountColumns(accountRows.get(5).findElements(By.tagName("td")), false, false, AccountState.READ_ONLY, name, "");
assertThat(accountRows).hasSize(7);
assertAccountColumns(accountRows.get(1).findElements(By.tagName("td")), true, true, AccountState.FULL_ACCESS, "Default Account", "");
assertAccountColumns(accountRows.get(2).findElements(By.tagName("td")), true, false, AccountState.FULL_ACCESS, "DefaultAccount0815", "");
assertAccountColumns(accountRows.get(3).findElements(By.tagName("td")), false, false, AccountState.HIDDEN, "hidden account", "");
assertAccountColumns(accountRows.get(4).findElements(By.tagName("td")), false, false, AccountState.READ_ONLY, "read only account", "");
assertAccountColumns(accountRows.get(5).findElements(By.tagName("td")), true, false, AccountState.FULL_ACCESS, "sfsdf", "");
assertAccountColumns(accountRows.get(6).findElements(By.tagName("td")), false, false, AccountState.READ_ONLY, name, "");
}
@Test
......@@ -154,11 +163,12 @@ class AccountTest extends SeleniumTestBase
// assert
assertThat(driver.getCurrentUrl()).endsWith("/accounts");
ensureHiddenAccountsAreIncludedInFilter();
List<WebElement> accountRows = driver.findElements(By.cssSelector(".account-container tr"));
assertThat(accountRows).hasSize(6);
assertThat(accountRows).hasSize(7);
final WebElement icon = accountRows.get(5).findElements(By.tagName("td")).get(1);
final WebElement icon = accountRows.get(6).findElements(By.tagName("td")).get(0);
assertThat(icon).hasFieldOrPropertyWithValue("text", name.substring(0, 1).toUpperCase());
assertThat(icon.findElement(By.tagName("span")).getCssValue("color")).isEqualTo("rgb(255, 0, 0)");
}
......@@ -189,11 +199,12 @@ class AccountTest extends SeleniumTestBase
// assert
assertThat(driver.getCurrentUrl()).endsWith("/accounts");
ensureHiddenAccountsAreIncludedInFilter();
List<WebElement> accountRows = driver.findElements(By.cssSelector(".account-container tr"));
assertThat(accountRows).hasSize(6);
assertThat(accountRows).hasSize(7);
final WebElement icon = accountRows.get(5).findElements(By.tagName("td")).get(1);
final WebElement icon = accountRows.get(6).findElements(By.tagName("td")).get(0);
assertThat(icon.findElement(By.cssSelector("span i")).getAttribute("class")).isEqualTo("fas fa-address-book account-select-icon");
assertThat(icon.findElement(By.tagName("span")).getCssValue("color")).isEqualTo("rgb(255, 0, 0)");
}
......@@ -224,11 +235,12 @@ class AccountTest extends SeleniumTestBase
// assert
assertThat(driver.getCurrentUrl()).endsWith("/accounts");
ensureHiddenAccountsAreIncludedInFilter();
List<WebElement> accountRows = driver.findElements(By.cssSelector(".account-container tr"));
assertThat(accountRows).hasSize(6);
assertThat(accountRows).hasSize(7);
final WebElement icon = accountRows.get(5).findElements(By.tagName("td")).get(1);
final WebElement icon = accountRows.get(6).findElements(By.tagName("td")).get(0);
assertThat(icon.findElement(By.cssSelector("span img")).getAttribute("src")).startsWith(helper.getUrl() + "/media/getImageByIconID/");
}
......@@ -375,7 +387,7 @@ class AccountTest extends SeleniumTestBase
public static void assertAccountColumns(List<WebElement> columns, boolean isDefaultIconVisible, boolean isDefaultIconSelected, AccountState expectedAccountState, String name, String description)
{
// icons
final List<WebElement> icons = columns.get(0).findElements(By.tagName("i"));
final List<WebElement> icons = columns.get(1).findElements(By.tagName("i"));
int numberOfVisibleIcons = 0;
if(isDefaultIconVisible)
......@@ -414,10 +426,10 @@ class AccountTest extends SeleniumTestBase
assertThat(icons).hasSize(numberOfVisibleIcons);
// name
assertThat(columns.get(2)).hasFieldOrPropertyWithValue("text", name);
assertThat(columns.get(3)).hasFieldOrPropertyWithValue("text", name);
// description
assertThat(columns.get(3)).hasFieldOrPropertyWithValue("text", description);
assertThat(columns.get(4)).hasFieldOrPropertyWithValue("text", description);
}
private void setAccountState(int accountID, AccountState accountState)
......@@ -431,4 +443,17 @@ class AccountTest extends SeleniumTestBase
driver.findElement(By.id("button-save-account")).click();
}
private void ensureHiddenAccountsAreIncludedInFilter()
{
WebDriverWait wait;
final WebElement checkboxIncludeHidden = driver.findElement(By.name("includeHidden"));
if(!checkboxIncludeHidden.isSelected())
{
driver.findElement(By.id("includeHidden")).click();
driver.findElement(By.id("accounts-filter-button")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "Accounts"));
}
}
}
\ No newline at end of file
......@@ -235,12 +235,18 @@ class ChartTest extends SeleniumTestBase
assertThat(driver.findElement(By.id("filterActiveBadge")).isDisplayed()).isFalse();
driver.findElement(By.id("chart-filter-container")).click();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#chart-filter-container .collapsible-header")));
driver.findElement(By.id("section-type")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default")));
final WebElement checkBox = driver.findElement(By.cssSelector("#section-type .text-default"));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", checkBox);
checkBox.click();
final WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("filter-button-reset")));
assertThat(driver.findElement(By.id("filterActiveBadge")).isDisplayed()).isTrue();
......@@ -252,11 +258,15 @@ class ChartTest extends SeleniumTestBase
driver.get(helper.getUrl() + "/charts");
driver.findElement(By.id("chart-filter-container")).click();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#chart-filter-container .collapsible-header")));
driver.findElement(By.id("section-type")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default")));
final WebElement checkBox = driver.findElement(By.cssSelector("#section-type .text-default"));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", checkBox);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default")));
checkBox.click();
......@@ -279,7 +289,12 @@ class ChartTest extends SeleniumTestBase
wait.until(ExpectedConditions.attributeContains(By.cssSelector(chartPreviewSelector + " .chart-preview"), "class", "active"));
driver.findElement(By.id("chart-filter-container")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#chart-filter-container .collapsible-header")));
driver.findElement(By.id("section-type")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#section-type .text-default")));
final WebElement checkBox = driver.findElement(By.cssSelector("#section-type .text-default"));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", checkBox);
checkBox.click();
......
......@@ -14,6 +14,7 @@ import org.openqa.selenium.support.ui.WebDriverWait;
import java.io.File;
import java.time.Duration;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static org.assertj.core.api.Assertions.assertThat;
......
......@@ -45,8 +45,8 @@ class FilterTest extends SeleniumTestBase
driver.findElement(By.id("section-type")).click();
wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("#section-type .text-default")));
final WebElement checkBox = driver.findElements(By.cssSelector("#section-type .text-default")).get(0);
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#section-type .text-default")));
final WebElement checkBox = driver.findElements(By.cssSelector("#section-type .text-default")).getFirst();
checkBox.click();
driver.findElement(By.id("buttonApplyFilter")).click();
......
......@@ -43,18 +43,19 @@ class MediaTest extends SeleniumTestBase
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector(".headline"), "Accounts"));
List<WebElement> accountRows = driver.findElements(By.cssSelector(".account-container tr"));
assertThat(accountRows).hasSize(4);
assertThat(accountRows).hasSize(5);
checkImageLoaded(accountRows.get(0), "JPG");
checkImageLoaded(accountRows.get(1), "PNG");
checkImageLoaded(accountRows.get(2), "SVG");
// the first row is the table header
checkImageLoaded(accountRows.get(1), "JPG");
checkImageLoaded(accountRows.get(2), "PNG");
checkImageLoaded(accountRows.get(3), "SVG");
// the last account ist the default account created on database creation and has no image
}
private void checkImageLoaded(WebElement accountRow, String imageType)
{
final List<WebElement> columns = accountRow.findElements(By.tagName("td"));
final WebElement image = columns.get(1).findElement(By.className("account-select-icon"));
final WebElement image = columns.get(0).findElement(By.className("account-select-icon"));
Object result = ((JavascriptExecutor) driver).executeScript(
"return arguments[0].complete && " +
......
......@@ -37,6 +37,7 @@ class MiscSettingsTest extends SeleniumTestBase
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("miscSettingsContainer")));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#miscSettingsContainer button")));
driver.findElement(By.cssSelector("#miscSettingsContainer button")).click();
......
......@@ -17,6 +17,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
......@@ -50,6 +51,8 @@ class AccountServiceTest
private Account ACCOUNT_DEFAULT;
private Account ACCOUNT_PLACEHOLDER;
private Account ACCOUNT_NORMAL;
private Account ACCOUNT_NORMAL_2;
private Account ACCOUNT_NORMAL_3;
private Account ACCOUNT_READONLY;
private Account ACCOUNT_HIDDEN;
......@@ -66,6 +69,9 @@ class AccountServiceTest
ACCOUNT_NORMAL = new Account("Normal account", "awesome description", AccountType.CUSTOM, null);
ACCOUNT_NORMAL.setID(3);
ACCOUNT_NORMAL_2 = new Account("normal account", "", AccountType.CUSTOM, LocalDate.of(2025, 4, 7));
ACCOUNT_NORMAL_3 = new Account("123 account", "", AccountType.CUSTOM, null);
ACCOUNT_READONLY = new Account("Readonly account", "", AccountType.CUSTOM, null);
ACCOUNT_READONLY.setAccountState(AccountState.READ_ONLY);
......@@ -96,17 +102,14 @@ class AccountServiceTest
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
final Account accountNormal2 = new Account("normal account", "", AccountType.CUSTOM, null);
accounts.add(accountNormal2);
final Account accountNormal3 = new Account("123 account", "", AccountType.CUSTOM, null);
accounts.add(accountNormal3);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByType(AccountType.ALL)).thenReturn(List.of(ACCOUNT_PLACEHOLDER));
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
assertThat(accountService.getAllEntitiesAsc()).hasSize(6)
.containsExactly(ACCOUNT_PLACEHOLDER, accountNormal3, ACCOUNT_HIDDEN, ACCOUNT_NORMAL, accountNormal2, ACCOUNT_READONLY);
.containsExactly(ACCOUNT_PLACEHOLDER, ACCOUNT_NORMAL_3, ACCOUNT_HIDDEN, ACCOUNT_NORMAL, ACCOUNT_NORMAL_2, ACCOUNT_READONLY);
}
@Test
......@@ -114,17 +117,14 @@ class AccountServiceTest
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
final Account accountNormal2 = new Account("normal account", "", AccountType.CUSTOM, null);
accounts.add(accountNormal2);
final Account accountNormal3 = new Account("123 account", "", AccountType.CUSTOM, null);
accounts.add(accountNormal3);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByType(AccountType.ALL)).thenReturn(List.of(ACCOUNT_PLACEHOLDER));
Mockito.when(accountRepository.findAllByTypeAndAccountStateOrderByNameAsc(AccountType.CUSTOM, AccountState.FULL_ACCESS)).thenReturn(accounts);
assertThat(accountService.getAllActivatedAccountsAsc()).hasSize(4)
.containsExactly(ACCOUNT_PLACEHOLDER, accountNormal3, ACCOUNT_NORMAL, accountNormal2);
.containsExactly(ACCOUNT_PLACEHOLDER, ACCOUNT_NORMAL_3, ACCOUNT_NORMAL, ACCOUNT_NORMAL_2);
}
@Test
......@@ -132,18 +132,15 @@ class AccountServiceTest
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
final Account accountNormal2 = new Account("normal account", "", AccountType.CUSTOM, null);
accounts.add(accountNormal2);
final Account accountNormal3 = new Account("123 account", "", AccountType.CUSTOM, null);
accounts.add(accountNormal3);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByType(AccountType.ALL)).thenReturn(List.of(ACCOUNT_PLACEHOLDER));
Mockito.when(accountRepository.findAllByTypeAndAccountStateOrderByNameAsc(AccountType.CUSTOM, AccountState.FULL_ACCESS)).thenReturn(accounts);
Mockito.when(accountRepository.findAllByTypeAndAccountStateOrderByNameAsc(AccountType.CUSTOM, AccountState.READ_ONLY)).thenReturn(List.of(ACCOUNT_READONLY));
assertThat(accountService.getAllReadableAccounts()).hasSize(5)
.containsExactly(ACCOUNT_PLACEHOLDER, accountNormal3, ACCOUNT_NORMAL, accountNormal2, ACCOUNT_READONLY);
.containsExactly(ACCOUNT_PLACEHOLDER, ACCOUNT_NORMAL_3, ACCOUNT_NORMAL, ACCOUNT_NORMAL_2, ACCOUNT_READONLY);
}
@Test
......@@ -326,4 +323,166 @@ class AccountServiceTest
assertThat(accountService.getSelectedAccountOrDefaultAsFallback()).isEqualTo(ACCOUNT_DEFAULT);
}
@Test
void test_getFilteredEntitiesAsc_noAccounts()
{
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(List.of());
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(true, true, true, true, true, "", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration)).isEmpty();
}
@Test
void test_getFilteredEntitiesAsc_noFilter()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(true, true, true, true, true, "", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.containsExactly(ACCOUNT_NORMAL_3, ACCOUNT_HIDDEN, ACCOUNT_NORMAL, ACCOUNT_NORMAL_2, ACCOUNT_READONLY);
}
@Test
void test_getFilteredEntitiesAsc_onlyFullAccess()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(true, false, false, true, true, "", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.containsExactly(ACCOUNT_NORMAL_3, ACCOUNT_NORMAL, ACCOUNT_NORMAL_2);
}
@Test
void test_getFilteredEntitiesAsc_onlyReadOnly()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(false, true, false, true, true, "", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.containsExactly(ACCOUNT_READONLY);
}
@Test
void test_getFilteredEntitiesAsc_onlyHidden()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(false, false, true, true, true, "", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.containsExactly(ACCOUNT_HIDDEN);
}
@Test
void test_getFilteredEntitiesAsc_onlyWithEndDate()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(true, true, true, true, false, "", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.containsExactly(ACCOUNT_NORMAL_2);
}
@Test
void test_getFilteredEntitiesAsc_onlyWithoutEndDate()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(true, true, true, false, true, "", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.containsExactly(ACCOUNT_NORMAL_3, ACCOUNT_HIDDEN, ACCOUNT_NORMAL, ACCOUNT_READONLY);
}
@Test
void test_getFilteredEntitiesAsc_neitherWithNorWithoutEndDate()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(true, true, true, false, false, "", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.isEmpty();
}
@Test
void test_getFilteredEntitiesAsc_byName()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(true, true, true, true, true, "123", "");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.containsExactly(ACCOUNT_NORMAL_3);
}
@Test
void test_getFilteredEntitiesAsc_byDescription()
{
final List<Account> accounts = new ArrayList<>();
accounts.add(ACCOUNT_NORMAL);
accounts.add(ACCOUNT_READONLY);
accounts.add(ACCOUNT_HIDDEN);
accounts.add(ACCOUNT_NORMAL_2);
accounts.add(ACCOUNT_NORMAL_3);
Mockito.when(accountRepository.findAllByTypeOrderByNameAsc(AccountType.CUSTOM)).thenReturn(accounts);
final AccountsFilterConfiguration filterConfiguration = new AccountsFilterConfiguration(true, true, true, true, true, "", "awesome");
assertThat(accountService.getFilteredEntitiesAsc(filterConfiguration))
.containsExactly(ACCOUNT_NORMAL);
}
}
......@@ -153,7 +153,7 @@ class TransactionServiceDatabaseTest
LocalDate date1 = LocalDate.of(2020, 4, 30);
FilterConfiguration filterConfiguration = new FilterConfiguration(true, true, true, true, true, null, null, "");
List<Transaction> transactions = transactionService.getTransactionsForAccount(accountRepository.findByName("Second Account"), date1, LocalDate.now(), filterConfiguration);
List<Transaction> transactions = transactionService.getTransactionsForAccount(accountRepository.findByName("Second Account"), date1, LocalDate.now(), filterConfiguration, false);
assertThat(transactions)
.hasSize(2)
.containsExactly(transactionTransfer, transactionForSecondAccount);
......@@ -165,7 +165,7 @@ class TransactionServiceDatabaseTest
LocalDate date1 = LocalDate.of(2020, 4, 30);
FilterConfiguration filterConfiguration = new FilterConfiguration(true, true, true, true, true, null, null, "");
List<Transaction> transactions = transactionService.getTransactionsForAccount(accountRepository.findAllByType(AccountType.ALL).get(0), date1, LocalDate.now(), filterConfiguration);
List<Transaction> transactions = transactionService.getTransactionsForAccount(accountRepository.findAllByType(AccountType.ALL).get(0), date1, LocalDate.now(), filterConfiguration, false);
assertThat(transactions).hasSize(8);
}
......@@ -176,7 +176,7 @@ class TransactionServiceDatabaseTest
LocalDate date2 = LocalDate.of(2020, 5, 20);
FilterConfiguration filterConfiguration = new FilterConfiguration(true, true, true, true, true, null, null, "");
List<Transaction> transactions = transactionService.getTransactionsForAccount(accountRepository.findByName("Default Account"), date1, date2, filterConfiguration);
List<Transaction> transactions = transactionService.getTransactionsForAccount(accountRepository.findByName("Default Account"), date1, date2, filterConfiguration, false);
assertThat(transactions).hasSize(2);
}
......
......@@ -183,7 +183,7 @@ class TransactionSpecificationsTest
@Test
void getIncomesAndExpendituresAndTransfers()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(5)
......@@ -197,7 +197,7 @@ class TransactionSpecificationsTest
@Test
void getIncomesAndExpenditures()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, false, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, false, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(4)
......@@ -210,7 +210,7 @@ class TransactionSpecificationsTest
@Test
void getIncomes()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, false, false, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, false, false, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(2)
......@@ -221,7 +221,7 @@ class TransactionSpecificationsTest
@Test
void getExpenditures()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, false, true, false, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, false, true, false, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(2)
......@@ -232,7 +232,7 @@ class TransactionSpecificationsTest
@Test
void getTransfers()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, false, false, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, false, false, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(1)
......@@ -242,7 +242,7 @@ class TransactionSpecificationsTest
@Test
void incomesAndExpendituresFalse()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, false, false, false, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, false, false, false, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(4)
......@@ -255,7 +255,7 @@ class TransactionSpecificationsTest
@Test
void getTransferBackReferences_NoReferences()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, false, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, false, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(2)
......@@ -266,7 +266,7 @@ class TransactionSpecificationsTest
@Test
void getTransferBackReferences()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account2, false, false, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account2, false, false, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(2)
......@@ -277,7 +277,7 @@ class TransactionSpecificationsTest
@Test
void getTransferBackReferences_excludeExpenditures()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account2, true, false, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account2, true, false, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(1)
......@@ -287,7 +287,7 @@ class TransactionSpecificationsTest
@Test
void getTransferBackReferences_excludeIncomes()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account2, false, true, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account2, false, true, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(1)
......@@ -298,7 +298,7 @@ class TransactionSpecificationsTest
void getTransferBackReferences_WithStartDate()
{
LocalDate startDate2019 = LocalDate.of(2019, 1, 1);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate2019, LocalDate.now(), account2, false, false, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate2019, LocalDate.now(), account2, false, false, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).isEmpty();
......@@ -307,7 +307,7 @@ class TransactionSpecificationsTest
@Test
void getRepeating()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, false, true, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, false, true, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(1)
......@@ -317,7 +317,7 @@ class TransactionSpecificationsTest
@Test
void noRepeating()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, false, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, false, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(4)
......@@ -332,7 +332,7 @@ class TransactionSpecificationsTest
{
List<Integer> categoryIDs = new ArrayList<>();
categoryIDs.add(categoryUnused.getID());
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, categoryIDs, List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, categoryIDs, List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).isEmpty();
......@@ -343,7 +343,7 @@ class TransactionSpecificationsTest
{
List<Integer> categoryIDs = new ArrayList<>();
categoryIDs.add(category1.getID());
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, categoryIDs, List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, categoryIDs, List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(2)
......@@ -354,7 +354,7 @@ class TransactionSpecificationsTest
@Test
void getByFullName()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), List.of(), "Repeating");
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), List.of(), "Repeating", false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(1)
......@@ -364,7 +364,7 @@ class TransactionSpecificationsTest
@Test
void getByPartialName()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), List.of(), "tin");
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), List.of(), "tin", false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(1)
......@@ -374,7 +374,7 @@ class TransactionSpecificationsTest
@Test
void getByPartialName_ExcludeTransfersWithWrongAccount()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account2, true, true, true, null, List.of(), List.of(), "tion");
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account2, true, true, true, null, List.of(), List.of(), "tion", false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(1)
......@@ -387,7 +387,7 @@ class TransactionSpecificationsTest
List<Integer> tagIDs = new ArrayList<>();
tagIDs.add(tag1.getID());
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), tagIDs, null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), tagIDs, null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(4)
......@@ -404,7 +404,7 @@ class TransactionSpecificationsTest
tagIDs.add(tag1.getID());
tagIDs.add(tag2.getID());
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), tagIDs, null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), tagIDs, null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(5)
......@@ -422,7 +422,7 @@ class TransactionSpecificationsTest
List<Integer> tagIDs = new ArrayList<>();
tagIDs.add(tagUnused.getID());
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), tagIDs, null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), tagIDs, null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(3)
......@@ -441,7 +441,7 @@ class TransactionSpecificationsTest
tagIDs.add(tag1.getID());
tagIDs.add(tag2.getID());
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, false, true, true, true, categoryIDs, tagIDs, "Repeating");
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, false, true, true, true, categoryIDs, tagIDs, "Repeating", false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(1)
......@@ -452,7 +452,7 @@ class TransactionSpecificationsTest
void getFromAllAccountsExceptTransfersWithSpecificEndDate()
{
LocalDate endDate = LocalDate.of(2018, 11, 30);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, endDate, null, true, true, false, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, endDate, null, true, true, false, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(2)
......@@ -463,7 +463,7 @@ class TransactionSpecificationsTest
@Test
void getFromAllAccountsExceptHidden()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), null, true, true, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), null, true, true, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(6)
......@@ -475,10 +475,27 @@ class TransactionSpecificationsTest
.contains(transferTransactionWrongAccount);
}
@Test
void getFromAllAccountsIncludeHidden()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), null, true, true, true, null, List.of(), List.of(), null, true);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(7)
.contains(transaction1)
.contains(transaction2)
.contains(transaction3)
.contains(repeatingTransaction)
.contains(transferTransaction)
.contains(transferTransactionWrongAccount)
.contains(transactionInHiddenAccount);
}
@Test
void checkOrder()
{
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), List.of(), null);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, LocalDate.now(), account, true, true, true, null, List.of(), List.of(), null, false);
List<Transaction> results = transactionRepository.findAll(spec);
assertThat(results).hasSize(5)
......
......@@ -44,11 +44,11 @@ import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
import org.springframework.transaction.annotation.Transactional;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
......@@ -112,15 +112,15 @@ class ImportServiceTest
private TagRepository tagRepository;
@Autowired
@SpyBean
@MockitoSpyBean
private TemplateGroupRepository templateGroupRepository;
@Autowired
@SpyBean
@MockitoSpyBean
private TemplateRepository templateRepository;
@Autowired
@SpyBean
@MockitoSpyBean
private ChartService chartService;
@Autowired
......
......@@ -8,6 +8,7 @@ import de.deadlocker8.budgetmaster.services.EntityType;
import de.deadlocker8.budgetmaster.services.ImportResultItem;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
......@@ -55,6 +56,7 @@ class AccountImporterTest extends ImporterTestBase
placeholderAccount.setID(12);
final Account existingPlaceholderAccount = new Account("Placeholder", "", AccountType.ALL, null);
accountRepository.save(existingPlaceholderAccount);
existingPlaceholderAccount.setID(1);
accountRepository.save(existingPlaceholderAccount);
......@@ -73,6 +75,7 @@ class AccountImporterTest extends ImporterTestBase
account.setID(12);
final Account existingAccount = new Account("ABC", "", AccountType.CUSTOM, null);
accountRepository.save(existingAccount);
existingAccount.setID(1);
accountRepository.save(existingAccount);
......
......@@ -51,8 +51,8 @@ class CategoryImporterTest extends ImporterTestBase
void test_importCategories_skipExisting_defaultNone()
{
final Category category = new Category("No category", "#ff0000", CategoryType.NONE);
categoryRepository.save(category);
category.setID(1);
categoryRepository.save(category);
final CategoryImporter importer = new CategoryImporter(categoryRepository);
......@@ -67,8 +67,8 @@ class CategoryImporterTest extends ImporterTestBase
void test_importCategories_skipExisting_defaultRest()
{
final Category category = new Category("Balance", "#ff0000", CategoryType.REST);
categoryRepository.save(category);
category.setID(1);
categoryRepository.save(category);
final CategoryImporter importer = new CategoryImporter(categoryRepository);
......
......@@ -54,6 +54,7 @@ class IconImporterTest extends ImporterTestBase
void test_importIcons_alreadyExisting()
{
final Icon icon = new Icon("fas fa-icons");
iconRepository.save(icon);
icon.setID(1);
iconRepository.save(icon);
......
......@@ -46,6 +46,7 @@ class ImageImporterTest extends ImporterTestBase
void test_importImages_alreadyExisting()
{
final Image image = new Image(new Byte[0], "awesomeIcon.png", ImageFileExtension.PNG);
imageRepository.save(image);
image.setID(1);
imageRepository.save(image);
......