bulk auto reformat ca. 2900 files using ./gradlew :spotlessApply [FINERACT-1006]
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
89e321acaf
commit
9da5932307
+5
-4
@@ -23,8 +23,9 @@ import org.springframework.util.Assert;
|
||||
|
||||
public class AccountingConstantsTest {
|
||||
|
||||
@Test
|
||||
public void testGetAllFinancialActivities() {
|
||||
Assert.notEmpty(AccountingConstants.FinancialActivity.getAllFinancialActivities(), "static initialization of collection of all enums is broken");
|
||||
}
|
||||
@Test
|
||||
public void testGetAllFinancialActivities() {
|
||||
Assert.notEmpty(AccountingConstants.FinancialActivity.getAllFinancialActivities(),
|
||||
"static initialization of collection of all enums is broken");
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -53,9 +53,8 @@ public class CommandHandlerProviderTest {
|
||||
|
||||
final NewCommandSourceHandler registeredHandler = this.commandHandlerProvider.getHandler("HUMAN", "UPDATE");
|
||||
|
||||
final CommandProcessingResult result =
|
||||
registeredHandler.processCommand(
|
||||
JsonCommand.fromExistingCommand(testCommandId, null, null, null, null, null, null, null, null,null,null));
|
||||
final CommandProcessingResult result = registeredHandler
|
||||
.processCommand(JsonCommand.fromExistingCommand(testCommandId, null, null, null, null, null, null, null, null, null, null));
|
||||
assertEquals(testCommandId, result.commandId());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.apache.http.conn.HttpHostConnectException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Util for RestAssured tests. This class here in src/test is copy/pasted :(
|
||||
* from and identical to the one in src/integrationTest; please keep it in sync.
|
||||
@@ -43,10 +42,12 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class Utils {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(Utils.class);
|
||||
public static final String TENANT_IDENTIFIER = "tenantIdentifier=default";
|
||||
|
||||
private static final String LOGIN_URL = "/fineract-provider/api/v1/authentication?username=mifos&password=password&" + TENANT_IDENTIFIER;
|
||||
private static final String LOGIN_URL = "/fineract-provider/api/v1/authentication?username=mifos&password=password&"
|
||||
+ TENANT_IDENTIFIER;
|
||||
|
||||
public static void initializeRESTAssured() {
|
||||
RestAssured.baseURI = "https://localhost";
|
||||
|
||||
+12
-8
@@ -27,14 +27,19 @@ import org.opentest4j.AssertionFailedError;
|
||||
/**
|
||||
* JUnit Rule to run detect duplicate entries on the classpath. Usage:
|
||||
*
|
||||
* <pre>public static {@literal @}ClassRule ClasspathHellDuplicatesCheckRule
|
||||
* dupes = new ClasspathHellDuplicatesCheckRule();</pre>
|
||||
* <pre>
|
||||
* public static {@literal @}ClassRule ClasspathHellDuplicatesCheckRule
|
||||
* dupes = new ClasspathHellDuplicatesCheckRule();
|
||||
* </pre>
|
||||
*
|
||||
* <p>NB that the basepom/duplicate-finder-maven-plugin already runs as part of odlparent.
|
||||
* It has a similar purpose, but covers build time instead of runtime testing. This JUnit Rule class is
|
||||
* thus recommended to be used in particular in tests which previously ran into JAR Hell issues, and for
|
||||
* which non-regression with a clear failure message in case of future similar problems is important.
|
||||
* (This provides more details at runtime than duplicate-finder-maven-plugin does at build time.)
|
||||
* <p>
|
||||
* NB that the basepom/duplicate-finder-maven-plugin already runs as part of
|
||||
* odlparent. It has a similar purpose, but covers build time instead of runtime
|
||||
* testing. This JUnit Rule class is thus recommended to be used in particular
|
||||
* in tests which previously ran into JAR Hell issues, and for which
|
||||
* non-regression with a clear failure message in case of future similar
|
||||
* problems is important. (This provides more details at runtime than
|
||||
* duplicate-finder-maven-plugin does at build time.)
|
||||
*
|
||||
* @author Michael Vorburger.ch
|
||||
*/
|
||||
@@ -62,4 +67,3 @@ public class ClasspathHellDuplicatesCheckExtension implements AfterEachCallback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -20,6 +20,7 @@ package org.apache.fineract.infrastructure.classdupes;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
/**
|
||||
* {@link ClasspathHellDuplicatesCheckRule} test.
|
||||
*
|
||||
@@ -28,8 +29,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@ExtendWith(ClasspathHellDuplicatesCheckExtension.class)
|
||||
public class ClasspathHellDuplicatesCheckRuleTest {
|
||||
|
||||
// @ClassRule public static ClasspathHellDuplicatesCheckRule jHades = new ClasspathHellDuplicatesCheckRule();
|
||||
// @ClassRule public static ClasspathHellDuplicatesCheckRule jHades = new
|
||||
// ClasspathHellDuplicatesCheckRule();
|
||||
|
||||
@Test // we just need this because JUnit doesn't like a *Test class with only a Rule
|
||||
public void testIfThereAreAnyDuplicatesOnTheClasspath() throws Exception { }
|
||||
@Test // we just need this because JUnit doesn't like a *Test class with
|
||||
// only a Rule
|
||||
public void testIfThereAreAnyDuplicatesOnTheClasspath() throws Exception {}
|
||||
}
|
||||
|
||||
+75
-62
@@ -63,13 +63,15 @@ public class ClasspathHellDuplicatesChecker {
|
||||
private Map<String, List<String>> recheck() {
|
||||
Map<String, List<String>> dupes = new HashMap<>();
|
||||
// To debug this scanner, use ClassGraph().verbose()
|
||||
// We intentionally do not use .classFilesOnly(), or .nonClassFilesOnly(), to check both
|
||||
// We intentionally do not use .classFilesOnly(), or
|
||||
// .nonClassFilesOnly(), to check both
|
||||
try (ScanResult scanResult = new ClassGraph().scan()) {
|
||||
for (Entry<String, ResourceList> dupe : scanResult.getAllResources().findDuplicatePaths()) {
|
||||
String resourceName = dupe.getKey();
|
||||
if (!isHarmlessDuplicate(resourceName)) {
|
||||
boolean addIt = true;
|
||||
List<String> jars = dupe.getValue().stream().map(resource -> resource.getURL().toExternalForm()).collect(Collectors.toList());
|
||||
List<String> jars = dupe.getValue().stream().map(resource -> resource.getURL().toExternalForm())
|
||||
.collect(Collectors.toList());
|
||||
for (String jar : jars) {
|
||||
if (skipJAR(jar)) {
|
||||
addIt = false;
|
||||
@@ -86,81 +88,92 @@ public class ClasspathHellDuplicatesChecker {
|
||||
}
|
||||
|
||||
private boolean skipJAR(String jarPath) {
|
||||
// ./gradlew test finds classes from the Gradle Wrapper (which don't show up in-IDE), exclude those
|
||||
return jarPath.contains("/.gradle/wrapper/dists/")
|
||||
|| jarPath.contains("/io.rest-assured/"); // TODO FINERACT-884 remove when RestAssured was bumped from 3.3.0 to 4.3.0 in Spring BOM
|
||||
// ./gradlew test finds classes from the Gradle Wrapper (which don't
|
||||
// show up in-IDE), exclude those
|
||||
return jarPath.contains("/.gradle/wrapper/dists/") || jarPath.contains("/io.rest-assured/"); // TODO
|
||||
// FINERACT-884
|
||||
// remove
|
||||
// when
|
||||
// RestAssured
|
||||
// was
|
||||
// bumped
|
||||
// from
|
||||
// 3.3.0
|
||||
// to
|
||||
// 4.3.0
|
||||
// in
|
||||
// Spring
|
||||
// BOM
|
||||
}
|
||||
|
||||
protected boolean isHarmlessDuplicate(String resourcePath) {
|
||||
// list from org.jhades.reports.DuplicatesReport
|
||||
return resourcePath.equals("META-INF/MANIFEST.MF")
|
||||
|| resourcePath.equals("META-INF/INDEX.LIST")
|
||||
|| resourcePath.equals("META-INF/ORACLE_J.SF")
|
||||
|| resourcePath.toUpperCase().startsWith("META-INF/ASL")
|
||||
|| resourcePath.toUpperCase().startsWith("META-INF/NOTICE")
|
||||
|| resourcePath.toUpperCase().startsWith("META-INF/LICENSE")
|
||||
|| resourcePath.toUpperCase().startsWith("LICENSE")
|
||||
|| resourcePath.toUpperCase().startsWith("LICENSE/NOTICE")
|
||||
// list formerly in ClasspathHellDuplicatesCheckRule (moved here in INFRAUTILS-52)
|
||||
|| resourcePath.endsWith(".txt")
|
||||
|| resourcePath.endsWith("LICENSE")
|
||||
|| resourcePath.endsWith("license.html")
|
||||
|| resourcePath.endsWith("about.html")
|
||||
|| resourcePath.endsWith("readme.html")
|
||||
|| resourcePath.startsWith("META-INF/services")
|
||||
|| resourcePath.equals("META-INF/DEPENDENCIES")
|
||||
|| resourcePath.equals("META-INF/git.properties")
|
||||
|| resourcePath.equals("META-INF/io.netty.versions.properties")
|
||||
|| resourcePath.equals("META-INF/jersey-module-version")
|
||||
|| resourcePath.startsWith("OSGI-INF/blueprint/")
|
||||
|| resourcePath.startsWith("org/opendaylight/blueprint/")
|
||||
|| resourcePath.endsWith("reference.conf") // in Akka's JARs
|
||||
|| resourcePath.equals("WEB-INF/web.xml")
|
||||
|| resourcePath.equals("META-INF/web-fragment.xml")
|
||||
|| resourcePath.equals("META-INF/eclipse.inf")
|
||||
|| resourcePath.equals("META-INF/ECLIPSE_.SF")
|
||||
|| resourcePath.equals("META-INF/ECLIPSE_.RSA")
|
||||
|| resourcePath.equals("META-INF/BC2048KE.DSA")
|
||||
|| resourcePath.equals("META-INF/BC2048KE.SF")
|
||||
|| resourcePath.equals("META-INF/BC1024KE.SF")
|
||||
return resourcePath.equals("META-INF/MANIFEST.MF") || resourcePath.equals("META-INF/INDEX.LIST")
|
||||
|| resourcePath.equals("META-INF/ORACLE_J.SF") || resourcePath.toUpperCase().startsWith("META-INF/ASL")
|
||||
|| resourcePath.toUpperCase().startsWith("META-INF/NOTICE") || resourcePath.toUpperCase().startsWith("META-INF/LICENSE")
|
||||
|| resourcePath.toUpperCase().startsWith("LICENSE") || resourcePath.toUpperCase().startsWith("LICENSE/NOTICE")
|
||||
// list formerly in ClasspathHellDuplicatesCheckRule (moved here
|
||||
// in INFRAUTILS-52)
|
||||
|| resourcePath.endsWith(".txt") || resourcePath.endsWith("LICENSE") || resourcePath.endsWith("license.html")
|
||||
|| resourcePath.endsWith("about.html") || resourcePath.endsWith("readme.html")
|
||||
|| resourcePath.startsWith("META-INF/services") || resourcePath.equals("META-INF/DEPENDENCIES")
|
||||
|| resourcePath.equals("META-INF/git.properties") || resourcePath.equals("META-INF/io.netty.versions.properties")
|
||||
|| resourcePath.equals("META-INF/jersey-module-version") || resourcePath.startsWith("OSGI-INF/blueprint/")
|
||||
|| resourcePath.startsWith("org/opendaylight/blueprint/") || resourcePath.endsWith("reference.conf") // in
|
||||
// Akka's
|
||||
// JARs
|
||||
|| resourcePath.equals("WEB-INF/web.xml") || resourcePath.equals("META-INF/web-fragment.xml")
|
||||
|| resourcePath.equals("META-INF/eclipse.inf") || resourcePath.equals("META-INF/ECLIPSE_.SF")
|
||||
|| resourcePath.equals("META-INF/ECLIPSE_.RSA") || resourcePath.equals("META-INF/BC2048KE.DSA")
|
||||
|| resourcePath.equals("META-INF/BC2048KE.SF") || resourcePath.equals("META-INF/BC1024KE.SF")
|
||||
|| resourcePath.equals("OSGI-INF/bundle.info")
|
||||
// Spring Framework knows what they are do..
|
||||
|| resourcePath.startsWith("META-INF/spring")
|
||||
|| resourcePath.startsWith("META-INF/additional-spring")
|
||||
|| resourcePath.startsWith("META-INF/spring") || resourcePath.startsWith("META-INF/additional-spring")
|
||||
|| resourcePath.startsWith("META-INF/terracotta")
|
||||
// Groovy is groovy
|
||||
|| resourcePath.startsWith("META-INF/groovy")
|
||||
// Something doesn't to be a perfectly clean in Maven Surefire:
|
||||
|| resourcePath.startsWith("META-INF/maven/")
|
||||
|| resourcePath.contains("surefire")
|
||||
// org.slf4j.impl.StaticLoggerBinder.class in testutils for the LogCaptureRule
|
||||
|| resourcePath.startsWith("META-INF/maven/") || resourcePath.contains("surefire")
|
||||
// org.slf4j.impl.StaticLoggerBinder.class in testutils for the
|
||||
// LogCaptureRule
|
||||
|| resourcePath.equals("org/slf4j/impl/StaticLoggerBinder.class")
|
||||
// INFRAUTILS-35: JavaLaunchHelper is both in java and libinstrument.dylib (?) on Mac OS X
|
||||
// INFRAUTILS-35: JavaLaunchHelper is both in java and
|
||||
// libinstrument.dylib (?) on Mac OS X
|
||||
|| resourcePath.contains("JavaLaunchHelper")
|
||||
// javax.annotation is a big mess... :( E.g. javax.annotation.Resource (and some others)
|
||||
// are present both in rt.jar AND javax.annotation-api-1.3.2.jar and similar - BUT those
|
||||
// JARs cannot just be excluded, because they contain some additional annotations, in the
|
||||
// (reserved!) package javax.annotation, such as javax.annotation.Priority et al. The
|
||||
// super proper way to address this cleanly would be to make our own JAR for javax.annotation
|
||||
// and have it contain ONLY what is not already in package javax.annotation in rt.jar.. but for now:
|
||||
// javax.annotation is a big mess... :( E.g.
|
||||
// javax.annotation.Resource (and some others)
|
||||
// are present both in rt.jar AND javax.annotation-api-1.3.2.jar
|
||||
// and similar - BUT those
|
||||
// JARs cannot just be excluded, because they contain some
|
||||
// additional annotations, in the
|
||||
// (reserved!) package javax.annotation, such as
|
||||
// javax.annotation.Priority et al. The
|
||||
// super proper way to address this cleanly would be to make our
|
||||
// own JAR for javax.annotation
|
||||
// and have it contain ONLY what is not already in package
|
||||
// javax.annotation in rt.jar.. but for now:
|
||||
|| resourcePath.equals("javax/annotation/Resource$AuthenticationType.class")
|
||||
// NEUTRON-205: javax.inject is a mess :( because of javax.inject:javax.inject (which we widely use in ODL)
|
||||
// VS. org.glassfish.hk2.external:javax.inject (which Glassfish Jersey has dependencies on). Attempts to
|
||||
// cleanly exclude glassfish.hk2's javax.inject and align everything on only depending on
|
||||
// javax.inject:javax.inject have failed, because the OSGi bundle
|
||||
// org.glassfish.jersey.containers.jersey-container-servlet-core (2.25.1) has a non-optional Package-Import
|
||||
// for javax.inject, but we made javax.inject:javax.inject <optional>true in odlparent, and don't bundle it.
|
||||
// NEUTRON-205: javax.inject is a mess :( because of
|
||||
// javax.inject:javax.inject (which we widely use in ODL)
|
||||
// VS. org.glassfish.hk2.external:javax.inject (which Glassfish
|
||||
// Jersey has dependencies on). Attempts to
|
||||
// cleanly exclude glassfish.hk2's javax.inject and align
|
||||
// everything on only depending on
|
||||
// javax.inject:javax.inject have failed, because the OSGi
|
||||
// bundle
|
||||
// org.glassfish.jersey.containers.jersey-container-servlet-core
|
||||
// (2.25.1) has a non-optional Package-Import
|
||||
// for javax.inject, but we made javax.inject:javax.inject
|
||||
// <optional>true in odlparent, and don't bundle it.
|
||||
|| resourcePath.startsWith("javax/inject/")
|
||||
// Java 9 modules
|
||||
|| resourcePath.endsWith("module-info.class")
|
||||
|| resourcePath.contains("findbugs")
|
||||
// list newly introduced in INFRAUTILS-52, because classgraph scans more than JHades did
|
||||
|| resourcePath.equals("plugin.properties")
|
||||
|| resourcePath.equals(".api_description")
|
||||
// errorprone with Java 11 integration leaks to classpath, which causes a conflict between
|
||||
|| resourcePath.endsWith("module-info.class") || resourcePath.contains("findbugs")
|
||||
// list newly introduced in INFRAUTILS-52, because classgraph
|
||||
// scans more than JHades did
|
||||
|| resourcePath.equals("plugin.properties") || resourcePath.equals(".api_description")
|
||||
// errorprone with Java 11 integration leaks to classpath, which
|
||||
// causes a conflict between
|
||||
// checkerframework/checker-qual and checkerframework/dataflow
|
||||
|| resourcePath.startsWith("org/checkerframework/dataflow/qual/")
|
||||
;
|
||||
|| resourcePath.startsWith("org/checkerframework/dataflow/qual/");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -34,12 +34,14 @@ import org.springframework.context.annotation.Bean;
|
||||
public class TestsWithoutDatabaseAndNoJobsConfiguration extends AbstractApplicationConfiguration {
|
||||
|
||||
/**
|
||||
* Override TenantDatabaseUpgradeService binding, because the real one has a @PostConstruct
|
||||
* upgradeAllTenants() which accesses the database on start-up.
|
||||
* Override TenantDatabaseUpgradeService binding, because the real one has
|
||||
* a @PostConstruct upgradeAllTenants() which accesses the database on
|
||||
* start-up.
|
||||
*/
|
||||
@Bean
|
||||
public TenantDatabaseUpgradeService tenantDatabaseUpgradeService() {
|
||||
return new TenantDatabaseUpgradeService(null, null) {
|
||||
|
||||
@Override
|
||||
public void upgradeAllTenants() {
|
||||
// NOOP
|
||||
|
||||
+3
-1
@@ -32,7 +32,9 @@ class MultiExceptionTest {
|
||||
|
||||
@Test()
|
||||
void testEmpty() throws MultiException {
|
||||
assertThrows(IllegalArgumentException.class, () -> { throw new MultiException(Collections.emptyList()); });
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
throw new MultiException(Collections.emptyList());
|
||||
});
|
||||
}
|
||||
|
||||
@Test()
|
||||
|
||||
+6
-5
@@ -46,8 +46,9 @@ public class SQLBuilderTest {
|
||||
sqlBuilder.addCriteria("hobby LIKE ", "Mifos/Apache Fineract");
|
||||
sqlBuilder.addCriteria("age < ", 123);
|
||||
assertEquals(" WHERE name = ? AND hobby LIKE ? AND age < ?", sqlBuilder.getSQLTemplate());
|
||||
assertArrayEquals(new Object[] { "Michael", "Mifos/Apache Fineract", 123}, sqlBuilder.getArguments());
|
||||
assertEquals("SQLBuilder{WHERE name = ['Michael'] AND hobby LIKE ['Mifos/Apache Fineract'] AND age < [123]}", sqlBuilder.toString());
|
||||
assertArrayEquals(new Object[] { "Michael", "Mifos/Apache Fineract", 123 }, sqlBuilder.getArguments());
|
||||
assertEquals("SQLBuilder{WHERE name = ['Michael'] AND hobby LIKE ['Mifos/Apache Fineract'] AND age < [123]}",
|
||||
sqlBuilder.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -68,15 +69,15 @@ public class SQLBuilderTest {
|
||||
|
||||
@Test
|
||||
public void testAddIllegalArguments() throws Exception {
|
||||
assertThrows(IllegalArgumentException.class, ()-> {
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
new SQLBuilder().addCriteria("age<", 123);
|
||||
}, "space between column and operator" );
|
||||
}, "space between column and operator");
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
new SQLBuilder().addCriteria(null, "argument");
|
||||
}, "null Criteria Fragment");
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
new SQLBuilder().addCriteria("", "argument");
|
||||
}, "empty Criteria Fragment" );
|
||||
}, "empty Criteria Fragment");
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
new SQLBuilder().addCriteria(" ", "argument");
|
||||
}, "space only Criteria Fragment");
|
||||
|
||||
+3
-4
@@ -50,6 +50,7 @@ import org.xml.sax.SAXException;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class XBRLBuilderTest {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(XBRLBuilderTest.class);
|
||||
@Mock
|
||||
private NamespaceReadPlatformServiceImpl readNamespaceService;
|
||||
@@ -70,12 +71,10 @@ public class XBRLBuilderTest {
|
||||
final MixTaxonomyData data1 = Mockito.mock(MixTaxonomyData.class);
|
||||
when(data1.getName()).thenReturn("Assets");
|
||||
map.put(data1, new BigDecimal(10000));
|
||||
final String result = this.xbrlBuilder.build(map, Date.valueOf("2005-11-11"), Date.valueOf("2013-07-17"),
|
||||
"USD");
|
||||
final String result = this.xbrlBuilder.build(map, Date.valueOf("2005-11-11"), Date.valueOf("2013-07-17"), "USD");
|
||||
LOG.info("{}", result);
|
||||
NodeList nodes = DocumentBuilderFactory.newInstance().newDocumentBuilder()
|
||||
.parse(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8)))
|
||||
.getElementsByTagName("Assets");
|
||||
.parse(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8))).getElementsByTagName("Assets");
|
||||
assertNotNull(nodes);
|
||||
assertNotNull(nodes.item(0));
|
||||
assertEquals("Assets", nodes.item(0).getNodeName());
|
||||
|
||||
@@ -27,10 +27,12 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jms.listener.SessionAwareMessageListener;
|
||||
|
||||
public class Listener implements SessionAwareMessageListener {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(Listener.class);
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, Session session) throws JMSException {
|
||||
TextMessage msg = (TextMessage) message;
|
||||
LOG.info("Received: {}" ,msg.getText());
|
||||
LOG.info("Received: {}", msg.getText());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,11 +63,8 @@ public class StorageTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
notificationWritePlatformServiceImpl = new NotificationWritePlatformServiceImpl(
|
||||
notificationGeneratorWritePlatformService,
|
||||
notificationGeneratorReadRepositoryWrapper,
|
||||
appUserRepository,
|
||||
notificationMapperWritePlatformService);
|
||||
notificationWritePlatformServiceImpl = new NotificationWritePlatformServiceImpl(notificationGeneratorWritePlatformService,
|
||||
notificationGeneratorReadRepositoryWrapper, appUserRepository, notificationMapperWritePlatformService);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -82,27 +79,13 @@ public class StorageTest {
|
||||
boolean isSystemGenerated = false;
|
||||
String now = getCurrentDateTime();
|
||||
|
||||
Notification notification = new Notification(
|
||||
objectType,
|
||||
objectIdentifier,
|
||||
action,
|
||||
actor,
|
||||
isSystemGenerated,
|
||||
notificationContent,
|
||||
now
|
||||
);
|
||||
Notification notification = new Notification(objectType, objectIdentifier, action, actor, isSystemGenerated, notificationContent,
|
||||
now);
|
||||
|
||||
AppUser appUser = new AppUser(null, new User("J.J.", "", true, true,
|
||||
true, true, Collections.emptyList()),
|
||||
null, "user@com", "John", "", null, false,
|
||||
false, null);
|
||||
AppUser appUser = new AppUser(null, new User("J.J.", "", true, true, true, true, Collections.emptyList()), null, "user@com", "John",
|
||||
"", null, false, false, null);
|
||||
|
||||
NotificationMapper notificationMapper = new NotificationMapper(
|
||||
notification,
|
||||
appUser,
|
||||
false,
|
||||
now
|
||||
);
|
||||
NotificationMapper notificationMapper = new NotificationMapper(notification, appUser, false, now);
|
||||
|
||||
when(this.notificationGeneratorWritePlatformService.create(refEq(notification))).thenReturn(1L);
|
||||
|
||||
@@ -112,21 +95,13 @@ public class StorageTest {
|
||||
|
||||
when(this.notificationMapperWritePlatformService.create(refEq(notificationMapper))).thenReturn(1L);
|
||||
|
||||
Long actualGeneratedNotificationId =
|
||||
notificationWritePlatformServiceImpl.notify(
|
||||
userId,
|
||||
objectType,
|
||||
objectIdentifier,
|
||||
action,
|
||||
actor,
|
||||
notificationContent,
|
||||
isSystemGenerated
|
||||
);
|
||||
Long actualGeneratedNotificationId = notificationWritePlatformServiceImpl.notify(userId, objectType, objectIdentifier, action,
|
||||
actor, notificationContent, isSystemGenerated);
|
||||
|
||||
verify(this.notificationGeneratorWritePlatformService, times(1)).create(refEq(notification, "createdAt"));
|
||||
verify(this.notificationMapperWritePlatformService, times(1)).create(refEq(notificationMapper, "createdAt"));
|
||||
verify(this.notificationGeneratorReadRepositoryWrapper, times(1)).findById(1L);
|
||||
assertEquals(Long.valueOf(1),actualGeneratedNotificationId);
|
||||
assertEquals(Long.valueOf(1), actualGeneratedNotificationId);
|
||||
}
|
||||
|
||||
private String getCurrentDateTime() {
|
||||
|
||||
+2
-1
@@ -201,7 +201,8 @@ public class AdhikarLoanRepaymentScheduleTransactionProcessorTest {
|
||||
//
|
||||
// Money expectedInterestCompleted = new
|
||||
// MoneyBuilder().with(currency).with(interest).build();
|
||||
// assertThat("interest completed not as expected: ",installment.getInterestCompleted(currency).toString(),
|
||||
// assertThat("interest completed not as expected:
|
||||
// ",installment.getInterestCompleted(currency).toString(),
|
||||
// is(expectedInterestCompleted.toString()));
|
||||
//
|
||||
// Money expectedInterestWaived = new
|
||||
|
||||
+2
-1
@@ -605,7 +605,8 @@ public class HeavensFamilyLoanRepaymentScheduleTransactionProcessorTest {
|
||||
//
|
||||
// Money expectedInterestCompleted = new
|
||||
// MoneyBuilder().with(currency).with(interest).build();
|
||||
// assertThat("interest completed not as expected: ",installment.getInterestCompleted(currency).toString(),
|
||||
// assertThat("interest completed not as expected:
|
||||
// ",installment.getInterestCompleted(currency).toString(),
|
||||
// is(expectedInterestCompleted.toString()));
|
||||
//
|
||||
// Money expectedInterestWaived = new
|
||||
|
||||
+6
-4
@@ -154,8 +154,10 @@ public class LoanProductRelatedDetailTestHelper {
|
||||
final boolean considerPartialPeriodInterest = false;
|
||||
final boolean isEqualAmortization = false;
|
||||
return new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod, interestPeriodFrequencyType,
|
||||
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, considerPartialPeriodInterest, repayEvery,
|
||||
repaymentFrequencyType, defaultNumberOfRepayments, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged,
|
||||
amortizationMethod, inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType, daysInYearType, isInterestRecalculationEnabled, isEqualAmortization);
|
||||
defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod, considerPartialPeriodInterest,
|
||||
repayEvery, repaymentFrequencyType, defaultNumberOfRepayments, graceOnPrincipalPayment,
|
||||
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged, amortizationMethod,
|
||||
inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType, daysInYearType, isInterestRecalculationEnabled,
|
||||
isEqualAmortization);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,4 +83,4 @@ public class LoanRepaymentScheduleInstallmentBuilder {
|
||||
this.installmentNumber = withInstallmentNumber;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -65,8 +65,8 @@ public class LoanScheduleTestDataHelper {
|
||||
* (principal paid, interest paid) 02 August 2011 1,000 200 0 false 02
|
||||
* September 2011 1,000 200 0 false
|
||||
*/
|
||||
public static List<LoanRepaymentScheduleInstallment> createSimpleLoanScheduleWithFirstInstallmentFullyPaid(
|
||||
final LocalDate firstDueDate, final MonetaryCurrency currency) {
|
||||
public static List<LoanRepaymentScheduleInstallment> createSimpleLoanScheduleWithFirstInstallmentFullyPaid(final LocalDate firstDueDate,
|
||||
final MonetaryCurrency currency) {
|
||||
|
||||
final LoanRepaymentScheduleInstallment firstInstallment = new LoanRepaymentScheduleInstallmentBuilder(currency)
|
||||
.withInstallmentNumber(1).withDueDate(firstDueDate).withPrincipal("1000.00").withInterest("200.00").completed().build();
|
||||
|
||||
+1
-1
@@ -40,4 +40,4 @@ public class MoneyBuilder {
|
||||
this.newAmount = BigDecimal.valueOf(Double.valueOf(withAmount));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -60,8 +60,6 @@ public class TemplateMergeServiceTest {
|
||||
field.set(null, RoundingMode.HALF_EVEN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void compileHelloTemplate() throws Exception {
|
||||
String templateText = "Hello Test for Template {{file.name}}!";
|
||||
@@ -124,7 +122,7 @@ public class TemplateMergeServiceTest {
|
||||
|
||||
protected Map<String, Object> createMapFromJSON(String jsonText) {
|
||||
Gson gson = new Gson();
|
||||
Type ssMap = new TypeToken<Map<String, Object>>(){}.getType();
|
||||
Type ssMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
JsonElement json = JsonParser.parseString(jsonText);
|
||||
return gson.fromJson(json, ssMap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user