FINERACT-2181: Using JUnit 5 for E2E
This commit is contained in:
+2
-2
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.cob.listener;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
+2
-2
@@ -20,6 +20,7 @@ package org.apache.fineract.cob.loan;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
@@ -41,7 +42,6 @@ import org.apache.fineract.infrastructure.core.exception.MultiException;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.service.LoanAccrualsProcessingService;
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -92,7 +92,7 @@ public class AddPeriodicAccrualEntriesBusinessStepTest {
|
||||
doThrow(new MultiException(Collections.singletonList(new RuntimeException()))).when(loanAccrualsProcessingService)
|
||||
.addPeriodicAccruals(any(LocalDate.class), eq(loanForProcessing));
|
||||
// when
|
||||
final BusinessStepException businessStepException = Assert.assertThrows(BusinessStepException.class,
|
||||
final BusinessStepException businessStepException = assertThrows(BusinessStepException.class,
|
||||
() -> underTest.execute(loanForProcessing));
|
||||
// then
|
||||
verify(loanAccrualsProcessingService, times(1)).addPeriodicAccruals(any(LocalDate.class), eq(loanForProcessing));
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.cob.loan;
|
||||
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
|
||||
+3
-3
@@ -18,11 +18,11 @@
|
||||
*/
|
||||
package org.apache.fineract.cob.loan;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyList;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.businessdate.data;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.businessdate.data;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.businessdate.mapper;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.businessdate.validator;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.businessdate.data.BusinessDateData;
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.config;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
|
||||
+30
-28
@@ -18,13 +18,16 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.dataqueries.service;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import org.apache.fineract.infrastructure.core.domain.FineractPlatformTenant;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.dataqueries.service.export.DatatableExportUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -43,27 +46,27 @@ public class DatatableExportUtilTest {
|
||||
|
||||
@Test
|
||||
public void emptyFolderTest() {
|
||||
Assert.assertEquals("", DatatableExportUtil.normalizeFolderName(""));
|
||||
Assert.assertEquals("", DatatableExportUtil.normalizeFolderName("/"));
|
||||
Assert.assertEquals("", DatatableExportUtil.normalizeFolderName(null));
|
||||
assertEquals("", DatatableExportUtil.normalizeFolderName(""));
|
||||
assertEquals("", DatatableExportUtil.normalizeFolderName("/"));
|
||||
assertEquals("", DatatableExportUtil.normalizeFolderName(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void specialCharacterFolderTest() {
|
||||
Assert.assertEquals("_", DatatableExportUtil.normalizeFolderName("Á"));
|
||||
Assert.assertEquals("_", DatatableExportUtil.normalizeFolderName("="));
|
||||
Assert.assertEquals("_", DatatableExportUtil.normalizeFolderName("\\"));
|
||||
Assert.assertEquals("_", DatatableExportUtil.normalizeFolderName("@"));
|
||||
assertEquals("_", DatatableExportUtil.normalizeFolderName("Á"));
|
||||
assertEquals("_", DatatableExportUtil.normalizeFolderName("="));
|
||||
assertEquals("_", DatatableExportUtil.normalizeFolderName("\\"));
|
||||
assertEquals("_", DatatableExportUtil.normalizeFolderName("@"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void normalizedFolderNameTest() {
|
||||
Assert.assertEquals("$", DatatableExportUtil.normalizeFolderName("$"));
|
||||
Assert.assertEquals("reports", DatatableExportUtil.normalizeFolderName("reports"));
|
||||
Assert.assertEquals("reports", DatatableExportUtil.normalizeFolderName("reports/"));
|
||||
Assert.assertEquals("reports", DatatableExportUtil.normalizeFolderName("/reports/"));
|
||||
Assert.assertEquals("reports/content", DatatableExportUtil.normalizeFolderName("reports/content"));
|
||||
Assert.assertEquals("reports/content", DatatableExportUtil.normalizeFolderName("reports/////content"));
|
||||
assertEquals("$", DatatableExportUtil.normalizeFolderName("$"));
|
||||
assertEquals("reports", DatatableExportUtil.normalizeFolderName("reports"));
|
||||
assertEquals("reports", DatatableExportUtil.normalizeFolderName("reports/"));
|
||||
assertEquals("reports", DatatableExportUtil.normalizeFolderName("/reports/"));
|
||||
assertEquals("reports/content", DatatableExportUtil.normalizeFolderName("reports/content"));
|
||||
assertEquals("reports/content", DatatableExportUtil.normalizeFolderName("reports/////content"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,41 +74,40 @@ public class DatatableExportUtilTest {
|
||||
String reportName = "reportName";
|
||||
Map<String, String> reportParams = Collections.synchronizedSortedMap(new TreeMap<>(Map.of("param1", "value1", "param2", "value2")));
|
||||
String fileName = DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder", "csv", reportName, reportParams);
|
||||
Assert.assertTrue(fileName.matches("folder/reportName\\(param1_value1;param2_value2\\)_\\d{14}.csv"));
|
||||
assertTrue(fileName.matches("folder/reportName\\(param1_value1;param2_value2\\)_\\d{14}.csv"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateDatatableExportFileNameComplexTest() {
|
||||
String reportName = "reportName";
|
||||
Map<String, String> reportParams = Collections.synchronizedSortedMap(new TreeMap<>(Map.of("param1", "value1", "param2", "value2")));
|
||||
Assert.assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name///", "csv", reportName, reportParams)
|
||||
assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name///", "csv", reportName, reportParams)
|
||||
.matches("folder/name/reportName\\(param1_value1;param2_value2\\)_\\d{14}.csv"));
|
||||
IllegalArgumentException folderTooLongException = Assert.assertThrows(IllegalArgumentException.class, () -> {
|
||||
IllegalArgumentException folderTooLongException = assertThrows(IllegalArgumentException.class, () -> {
|
||||
DatatableExportUtil.generateS3DatatableExportFileName(30, "too_long_folder_name_test", "csv", reportName, reportParams);
|
||||
});
|
||||
Assert.assertEquals("The folder name is too long", folderTooLongException.getMessage());
|
||||
assertEquals("The folder name is too long", folderTooLongException.getMessage());
|
||||
|
||||
IllegalArgumentException maximumLengthException = Assert.assertThrows(IllegalArgumentException.class, () -> {
|
||||
IllegalArgumentException maximumLengthException = assertThrows(IllegalArgumentException.class, () -> {
|
||||
DatatableExportUtil.generateS3DatatableExportFileName(29, "folder///name/", "csv", reportName, reportParams);
|
||||
});
|
||||
Assert.assertEquals("The maximum length must be greater than 30", maximumLengthException.getMessage());
|
||||
assertEquals("The maximum length must be greater than 30", maximumLengthException.getMessage());
|
||||
|
||||
IllegalArgumentException extensionRequired = Assert.assertThrows(IllegalArgumentException.class, () -> {
|
||||
IllegalArgumentException extensionRequired = assertThrows(IllegalArgumentException.class, () -> {
|
||||
DatatableExportUtil.generateS3DatatableExportFileName(30, "too_long_folder_name_test", null, reportName, reportParams);
|
||||
});
|
||||
Assert.assertEquals("The extension is required", extensionRequired.getMessage());
|
||||
assertEquals("The extension is required", extensionRequired.getMessage());
|
||||
|
||||
IllegalArgumentException reportNameRequired = Assert.assertThrows(IllegalArgumentException.class, () -> {
|
||||
IllegalArgumentException reportNameRequired = assertThrows(IllegalArgumentException.class, () -> {
|
||||
DatatableExportUtil.generateS3DatatableExportFileName(30, "too_long_folder_name_test", "csv", null, reportParams);
|
||||
});
|
||||
Assert.assertEquals("The report name is required", reportNameRequired.getMessage());
|
||||
assertEquals("The report name is required", reportNameRequired.getMessage());
|
||||
|
||||
Assert.assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name/", ".csv", reportName, null)
|
||||
assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name/", ".csv", reportName, null)
|
||||
.matches("folder/name/reportName_\\d{14}.csv"));
|
||||
|
||||
Assert.assertTrue(
|
||||
DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name/", "csv", "report/with/slash", reportParams)
|
||||
.matches("folder/name/report_with_slash\\(param1_value1;param2_value2\\)_\\d{14}.csv"));
|
||||
assertTrue(DatatableExportUtil.generateS3DatatableExportFileName(1024, "folder///name/", "csv", "report/with/slash", reportParams)
|
||||
.matches("folder/name/report_with_slash\\(param1_value1;param2_value2\\)_\\d{14}.csv"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.event.external.service.message;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.jobs.service.increasedateby1day.increasebusinessdateby1day;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.jobs.service.increasedateby1day.increasecobdateby1day;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.loanaccount.domain;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
|
||||
+1
-1
@@ -20,8 +20,8 @@ package org.apache.fineract.portfolio.loanproduct;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import io.cucumber.java8.En;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
Reference in New Issue
Block a user