FINERACT-1724

- [x] Refactoring ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl
- [x] Fix NPE and test added to ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest
This commit is contained in:
Janos Haber
2022-11-21 13:54:55 +01:00
committed by Arnold Gálovics
parent 4f9f71da9b
commit d5b4546886
2 changed files with 174 additions and 146 deletions
@@ -169,6 +169,32 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest {
}
@Test
public void okHttpNullUrlTest() throws IOException {
mockOkHttpCall(request -> createOkhttpResponse(request, 500, "Internal Server Error"));
PlatformDataIntegrityException raisedException = assertThrows(PlatformDataIntegrityException.class, () -> {
underTest.okHttpConnectionMethod("testUser", "testPassword", "subscriptionKey", "subscriptionId", null, "AccessToken", null,
null, 0L, "nrcId", "NRC");
});
assertEquals("error.msg.url.is.null.or.empty", raisedException.getGlobalisationMessageCode());
}
@Test
public void okHttpInvalidProcessTestTest() throws IOException {
mockOkHttpCall(request -> createOkhttpResponse(request, 500, "Internal Server Error"));
PlatformDataIntegrityException raisedException = assertThrows(PlatformDataIntegrityException.class, () -> {
underTest.okHttpConnectionMethod("testUser", "testPassword", "subscriptionKey", "subscriptionId", "https://nrc.test.url.com",
"AccessToken", null, null, 0L, "nrcId", "notValidProcess");
});
assertEquals("Invalid Process", raisedException.getGlobalisationMessageCode());
}
@Test
public void okHttpIOExceptionTest() throws IOException {
mockOkHttpCall(request -> {
@@ -468,8 +494,7 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest {
assertEquals("ADD_CREDIT_RESPONSE", result.getDefaultUserMessage());
}
// TODO: if no borrower is throw NPE
// @Test
@Test
public void getCreditReportFromThitsaWorksEmptyBorrowerTest() throws IOException {
mockTokenGeneration();
mockOkHttpCall(request -> {
@@ -499,8 +524,7 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest {
assertNotNull(result.getCreditScore());
}
// TODO: empty gender not handler correctly (NPE)
// @Test
@Test
public void getCreditReportFromThitsaWorksNoGenderTest() throws IOException {
mockTokenGeneration();
mockOkHttpCall(request -> {
@@ -534,8 +558,7 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImplTest {
assertNotNull(result.getCreditScore());
}
// TODO: null credit script invalid result
// @Test
@Test
public void getCreditReportFromThitsaWorksNoLoansTest() throws IOException {
mockTokenGeneration();
mockOkHttpCall(request -> {