- JHipster's microfrontends implementation doesn't provide a stand-alone UI. Packaged microfrontends should be accessed through a
- JHipster gateway.
-
-
Stand-alone development server can be started by `npm start`.
+
It does not have a front-end. The front-end should be generated on a JHipster gateway.
It is serving REST APIs, under the '/api' URLs.
diff --git a/src/test/java/com/scb/fimob/IntegrationTest.java b/src/test/java/com/scb/fimob/IntegrationTest.java
new file mode 100644
index 0000000..81946e8
--- /dev/null
+++ b/src/test/java/com/scb/fimob/IntegrationTest.java
@@ -0,0 +1,17 @@
+package com.scb.fimob;
+
+import com.scb.fimob.FimApp;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.springframework.boot.test.context.SpringBootTest;
+
+/**
+ * Base composite annotation for integration tests.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@SpringBootTest(classes = FimApp.class)
+public @interface IntegrationTest {
+}
diff --git a/src/test/java/com/scb/fimob/TechnicalStructureTest.java b/src/test/java/com/scb/fimob/TechnicalStructureTest.java
new file mode 100644
index 0000000..a551166
--- /dev/null
+++ b/src/test/java/com/scb/fimob/TechnicalStructureTest.java
@@ -0,0 +1,39 @@
+package com.scb.fimob;
+
+import static com.tngtech.archunit.base.DescribedPredicate.alwaysTrue;
+import static com.tngtech.archunit.core.domain.JavaClass.Predicates.belongToAnyOf;
+import static com.tngtech.archunit.library.Architectures.layeredArchitecture;
+
+import com.tngtech.archunit.core.importer.ImportOption.DoNotIncludeTests;
+import com.tngtech.archunit.junit.AnalyzeClasses;
+import com.tngtech.archunit.junit.ArchTest;
+import com.tngtech.archunit.lang.ArchRule;
+
+@AnalyzeClasses(packagesOf = FimApp.class, importOptions = DoNotIncludeTests.class)
+class TechnicalStructureTest {
+
+ // prettier-ignore
+ @ArchTest
+ static final ArchRule respectsTechnicalArchitectureLayers = layeredArchitecture()
+ .layer("Config").definedBy("..config..")
+ .layer("Client").definedBy("..client..")
+ .layer("Web").definedBy("..web..")
+ .optionalLayer("Service").definedBy("..service..")
+ .layer("Security").definedBy("..security..")
+ .layer("Persistence").definedBy("..repository..")
+ .layer("Domain").definedBy("..domain..")
+
+ .whereLayer("Config").mayNotBeAccessedByAnyLayer()
+ .whereLayer("Client").mayNotBeAccessedByAnyLayer()
+ .whereLayer("Web").mayOnlyBeAccessedByLayers("Config")
+ .whereLayer("Service").mayOnlyBeAccessedByLayers("Web", "Config")
+ .whereLayer("Security").mayOnlyBeAccessedByLayers("Config", "Client", "Service", "Web")
+ .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service", "Security", "Web", "Config")
+ .whereLayer("Domain").mayOnlyBeAccessedByLayers("Persistence", "Service", "Security", "Web", "Config")
+
+ .ignoreDependency(belongToAnyOf(FimApp.class), alwaysTrue())
+ .ignoreDependency(alwaysTrue(), belongToAnyOf(
+ com.scb.fimob.config.Constants.class,
+ com.scb.fimob.config.ApplicationProperties.class
+ ));
+}
diff --git a/src/test/java/com/scb/fimob/config/WebConfigurerTest.java b/src/test/java/com/scb/fimob/config/WebConfigurerTest.java
new file mode 100644
index 0000000..e604d51
--- /dev/null
+++ b/src/test/java/com/scb/fimob/config/WebConfigurerTest.java
@@ -0,0 +1,134 @@
+package com.scb.fimob.config;
+
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.*;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import java.util.*;
+import javax.servlet.*;
+import org.h2.server.web.WebServlet;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.http.HttpHeaders;
+import org.springframework.mock.env.MockEnvironment;
+import org.springframework.mock.web.MockServletContext;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import tech.jhipster.config.JHipsterConstants;
+import tech.jhipster.config.JHipsterProperties;
+
+/**
+ * Unit tests for the {@link WebConfigurer} class.
+ */
+class WebConfigurerTest {
+
+ private WebConfigurer webConfigurer;
+
+ private MockServletContext servletContext;
+
+ private MockEnvironment env;
+
+ private JHipsterProperties props;
+
+ @BeforeEach
+ public void setup() {
+ servletContext = spy(new MockServletContext());
+ doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class));
+ doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class));
+
+ env = new MockEnvironment();
+ props = new JHipsterProperties();
+
+ webConfigurer = new WebConfigurer(env, props);
+ }
+
+ @Test
+ void shouldStartUpProdServletContext() throws ServletException {
+ env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
+
+ assertThatCode(() -> webConfigurer.onStartup(servletContext)).doesNotThrowAnyException();
+ verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class));
+ }
+
+ @Test
+ void shouldStartUpDevServletContext() throws ServletException {
+ env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
+
+ assertThatCode(() -> webConfigurer.onStartup(servletContext)).doesNotThrowAnyException();
+ verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class));
+ }
+
+ @Test
+ void shouldCorsFilterOnApiPath() throws Exception {
+ props.getCors().setAllowedOrigins(Collections.singletonList("other.domain.com"));
+ props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));
+ props.getCors().setAllowedHeaders(Collections.singletonList("*"));
+ props.getCors().setMaxAge(1800L);
+ props.getCors().setAllowCredentials(true);
+
+ MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build();
+
+ mockMvc
+ .perform(
+ options("/api/test-cors")
+ .header(HttpHeaders.ORIGIN, "other.domain.com")
+ .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")
+ )
+ .andExpect(status().isOk())
+ .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com"))
+ .andExpect(header().string(HttpHeaders.VARY, "Origin"))
+ .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE"))
+ .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"))
+ .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800"));
+
+ mockMvc
+ .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com"))
+ .andExpect(status().isOk())
+ .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com"));
+ }
+
+ @Test
+ void shouldCorsFilterOnOtherPath() throws Exception {
+ props.getCors().setAllowedOrigins(Collections.singletonList("*"));
+ props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));
+ props.getCors().setAllowedHeaders(Collections.singletonList("*"));
+ props.getCors().setMaxAge(1800L);
+ props.getCors().setAllowCredentials(true);
+
+ MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build();
+
+ mockMvc
+ .perform(get("/test/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com"))
+ .andExpect(status().isOk())
+ .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
+ }
+
+ @Test
+ void shouldCorsFilterDeactivatedForNullAllowedOrigins() throws Exception {
+ props.getCors().setAllowedOrigins(null);
+
+ MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build();
+
+ mockMvc
+ .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com"))
+ .andExpect(status().isOk())
+ .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
+ }
+
+ @Test
+ void shouldCorsFilterDeactivatedForEmptyAllowedOrigins() throws Exception {
+ props.getCors().setAllowedOrigins(new ArrayList<>());
+
+ MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build();
+
+ mockMvc
+ .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com"))
+ .andExpect(status().isOk())
+ .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
+ }
+}
diff --git a/src/test/java/com/scb/fimob/config/WebConfigurerTestController.java b/src/test/java/com/scb/fimob/config/WebConfigurerTestController.java
new file mode 100644
index 0000000..d05c569
--- /dev/null
+++ b/src/test/java/com/scb/fimob/config/WebConfigurerTestController.java
@@ -0,0 +1,14 @@
+package com.scb.fimob.config;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class WebConfigurerTestController {
+
+ @GetMapping("/api/test-cors")
+ public void testCorsOnApiPath() {}
+
+ @GetMapping("/test/test-cors")
+ public void testCorsOnOtherPath() {}
+}
diff --git a/src/test/java/com/scb/fimob/config/timezone/HibernateTimeZoneIT.java b/src/test/java/com/scb/fimob/config/timezone/HibernateTimeZoneIT.java
new file mode 100644
index 0000000..4d6da57
--- /dev/null
+++ b/src/test/java/com/scb/fimob/config/timezone/HibernateTimeZoneIT.java
@@ -0,0 +1,162 @@
+package com.scb.fimob.config.timezone;
+
+import static java.lang.String.format;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.repository.timezone.DateTimeWrapper;
+import com.scb.fimob.repository.timezone.DateTimeWrapperRepository;
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the ZoneId Hibernate configuration.
+ */
+@IntegrationTest
+class HibernateTimeZoneIT {
+
+ @Autowired
+ private DateTimeWrapperRepository dateTimeWrapperRepository;
+
+ @Autowired
+ private JdbcTemplate jdbcTemplate;
+
+ @Value("${spring.jpa.properties.hibernate.jdbc.time_zone:UTC}")
+ private String zoneId;
+
+ private DateTimeWrapper dateTimeWrapper;
+ private DateTimeFormatter dateTimeFormatter;
+ private DateTimeFormatter timeFormatter;
+ private DateTimeFormatter dateFormatter;
+
+ @BeforeEach
+ public void setup() {
+ dateTimeWrapper = new DateTimeWrapper();
+ dateTimeWrapper.setInstant(Instant.parse("2014-11-12T05:50:00.0Z"));
+ dateTimeWrapper.setLocalDateTime(LocalDateTime.parse("2014-11-12T07:50:00.0"));
+ dateTimeWrapper.setOffsetDateTime(OffsetDateTime.parse("2011-12-14T08:30:00.0Z"));
+ dateTimeWrapper.setZonedDateTime(ZonedDateTime.parse("2011-12-14T08:30:00.0Z"));
+ dateTimeWrapper.setLocalTime(LocalTime.parse("14:30:00"));
+ dateTimeWrapper.setOffsetTime(OffsetTime.parse("14:30:00+02:00"));
+ dateTimeWrapper.setLocalDate(LocalDate.parse("2016-09-10"));
+
+ dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S").withZone(ZoneId.of(zoneId));
+
+ timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss").withZone(ZoneId.of(zoneId));
+
+ dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ }
+
+ @Test
+ @Transactional
+ void storeInstantWithZoneIdConfigShouldBeStoredOnGMTTimeZone() {
+ dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
+
+ String request = generateSqlRequest("instant", dateTimeWrapper.getId());
+ SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
+ String expectedValue = dateTimeFormatter.format(dateTimeWrapper.getInstant());
+
+ assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
+ }
+
+ @Test
+ @Transactional
+ void storeLocalDateTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZone() {
+ dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
+
+ String request = generateSqlRequest("local_date_time", dateTimeWrapper.getId());
+ SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
+ String expectedValue = dateTimeWrapper.getLocalDateTime().atZone(ZoneId.systemDefault()).format(dateTimeFormatter);
+
+ assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
+ }
+
+ @Test
+ @Transactional
+ void storeOffsetDateTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZone() {
+ dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
+
+ String request = generateSqlRequest("offset_date_time", dateTimeWrapper.getId());
+ SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
+ String expectedValue = dateTimeWrapper.getOffsetDateTime().format(dateTimeFormatter);
+
+ assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
+ }
+
+ @Test
+ @Transactional
+ void storeZoneDateTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZone() {
+ dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
+
+ String request = generateSqlRequest("zoned_date_time", dateTimeWrapper.getId());
+ SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
+ String expectedValue = dateTimeWrapper.getZonedDateTime().format(dateTimeFormatter);
+
+ assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
+ }
+
+ @Test
+ @Transactional
+ void storeLocalTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() {
+ dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
+
+ String request = generateSqlRequest("local_time", dateTimeWrapper.getId());
+ SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
+ String expectedValue = dateTimeWrapper
+ .getLocalTime()
+ .atDate(LocalDate.of(1970, Month.JANUARY, 1))
+ .atZone(ZoneId.systemDefault())
+ .format(timeFormatter);
+
+ assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
+ }
+
+ @Test
+ @Transactional
+ void storeOffsetTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() {
+ dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
+
+ String request = generateSqlRequest("offset_time", dateTimeWrapper.getId());
+ SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
+ String expectedValue = dateTimeWrapper
+ .getOffsetTime()
+ .toLocalTime()
+ .atDate(LocalDate.of(1970, Month.JANUARY, 1))
+ .atZone(ZoneId.systemDefault())
+ .format(timeFormatter);
+
+ assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
+ }
+
+ @Test
+ @Transactional
+ void storeLocalDateWithZoneIdConfigShouldBeStoredWithoutTransformation() {
+ dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper);
+
+ String request = generateSqlRequest("local_date", dateTimeWrapper.getId());
+ SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request);
+ String expectedValue = dateTimeWrapper.getLocalDate().format(dateFormatter);
+
+ assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue);
+ }
+
+ private String generateSqlRequest(String fieldName, long id) {
+ return format("SELECT %s FROM jhi_date_time_wrapper where id=%d", fieldName, id);
+ }
+
+ private void assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(SqlRowSet sqlRowSet, String expectedValue) {
+ while (sqlRowSet.next()) {
+ String dbValue = sqlRowSet.getString(1);
+
+ assertThat(dbValue).isNotNull();
+ assertThat(dbValue).isEqualTo(expectedValue);
+ }
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/EthnicityTest.java b/src/test/java/com/scb/fimob/domain/EthnicityTest.java
new file mode 100644
index 0000000..e11575f
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/EthnicityTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class EthnicityTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(Ethnicity.class);
+ Ethnicity ethnicity1 = new Ethnicity();
+ ethnicity1.setId(1L);
+ Ethnicity ethnicity2 = new Ethnicity();
+ ethnicity2.setId(ethnicity1.getId());
+ assertThat(ethnicity1).isEqualTo(ethnicity2);
+ ethnicity2.setId(2L);
+ assertThat(ethnicity1).isNotEqualTo(ethnicity2);
+ ethnicity1.setId(null);
+ assertThat(ethnicity1).isNotEqualTo(ethnicity2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimAccountsHistoryTest.java b/src/test/java/com/scb/fimob/domain/FimAccountsHistoryTest.java
new file mode 100644
index 0000000..da38a9e
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimAccountsHistoryTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsHistoryTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimAccountsHistory.class);
+ FimAccountsHistory fimAccountsHistory1 = new FimAccountsHistory();
+ fimAccountsHistory1.setId(1L);
+ FimAccountsHistory fimAccountsHistory2 = new FimAccountsHistory();
+ fimAccountsHistory2.setId(fimAccountsHistory1.getId());
+ assertThat(fimAccountsHistory1).isEqualTo(fimAccountsHistory2);
+ fimAccountsHistory2.setId(2L);
+ assertThat(fimAccountsHistory1).isNotEqualTo(fimAccountsHistory2);
+ fimAccountsHistory1.setId(null);
+ assertThat(fimAccountsHistory1).isNotEqualTo(fimAccountsHistory2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimAccountsTest.java b/src/test/java/com/scb/fimob/domain/FimAccountsTest.java
new file mode 100644
index 0000000..72d5890
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimAccountsTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimAccounts.class);
+ FimAccounts fimAccounts1 = new FimAccounts();
+ fimAccounts1.setId(1L);
+ FimAccounts fimAccounts2 = new FimAccounts();
+ fimAccounts2.setId(fimAccounts1.getId());
+ assertThat(fimAccounts1).isEqualTo(fimAccounts2);
+ fimAccounts2.setId(2L);
+ assertThat(fimAccounts1).isNotEqualTo(fimAccounts2);
+ fimAccounts1.setId(null);
+ assertThat(fimAccounts1).isNotEqualTo(fimAccounts2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimAccountsWqTest.java b/src/test/java/com/scb/fimob/domain/FimAccountsWqTest.java
new file mode 100644
index 0000000..4acf922
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimAccountsWqTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsWqTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimAccountsWq.class);
+ FimAccountsWq fimAccountsWq1 = new FimAccountsWq();
+ fimAccountsWq1.setId(1L);
+ FimAccountsWq fimAccountsWq2 = new FimAccountsWq();
+ fimAccountsWq2.setId(fimAccountsWq1.getId());
+ assertThat(fimAccountsWq1).isEqualTo(fimAccountsWq2);
+ fimAccountsWq2.setId(2L);
+ assertThat(fimAccountsWq1).isNotEqualTo(fimAccountsWq2);
+ fimAccountsWq1.setId(null);
+ assertThat(fimAccountsWq1).isNotEqualTo(fimAccountsWq2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimCustHistoryTest.java b/src/test/java/com/scb/fimob/domain/FimCustHistoryTest.java
new file mode 100644
index 0000000..484da3e
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimCustHistoryTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimCustHistoryTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimCustHistory.class);
+ FimCustHistory fimCustHistory1 = new FimCustHistory();
+ fimCustHistory1.setId(1L);
+ FimCustHistory fimCustHistory2 = new FimCustHistory();
+ fimCustHistory2.setId(fimCustHistory1.getId());
+ assertThat(fimCustHistory1).isEqualTo(fimCustHistory2);
+ fimCustHistory2.setId(2L);
+ assertThat(fimCustHistory1).isNotEqualTo(fimCustHistory2);
+ fimCustHistory1.setId(null);
+ assertThat(fimCustHistory1).isNotEqualTo(fimCustHistory2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimCustTest.java b/src/test/java/com/scb/fimob/domain/FimCustTest.java
new file mode 100644
index 0000000..158f1b7
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimCustTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimCustTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimCust.class);
+ FimCust fimCust1 = new FimCust();
+ fimCust1.setId(1L);
+ FimCust fimCust2 = new FimCust();
+ fimCust2.setId(fimCust1.getId());
+ assertThat(fimCust1).isEqualTo(fimCust2);
+ fimCust2.setId(2L);
+ assertThat(fimCust1).isNotEqualTo(fimCust2);
+ fimCust1.setId(null);
+ assertThat(fimCust1).isNotEqualTo(fimCust2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimCustWqTest.java b/src/test/java/com/scb/fimob/domain/FimCustWqTest.java
new file mode 100644
index 0000000..f7e57fc
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimCustWqTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimCustWqTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimCustWq.class);
+ FimCustWq fimCustWq1 = new FimCustWq();
+ fimCustWq1.setId(1L);
+ FimCustWq fimCustWq2 = new FimCustWq();
+ fimCustWq2.setId(fimCustWq1.getId());
+ assertThat(fimCustWq1).isEqualTo(fimCustWq2);
+ fimCustWq2.setId(2L);
+ assertThat(fimCustWq1).isNotEqualTo(fimCustWq2);
+ fimCustWq1.setId(null);
+ assertThat(fimCustWq1).isNotEqualTo(fimCustWq2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimSettAcctHistoryTest.java b/src/test/java/com/scb/fimob/domain/FimSettAcctHistoryTest.java
new file mode 100644
index 0000000..1ff5e5c
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimSettAcctHistoryTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctHistoryTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimSettAcctHistory.class);
+ FimSettAcctHistory fimSettAcctHistory1 = new FimSettAcctHistory();
+ fimSettAcctHistory1.setId(1L);
+ FimSettAcctHistory fimSettAcctHistory2 = new FimSettAcctHistory();
+ fimSettAcctHistory2.setId(fimSettAcctHistory1.getId());
+ assertThat(fimSettAcctHistory1).isEqualTo(fimSettAcctHistory2);
+ fimSettAcctHistory2.setId(2L);
+ assertThat(fimSettAcctHistory1).isNotEqualTo(fimSettAcctHistory2);
+ fimSettAcctHistory1.setId(null);
+ assertThat(fimSettAcctHistory1).isNotEqualTo(fimSettAcctHistory2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimSettAcctTest.java b/src/test/java/com/scb/fimob/domain/FimSettAcctTest.java
new file mode 100644
index 0000000..1f84aca
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimSettAcctTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimSettAcct.class);
+ FimSettAcct fimSettAcct1 = new FimSettAcct();
+ fimSettAcct1.setId(1L);
+ FimSettAcct fimSettAcct2 = new FimSettAcct();
+ fimSettAcct2.setId(fimSettAcct1.getId());
+ assertThat(fimSettAcct1).isEqualTo(fimSettAcct2);
+ fimSettAcct2.setId(2L);
+ assertThat(fimSettAcct1).isNotEqualTo(fimSettAcct2);
+ fimSettAcct1.setId(null);
+ assertThat(fimSettAcct1).isNotEqualTo(fimSettAcct2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/domain/FimSettAcctWqTest.java b/src/test/java/com/scb/fimob/domain/FimSettAcctWqTest.java
new file mode 100644
index 0000000..83b7d42
--- /dev/null
+++ b/src/test/java/com/scb/fimob/domain/FimSettAcctWqTest.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctWqTest {
+
+ @Test
+ void equalsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimSettAcctWq.class);
+ FimSettAcctWq fimSettAcctWq1 = new FimSettAcctWq();
+ fimSettAcctWq1.setId(1L);
+ FimSettAcctWq fimSettAcctWq2 = new FimSettAcctWq();
+ fimSettAcctWq2.setId(fimSettAcctWq1.getId());
+ assertThat(fimSettAcctWq1).isEqualTo(fimSettAcctWq2);
+ fimSettAcctWq2.setId(2L);
+ assertThat(fimSettAcctWq1).isNotEqualTo(fimSettAcctWq2);
+ fimSettAcctWq1.setId(null);
+ assertThat(fimSettAcctWq1).isNotEqualTo(fimSettAcctWq2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/management/SecurityMetersServiceTests.java b/src/test/java/com/scb/fimob/management/SecurityMetersServiceTests.java
new file mode 100644
index 0000000..cd73c97
--- /dev/null
+++ b/src/test/java/com/scb/fimob/management/SecurityMetersServiceTests.java
@@ -0,0 +1,70 @@
+package com.scb.fimob.management;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import io.micrometer.core.instrument.Counter;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
+import java.util.Collection;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class SecurityMetersServiceTests {
+
+ private static final String INVALID_TOKENS_METER_EXPECTED_NAME = "security.authentication.invalid-tokens";
+
+ private MeterRegistry meterRegistry;
+
+ private SecurityMetersService securityMetersService;
+
+ @BeforeEach
+ public void setup() {
+ meterRegistry = new SimpleMeterRegistry();
+
+ securityMetersService = new SecurityMetersService(meterRegistry);
+ }
+
+ @Test
+ void testInvalidTokensCountersByCauseAreCreated() {
+ meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).counter();
+
+ meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter();
+
+ meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter();
+
+ meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter();
+
+ meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter();
+
+ Collection counters = meterRegistry.find(INVALID_TOKENS_METER_EXPECTED_NAME).counters();
+
+ assertThat(counters).hasSize(4);
+ }
+
+ @Test
+ void testCountMethodsShouldBeBoundToCorrectCounters() {
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isZero();
+
+ securityMetersService.trackTokenExpired();
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isEqualTo(1);
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isZero();
+
+ securityMetersService.trackTokenUnsupported();
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isEqualTo(1);
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isZero();
+
+ securityMetersService.trackTokenInvalidSignature();
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isEqualTo(1);
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isZero();
+
+ securityMetersService.trackTokenMalformed();
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isEqualTo(1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapper.java b/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapper.java
new file mode 100644
index 0000000..9e15d9c
--- /dev/null
+++ b/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapper.java
@@ -0,0 +1,133 @@
+package com.scb.fimob.repository.timezone;
+
+import java.io.Serializable;
+import java.time.*;
+import java.util.Objects;
+import javax.persistence.*;
+
+@Entity
+@Table(name = "jhi_date_time_wrapper")
+public class DateTimeWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
+ @SequenceGenerator(name = "sequenceGenerator")
+ private Long id;
+
+ @Column(name = "instant")
+ private Instant instant;
+
+ @Column(name = "local_date_time")
+ private LocalDateTime localDateTime;
+
+ @Column(name = "offset_date_time")
+ private OffsetDateTime offsetDateTime;
+
+ @Column(name = "zoned_date_time")
+ private ZonedDateTime zonedDateTime;
+
+ @Column(name = "local_time")
+ private LocalTime localTime;
+
+ @Column(name = "offset_time")
+ private OffsetTime offsetTime;
+
+ @Column(name = "local_date")
+ private LocalDate localDate;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Instant getInstant() {
+ return instant;
+ }
+
+ public void setInstant(Instant instant) {
+ this.instant = instant;
+ }
+
+ public LocalDateTime getLocalDateTime() {
+ return localDateTime;
+ }
+
+ public void setLocalDateTime(LocalDateTime localDateTime) {
+ this.localDateTime = localDateTime;
+ }
+
+ public OffsetDateTime getOffsetDateTime() {
+ return offsetDateTime;
+ }
+
+ public void setOffsetDateTime(OffsetDateTime offsetDateTime) {
+ this.offsetDateTime = offsetDateTime;
+ }
+
+ public ZonedDateTime getZonedDateTime() {
+ return zonedDateTime;
+ }
+
+ public void setZonedDateTime(ZonedDateTime zonedDateTime) {
+ this.zonedDateTime = zonedDateTime;
+ }
+
+ public LocalTime getLocalTime() {
+ return localTime;
+ }
+
+ public void setLocalTime(LocalTime localTime) {
+ this.localTime = localTime;
+ }
+
+ public OffsetTime getOffsetTime() {
+ return offsetTime;
+ }
+
+ public void setOffsetTime(OffsetTime offsetTime) {
+ this.offsetTime = offsetTime;
+ }
+
+ public LocalDate getLocalDate() {
+ return localDate;
+ }
+
+ public void setLocalDate(LocalDate localDate) {
+ this.localDate = localDate;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ DateTimeWrapper dateTimeWrapper = (DateTimeWrapper) o;
+ return !(dateTimeWrapper.getId() == null || getId() == null) && Objects.equals(getId(), dateTimeWrapper.getId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(getId());
+ }
+
+ // prettier-ignore
+ @Override
+ public String toString() {
+ return "TimeZoneTest{" +
+ "id=" + id +
+ ", instant=" + instant +
+ ", localDateTime=" + localDateTime +
+ ", offsetDateTime=" + offsetDateTime +
+ ", zonedDateTime=" + zonedDateTime +
+ '}';
+ }
+}
diff --git a/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapperRepository.java b/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapperRepository.java
new file mode 100644
index 0000000..291120d
--- /dev/null
+++ b/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapperRepository.java
@@ -0,0 +1,10 @@
+package com.scb.fimob.repository.timezone;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Spring Data JPA repository for the {@link DateTimeWrapper} entity.
+ */
+@Repository
+public interface DateTimeWrapperRepository extends JpaRepository {}
diff --git a/src/test/java/com/scb/fimob/security/SecurityUtilsUnitTest.java b/src/test/java/com/scb/fimob/security/SecurityUtilsUnitTest.java
new file mode 100644
index 0000000..f430f3c
--- /dev/null
+++ b/src/test/java/com/scb/fimob/security/SecurityUtilsUnitTest.java
@@ -0,0 +1,101 @@
+package com.scb.fimob.security;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Optional;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+/**
+ * Test class for the {@link SecurityUtils} utility class.
+ */
+class SecurityUtilsUnitTest {
+
+ @BeforeEach
+ @AfterEach
+ void cleanup() {
+ SecurityContextHolder.clearContext();
+ }
+
+ @Test
+ void testGetCurrentUserLogin() {
+ SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
+ securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin"));
+ SecurityContextHolder.setContext(securityContext);
+ Optional login = SecurityUtils.getCurrentUserLogin();
+ assertThat(login).contains("admin");
+ }
+
+ @Test
+ void testGetCurrentUserJWT() {
+ SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
+ securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "token"));
+ SecurityContextHolder.setContext(securityContext);
+ Optional jwt = SecurityUtils.getCurrentUserJWT();
+ assertThat(jwt).contains("token");
+ }
+
+ @Test
+ void testIsAuthenticated() {
+ SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
+ securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin"));
+ SecurityContextHolder.setContext(securityContext);
+ boolean isAuthenticated = SecurityUtils.isAuthenticated();
+ assertThat(isAuthenticated).isTrue();
+ }
+
+ @Test
+ void testAnonymousIsNotAuthenticated() {
+ SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
+ Collection authorities = new ArrayList<>();
+ authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS));
+ securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities));
+ SecurityContextHolder.setContext(securityContext);
+ boolean isAuthenticated = SecurityUtils.isAuthenticated();
+ assertThat(isAuthenticated).isFalse();
+ }
+
+ @Test
+ void testHasCurrentUserThisAuthority() {
+ SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
+ Collection authorities = new ArrayList<>();
+ authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER));
+ securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities));
+ SecurityContextHolder.setContext(securityContext);
+
+ assertThat(SecurityUtils.hasCurrentUserThisAuthority(AuthoritiesConstants.USER)).isTrue();
+ assertThat(SecurityUtils.hasCurrentUserThisAuthority(AuthoritiesConstants.ADMIN)).isFalse();
+ }
+
+ @Test
+ void testHasCurrentUserAnyOfAuthorities() {
+ SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
+ Collection authorities = new ArrayList<>();
+ authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER));
+ securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities));
+ SecurityContextHolder.setContext(securityContext);
+
+ assertThat(SecurityUtils.hasCurrentUserAnyOfAuthorities(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)).isTrue();
+ assertThat(SecurityUtils.hasCurrentUserAnyOfAuthorities(AuthoritiesConstants.ANONYMOUS, AuthoritiesConstants.ADMIN)).isFalse();
+ }
+
+ @Test
+ void testHasCurrentUserNoneOfAuthorities() {
+ SecurityContext securityContext = SecurityContextHolder.createEmptyContext();
+ Collection authorities = new ArrayList<>();
+ authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER));
+ securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities));
+ SecurityContextHolder.setContext(securityContext);
+
+ assertThat(SecurityUtils.hasCurrentUserNoneOfAuthorities(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)).isFalse();
+ assertThat(SecurityUtils.hasCurrentUserNoneOfAuthorities(AuthoritiesConstants.ANONYMOUS, AuthoritiesConstants.ADMIN)).isTrue();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/security/jwt/JWTFilterTest.java b/src/test/java/com/scb/fimob/security/jwt/JWTFilterTest.java
new file mode 100644
index 0000000..fb04042
--- /dev/null
+++ b/src/test/java/com/scb/fimob/security/jwt/JWTFilterTest.java
@@ -0,0 +1,117 @@
+package com.scb.fimob.security.jwt;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.management.SecurityMetersService;
+import com.scb.fimob.security.AuthoritiesConstants;
+import io.jsonwebtoken.io.Decoders;
+import io.jsonwebtoken.security.Keys;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
+import java.util.Collections;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.http.HttpStatus;
+import org.springframework.mock.web.MockFilterChain;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.test.util.ReflectionTestUtils;
+import tech.jhipster.config.JHipsterProperties;
+
+class JWTFilterTest {
+
+ private TokenProvider tokenProvider;
+
+ private JWTFilter jwtFilter;
+
+ @BeforeEach
+ public void setup() {
+ JHipsterProperties jHipsterProperties = new JHipsterProperties();
+ String base64Secret = "fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8";
+ jHipsterProperties.getSecurity().getAuthentication().getJwt().setBase64Secret(base64Secret);
+
+ SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry());
+
+ tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService);
+ ReflectionTestUtils.setField(tokenProvider, "key", Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64Secret)));
+
+ ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", 60000);
+ jwtFilter = new JWTFilter(tokenProvider);
+ SecurityContextHolder.getContext().setAuthentication(null);
+ }
+
+ @Test
+ void testJWTFilter() throws Exception {
+ UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
+ "test-user",
+ "test-password",
+ Collections.singletonList(new SimpleGrantedAuthority(AuthoritiesConstants.USER))
+ );
+ String jwt = tokenProvider.createToken(authentication, false);
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt);
+ request.setRequestURI("/api/test");
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ MockFilterChain filterChain = new MockFilterChain();
+ jwtFilter.doFilter(request, response, filterChain);
+ assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
+ assertThat(SecurityContextHolder.getContext().getAuthentication().getName()).isEqualTo("test-user");
+ assertThat(SecurityContextHolder.getContext().getAuthentication().getCredentials()).hasToString(jwt);
+ }
+
+ @Test
+ void testJWTFilterInvalidToken() throws Exception {
+ String jwt = "wrong_jwt";
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt);
+ request.setRequestURI("/api/test");
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ MockFilterChain filterChain = new MockFilterChain();
+ jwtFilter.doFilter(request, response, filterChain);
+ assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
+ assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull();
+ }
+
+ @Test
+ void testJWTFilterMissingAuthorization() throws Exception {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.setRequestURI("/api/test");
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ MockFilterChain filterChain = new MockFilterChain();
+ jwtFilter.doFilter(request, response, filterChain);
+ assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
+ assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull();
+ }
+
+ @Test
+ void testJWTFilterMissingToken() throws Exception {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer ");
+ request.setRequestURI("/api/test");
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ MockFilterChain filterChain = new MockFilterChain();
+ jwtFilter.doFilter(request, response, filterChain);
+ assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
+ assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull();
+ }
+
+ @Test
+ void testJWTFilterWrongScheme() throws Exception {
+ UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
+ "test-user",
+ "test-password",
+ Collections.singletonList(new SimpleGrantedAuthority(AuthoritiesConstants.USER))
+ );
+ String jwt = tokenProvider.createToken(authentication, false);
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Basic " + jwt);
+ request.setRequestURI("/api/test");
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ MockFilterChain filterChain = new MockFilterChain();
+ jwtFilter.doFilter(request, response, filterChain);
+ assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
+ assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/security/jwt/TokenProviderSecurityMetersTests.java b/src/test/java/com/scb/fimob/security/jwt/TokenProviderSecurityMetersTests.java
new file mode 100644
index 0000000..861803d
--- /dev/null
+++ b/src/test/java/com/scb/fimob/security/jwt/TokenProviderSecurityMetersTests.java
@@ -0,0 +1,158 @@
+package com.scb.fimob.security.jwt;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.management.SecurityMetersService;
+import com.scb.fimob.security.AuthoritiesConstants;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import io.jsonwebtoken.io.Decoders;
+import io.jsonwebtoken.security.Keys;
+import io.micrometer.core.instrument.Counter;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
+import java.security.Key;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.test.util.ReflectionTestUtils;
+import tech.jhipster.config.JHipsterProperties;
+
+class TokenProviderSecurityMetersTests {
+
+ private static final long ONE_MINUTE = 60000;
+ private static final String INVALID_TOKENS_METER_EXPECTED_NAME = "security.authentication.invalid-tokens";
+
+ private MeterRegistry meterRegistry;
+
+ private TokenProvider tokenProvider;
+
+ @BeforeEach
+ public void setup() {
+ JHipsterProperties jHipsterProperties = new JHipsterProperties();
+ String base64Secret = "fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8";
+ jHipsterProperties.getSecurity().getAuthentication().getJwt().setBase64Secret(base64Secret);
+
+ meterRegistry = new SimpleMeterRegistry();
+
+ SecurityMetersService securityMetersService = new SecurityMetersService(meterRegistry);
+
+ tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService);
+ Key key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64Secret));
+
+ ReflectionTestUtils.setField(tokenProvider, "key", key);
+ ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", ONE_MINUTE);
+ }
+
+ @Test
+ void testValidTokenShouldNotCountAnything() {
+ Collection counters = meterRegistry.find(INVALID_TOKENS_METER_EXPECTED_NAME).counters();
+
+ assertThat(aggregate(counters)).isZero();
+
+ String validToken = createValidToken();
+
+ tokenProvider.validateToken(validToken);
+
+ assertThat(aggregate(counters)).isZero();
+ }
+
+ @Test
+ void testTokenExpiredCount() {
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isZero();
+
+ String expiredToken = createExpiredToken();
+
+ tokenProvider.validateToken(expiredToken);
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isEqualTo(1);
+ }
+
+ @Test
+ void testTokenUnsupportedCount() {
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isZero();
+
+ String unsupportedToken = createUnsupportedToken();
+
+ tokenProvider.validateToken(unsupportedToken);
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isEqualTo(1);
+ }
+
+ @Test
+ void testTokenSignatureInvalidCount() {
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isZero();
+
+ String tokenWithDifferentSignature = createTokenWithDifferentSignature();
+
+ tokenProvider.validateToken(tokenWithDifferentSignature);
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isEqualTo(1);
+ }
+
+ @Test
+ void testTokenMalformedCount() {
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isZero();
+
+ String malformedToken = createMalformedToken();
+
+ tokenProvider.validateToken(malformedToken);
+
+ assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isEqualTo(1);
+ }
+
+ private String createValidToken() {
+ Authentication authentication = createAuthentication();
+
+ return tokenProvider.createToken(authentication, false);
+ }
+
+ private String createExpiredToken() {
+ ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", -ONE_MINUTE);
+
+ Authentication authentication = createAuthentication();
+
+ return tokenProvider.createToken(authentication, false);
+ }
+
+ private Authentication createAuthentication() {
+ Collection authorities = new ArrayList<>();
+ authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS));
+ return new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities);
+ }
+
+ private String createUnsupportedToken() {
+ Key key = (Key) ReflectionTestUtils.getField(tokenProvider, "key");
+
+ return Jwts.builder().setPayload("payload").signWith(key, SignatureAlgorithm.HS256).compact();
+ }
+
+ private String createMalformedToken() {
+ String validToken = createValidToken();
+
+ return "X" + validToken;
+ }
+
+ private String createTokenWithDifferentSignature() {
+ Key otherKey = Keys.hmacShaKeyFor(
+ Decoders.BASE64.decode("Xfd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8")
+ );
+
+ return Jwts
+ .builder()
+ .setSubject("anonymous")
+ .signWith(otherKey, SignatureAlgorithm.HS512)
+ .setExpiration(new Date(new Date().getTime() + ONE_MINUTE))
+ .compact();
+ }
+
+ private double aggregate(Collection counters) {
+ return counters.stream().mapToDouble(Counter::count).sum();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/security/jwt/TokenProviderTest.java b/src/test/java/com/scb/fimob/security/jwt/TokenProviderTest.java
new file mode 100644
index 0000000..c69f0fa
--- /dev/null
+++ b/src/test/java/com/scb/fimob/security/jwt/TokenProviderTest.java
@@ -0,0 +1,141 @@
+package com.scb.fimob.security.jwt;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.management.SecurityMetersService;
+import com.scb.fimob.security.AuthoritiesConstants;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import io.jsonwebtoken.io.Decoders;
+import io.jsonwebtoken.security.Keys;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
+import java.nio.charset.StandardCharsets;
+import java.security.Key;
+import java.util.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.test.util.ReflectionTestUtils;
+import tech.jhipster.config.JHipsterProperties;
+
+class TokenProviderTest {
+
+ private static final long ONE_MINUTE = 60000;
+
+ private Key key;
+ private TokenProvider tokenProvider;
+
+ @BeforeEach
+ public void setup() {
+ JHipsterProperties jHipsterProperties = new JHipsterProperties();
+ String base64Secret = "fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8";
+ jHipsterProperties.getSecurity().getAuthentication().getJwt().setBase64Secret(base64Secret);
+
+ SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry());
+
+ tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService);
+ key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64Secret));
+
+ ReflectionTestUtils.setField(tokenProvider, "key", key);
+ ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", ONE_MINUTE);
+ }
+
+ @Test
+ void testReturnFalseWhenJWThasInvalidSignature() {
+ boolean isTokenValid = tokenProvider.validateToken(createTokenWithDifferentSignature());
+
+ assertThat(isTokenValid).isFalse();
+ }
+
+ @Test
+ void testReturnFalseWhenJWTisMalformed() {
+ Authentication authentication = createAuthentication();
+ String token = tokenProvider.createToken(authentication, false);
+ String invalidToken = token.substring(1);
+ boolean isTokenValid = tokenProvider.validateToken(invalidToken);
+
+ assertThat(isTokenValid).isFalse();
+ }
+
+ @Test
+ void testReturnFalseWhenJWTisExpired() {
+ ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", -ONE_MINUTE);
+
+ Authentication authentication = createAuthentication();
+ String token = tokenProvider.createToken(authentication, false);
+
+ boolean isTokenValid = tokenProvider.validateToken(token);
+
+ assertThat(isTokenValid).isFalse();
+ }
+
+ @Test
+ void testReturnFalseWhenJWTisUnsupported() {
+ String unsupportedToken = createUnsupportedToken();
+
+ boolean isTokenValid = tokenProvider.validateToken(unsupportedToken);
+
+ assertThat(isTokenValid).isFalse();
+ }
+
+ @Test
+ void testReturnFalseWhenJWTisInvalid() {
+ boolean isTokenValid = tokenProvider.validateToken("");
+
+ assertThat(isTokenValid).isFalse();
+ }
+
+ @Test
+ void testKeyIsSetFromSecretWhenSecretIsNotEmpty() {
+ final String secret = "NwskoUmKHZtzGRKJKVjsJF7BtQMMxNWi";
+ JHipsterProperties jHipsterProperties = new JHipsterProperties();
+ jHipsterProperties.getSecurity().getAuthentication().getJwt().setSecret(secret);
+
+ SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry());
+
+ TokenProvider tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService);
+
+ Key key = (Key) ReflectionTestUtils.getField(tokenProvider, "key");
+ assertThat(key).isNotNull().isEqualTo(Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8)));
+ }
+
+ @Test
+ void testKeyIsSetFromBase64SecretWhenSecretIsEmpty() {
+ final String base64Secret = "fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8";
+ JHipsterProperties jHipsterProperties = new JHipsterProperties();
+ jHipsterProperties.getSecurity().getAuthentication().getJwt().setBase64Secret(base64Secret);
+
+ SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry());
+
+ TokenProvider tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService);
+
+ Key key = (Key) ReflectionTestUtils.getField(tokenProvider, "key");
+ assertThat(key).isNotNull().isEqualTo(Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64Secret)));
+ }
+
+ private Authentication createAuthentication() {
+ Collection authorities = new ArrayList<>();
+ authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS));
+ return new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities);
+ }
+
+ private String createUnsupportedToken() {
+ return Jwts.builder().setPayload("payload").signWith(key, SignatureAlgorithm.HS512).compact();
+ }
+
+ private String createTokenWithDifferentSignature() {
+ Key otherKey = Keys.hmacShaKeyFor(
+ Decoders.BASE64.decode("Xfd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8")
+ );
+
+ return Jwts
+ .builder()
+ .setSubject("anonymous")
+ .signWith(otherKey, SignatureAlgorithm.HS512)
+ .setExpiration(new Date(new Date().getTime() + ONE_MINUTE))
+ .compact();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/EthnicityDTOTest.java b/src/test/java/com/scb/fimob/service/dto/EthnicityDTOTest.java
new file mode 100644
index 0000000..726f976
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/EthnicityDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class EthnicityDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(EthnicityDTO.class);
+ EthnicityDTO ethnicityDTO1 = new EthnicityDTO();
+ ethnicityDTO1.setId(1L);
+ EthnicityDTO ethnicityDTO2 = new EthnicityDTO();
+ assertThat(ethnicityDTO1).isNotEqualTo(ethnicityDTO2);
+ ethnicityDTO2.setId(ethnicityDTO1.getId());
+ assertThat(ethnicityDTO1).isEqualTo(ethnicityDTO2);
+ ethnicityDTO2.setId(2L);
+ assertThat(ethnicityDTO1).isNotEqualTo(ethnicityDTO2);
+ ethnicityDTO1.setId(null);
+ assertThat(ethnicityDTO1).isNotEqualTo(ethnicityDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimAccountsDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimAccountsDTOTest.java
new file mode 100644
index 0000000..eda8a6b
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimAccountsDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimAccountsDTO.class);
+ FimAccountsDTO fimAccountsDTO1 = new FimAccountsDTO();
+ fimAccountsDTO1.setId(1L);
+ FimAccountsDTO fimAccountsDTO2 = new FimAccountsDTO();
+ assertThat(fimAccountsDTO1).isNotEqualTo(fimAccountsDTO2);
+ fimAccountsDTO2.setId(fimAccountsDTO1.getId());
+ assertThat(fimAccountsDTO1).isEqualTo(fimAccountsDTO2);
+ fimAccountsDTO2.setId(2L);
+ assertThat(fimAccountsDTO1).isNotEqualTo(fimAccountsDTO2);
+ fimAccountsDTO1.setId(null);
+ assertThat(fimAccountsDTO1).isNotEqualTo(fimAccountsDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimAccountsHistoryDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimAccountsHistoryDTOTest.java
new file mode 100644
index 0000000..502ac38
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimAccountsHistoryDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsHistoryDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimAccountsHistoryDTO.class);
+ FimAccountsHistoryDTO fimAccountsHistoryDTO1 = new FimAccountsHistoryDTO();
+ fimAccountsHistoryDTO1.setId(1L);
+ FimAccountsHistoryDTO fimAccountsHistoryDTO2 = new FimAccountsHistoryDTO();
+ assertThat(fimAccountsHistoryDTO1).isNotEqualTo(fimAccountsHistoryDTO2);
+ fimAccountsHistoryDTO2.setId(fimAccountsHistoryDTO1.getId());
+ assertThat(fimAccountsHistoryDTO1).isEqualTo(fimAccountsHistoryDTO2);
+ fimAccountsHistoryDTO2.setId(2L);
+ assertThat(fimAccountsHistoryDTO1).isNotEqualTo(fimAccountsHistoryDTO2);
+ fimAccountsHistoryDTO1.setId(null);
+ assertThat(fimAccountsHistoryDTO1).isNotEqualTo(fimAccountsHistoryDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimAccountsWqDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimAccountsWqDTOTest.java
new file mode 100644
index 0000000..507b153
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimAccountsWqDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsWqDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimAccountsWqDTO.class);
+ FimAccountsWqDTO fimAccountsWqDTO1 = new FimAccountsWqDTO();
+ fimAccountsWqDTO1.setId(1L);
+ FimAccountsWqDTO fimAccountsWqDTO2 = new FimAccountsWqDTO();
+ assertThat(fimAccountsWqDTO1).isNotEqualTo(fimAccountsWqDTO2);
+ fimAccountsWqDTO2.setId(fimAccountsWqDTO1.getId());
+ assertThat(fimAccountsWqDTO1).isEqualTo(fimAccountsWqDTO2);
+ fimAccountsWqDTO2.setId(2L);
+ assertThat(fimAccountsWqDTO1).isNotEqualTo(fimAccountsWqDTO2);
+ fimAccountsWqDTO1.setId(null);
+ assertThat(fimAccountsWqDTO1).isNotEqualTo(fimAccountsWqDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimCustDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimCustDTOTest.java
new file mode 100644
index 0000000..8c1adb6
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimCustDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimCustDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimCustDTO.class);
+ FimCustDTO fimCustDTO1 = new FimCustDTO();
+ fimCustDTO1.setId(1L);
+ FimCustDTO fimCustDTO2 = new FimCustDTO();
+ assertThat(fimCustDTO1).isNotEqualTo(fimCustDTO2);
+ fimCustDTO2.setId(fimCustDTO1.getId());
+ assertThat(fimCustDTO1).isEqualTo(fimCustDTO2);
+ fimCustDTO2.setId(2L);
+ assertThat(fimCustDTO1).isNotEqualTo(fimCustDTO2);
+ fimCustDTO1.setId(null);
+ assertThat(fimCustDTO1).isNotEqualTo(fimCustDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimCustHistoryDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimCustHistoryDTOTest.java
new file mode 100644
index 0000000..05c1bd6
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimCustHistoryDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimCustHistoryDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimCustHistoryDTO.class);
+ FimCustHistoryDTO fimCustHistoryDTO1 = new FimCustHistoryDTO();
+ fimCustHistoryDTO1.setId(1L);
+ FimCustHistoryDTO fimCustHistoryDTO2 = new FimCustHistoryDTO();
+ assertThat(fimCustHistoryDTO1).isNotEqualTo(fimCustHistoryDTO2);
+ fimCustHistoryDTO2.setId(fimCustHistoryDTO1.getId());
+ assertThat(fimCustHistoryDTO1).isEqualTo(fimCustHistoryDTO2);
+ fimCustHistoryDTO2.setId(2L);
+ assertThat(fimCustHistoryDTO1).isNotEqualTo(fimCustHistoryDTO2);
+ fimCustHistoryDTO1.setId(null);
+ assertThat(fimCustHistoryDTO1).isNotEqualTo(fimCustHistoryDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimCustWqDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimCustWqDTOTest.java
new file mode 100644
index 0000000..4150392
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimCustWqDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimCustWqDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimCustWqDTO.class);
+ FimCustWqDTO fimCustWqDTO1 = new FimCustWqDTO();
+ fimCustWqDTO1.setId(1L);
+ FimCustWqDTO fimCustWqDTO2 = new FimCustWqDTO();
+ assertThat(fimCustWqDTO1).isNotEqualTo(fimCustWqDTO2);
+ fimCustWqDTO2.setId(fimCustWqDTO1.getId());
+ assertThat(fimCustWqDTO1).isEqualTo(fimCustWqDTO2);
+ fimCustWqDTO2.setId(2L);
+ assertThat(fimCustWqDTO1).isNotEqualTo(fimCustWqDTO2);
+ fimCustWqDTO1.setId(null);
+ assertThat(fimCustWqDTO1).isNotEqualTo(fimCustWqDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimSettAcctDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimSettAcctDTOTest.java
new file mode 100644
index 0000000..5dc4c4d
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimSettAcctDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimSettAcctDTO.class);
+ FimSettAcctDTO fimSettAcctDTO1 = new FimSettAcctDTO();
+ fimSettAcctDTO1.setId(1L);
+ FimSettAcctDTO fimSettAcctDTO2 = new FimSettAcctDTO();
+ assertThat(fimSettAcctDTO1).isNotEqualTo(fimSettAcctDTO2);
+ fimSettAcctDTO2.setId(fimSettAcctDTO1.getId());
+ assertThat(fimSettAcctDTO1).isEqualTo(fimSettAcctDTO2);
+ fimSettAcctDTO2.setId(2L);
+ assertThat(fimSettAcctDTO1).isNotEqualTo(fimSettAcctDTO2);
+ fimSettAcctDTO1.setId(null);
+ assertThat(fimSettAcctDTO1).isNotEqualTo(fimSettAcctDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTOTest.java
new file mode 100644
index 0000000..e4a91b6
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctHistoryDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimSettAcctHistoryDTO.class);
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO1 = new FimSettAcctHistoryDTO();
+ fimSettAcctHistoryDTO1.setId(1L);
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO2 = new FimSettAcctHistoryDTO();
+ assertThat(fimSettAcctHistoryDTO1).isNotEqualTo(fimSettAcctHistoryDTO2);
+ fimSettAcctHistoryDTO2.setId(fimSettAcctHistoryDTO1.getId());
+ assertThat(fimSettAcctHistoryDTO1).isEqualTo(fimSettAcctHistoryDTO2);
+ fimSettAcctHistoryDTO2.setId(2L);
+ assertThat(fimSettAcctHistoryDTO1).isNotEqualTo(fimSettAcctHistoryDTO2);
+ fimSettAcctHistoryDTO1.setId(null);
+ assertThat(fimSettAcctHistoryDTO1).isNotEqualTo(fimSettAcctHistoryDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/dto/FimSettAcctWqDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimSettAcctWqDTOTest.java
new file mode 100644
index 0000000..cccab5f
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/dto/FimSettAcctWqDTOTest.java
@@ -0,0 +1,24 @@
+package com.scb.fimob.service.dto;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.scb.fimob.web.rest.TestUtil;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctWqDTOTest {
+
+ @Test
+ void dtoEqualsVerifier() throws Exception {
+ TestUtil.equalsVerifier(FimSettAcctWqDTO.class);
+ FimSettAcctWqDTO fimSettAcctWqDTO1 = new FimSettAcctWqDTO();
+ fimSettAcctWqDTO1.setId(1L);
+ FimSettAcctWqDTO fimSettAcctWqDTO2 = new FimSettAcctWqDTO();
+ assertThat(fimSettAcctWqDTO1).isNotEqualTo(fimSettAcctWqDTO2);
+ fimSettAcctWqDTO2.setId(fimSettAcctWqDTO1.getId());
+ assertThat(fimSettAcctWqDTO1).isEqualTo(fimSettAcctWqDTO2);
+ fimSettAcctWqDTO2.setId(2L);
+ assertThat(fimSettAcctWqDTO1).isNotEqualTo(fimSettAcctWqDTO2);
+ fimSettAcctWqDTO1.setId(null);
+ assertThat(fimSettAcctWqDTO1).isNotEqualTo(fimSettAcctWqDTO2);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/EthnicityMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/EthnicityMapperTest.java
new file mode 100644
index 0000000..c33e504
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/EthnicityMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class EthnicityMapperTest {
+
+ private EthnicityMapper ethnicityMapper;
+
+ @BeforeEach
+ public void setUp() {
+ ethnicityMapper = new EthnicityMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapperTest.java
new file mode 100644
index 0000000..ce50f0c
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsHistoryMapperTest {
+
+ private FimAccountsHistoryMapper fimAccountsHistoryMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimAccountsHistoryMapper = new FimAccountsHistoryMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimAccountsMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimAccountsMapperTest.java
new file mode 100644
index 0000000..b378bf4
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimAccountsMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsMapperTest {
+
+ private FimAccountsMapper fimAccountsMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimAccountsMapper = new FimAccountsMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimAccountsWqMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimAccountsWqMapperTest.java
new file mode 100644
index 0000000..00b5bbf
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimAccountsWqMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimAccountsWqMapperTest {
+
+ private FimAccountsWqMapper fimAccountsWqMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimAccountsWqMapper = new FimAccountsWqMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimCustHistoryMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimCustHistoryMapperTest.java
new file mode 100644
index 0000000..df2da04
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimCustHistoryMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimCustHistoryMapperTest {
+
+ private FimCustHistoryMapper fimCustHistoryMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimCustHistoryMapper = new FimCustHistoryMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimCustMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimCustMapperTest.java
new file mode 100644
index 0000000..4fb346e
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimCustMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimCustMapperTest {
+
+ private FimCustMapper fimCustMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimCustMapper = new FimCustMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimCustWqMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimCustWqMapperTest.java
new file mode 100644
index 0000000..4459405
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimCustWqMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimCustWqMapperTest {
+
+ private FimCustWqMapper fimCustWqMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimCustWqMapper = new FimCustWqMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapperTest.java
new file mode 100644
index 0000000..7da3208
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctHistoryMapperTest {
+
+ private FimSettAcctHistoryMapper fimSettAcctHistoryMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimSettAcctHistoryMapper = new FimSettAcctHistoryMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimSettAcctMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctMapperTest.java
new file mode 100644
index 0000000..4b700e2
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctMapperTest {
+
+ private FimSettAcctMapper fimSettAcctMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimSettAcctMapper = new FimSettAcctMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/service/mapper/FimSettAcctWqMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctWqMapperTest.java
new file mode 100644
index 0000000..b6aa039
--- /dev/null
+++ b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctWqMapperTest.java
@@ -0,0 +1,16 @@
+package com.scb.fimob.service.mapper;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class FimSettAcctWqMapperTest {
+
+ private FimSettAcctWqMapper fimSettAcctWqMapper;
+
+ @BeforeEach
+ public void setUp() {
+ fimSettAcctWqMapper = new FimSettAcctWqMapperImpl();
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/EthnicityResourceIT.java b/src/test/java/com/scb/fimob/web/rest/EthnicityResourceIT.java
new file mode 100644
index 0000000..76398fd
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/EthnicityResourceIT.java
@@ -0,0 +1,421 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.Ethnicity;
+import com.scb.fimob.repository.EthnicityRepository;
+import com.scb.fimob.service.dto.EthnicityDTO;
+import com.scb.fimob.service.mapper.EthnicityMapper;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link EthnicityResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class EthnicityResourceIT {
+
+ private static final String DEFAULT_NAME = "AAAAAAAAAA";
+ private static final String UPDATED_NAME = "BBBBBBBBBB";
+
+ private static final String DEFAULT_URDU_NAME = "AAAAAAAAAA";
+ private static final String UPDATED_URDU_NAME = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/ethnicities";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private EthnicityRepository ethnicityRepository;
+
+ @Autowired
+ private EthnicityMapper ethnicityMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restEthnicityMockMvc;
+
+ private Ethnicity ethnicity;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static Ethnicity createEntity(EntityManager em) {
+ Ethnicity ethnicity = new Ethnicity().name(DEFAULT_NAME).urduName(DEFAULT_URDU_NAME);
+ return ethnicity;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static Ethnicity createUpdatedEntity(EntityManager em) {
+ Ethnicity ethnicity = new Ethnicity().name(UPDATED_NAME).urduName(UPDATED_URDU_NAME);
+ return ethnicity;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ ethnicity = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createEthnicity() throws Exception {
+ int databaseSizeBeforeCreate = ethnicityRepository.findAll().size();
+ // Create the Ethnicity
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+ restEthnicityMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)))
+ .andExpect(status().isCreated());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeCreate + 1);
+ Ethnicity testEthnicity = ethnicityList.get(ethnicityList.size() - 1);
+ assertThat(testEthnicity.getName()).isEqualTo(DEFAULT_NAME);
+ assertThat(testEthnicity.getUrduName()).isEqualTo(DEFAULT_URDU_NAME);
+ }
+
+ @Test
+ @Transactional
+ void createEthnicityWithExistingId() throws Exception {
+ // Create the Ethnicity with an existing ID
+ ethnicity.setId(1L);
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+
+ int databaseSizeBeforeCreate = ethnicityRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restEthnicityMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)))
+ .andExpect(status().isBadRequest());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkNameIsRequired() throws Exception {
+ int databaseSizeBeforeTest = ethnicityRepository.findAll().size();
+ // set the field null
+ ethnicity.setName(null);
+
+ // Create the Ethnicity, which fails.
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+
+ restEthnicityMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)))
+ .andExpect(status().isBadRequest());
+
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllEthnicities() throws Exception {
+ // Initialize the database
+ ethnicityRepository.saveAndFlush(ethnicity);
+
+ // Get all the ethnicityList
+ restEthnicityMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(ethnicity.getId().intValue())))
+ .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME)))
+ .andExpect(jsonPath("$.[*].urduName").value(hasItem(DEFAULT_URDU_NAME)));
+ }
+
+ @Test
+ @Transactional
+ void getEthnicity() throws Exception {
+ // Initialize the database
+ ethnicityRepository.saveAndFlush(ethnicity);
+
+ // Get the ethnicity
+ restEthnicityMockMvc
+ .perform(get(ENTITY_API_URL_ID, ethnicity.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(ethnicity.getId().intValue()))
+ .andExpect(jsonPath("$.name").value(DEFAULT_NAME))
+ .andExpect(jsonPath("$.urduName").value(DEFAULT_URDU_NAME));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingEthnicity() throws Exception {
+ // Get the ethnicity
+ restEthnicityMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewEthnicity() throws Exception {
+ // Initialize the database
+ ethnicityRepository.saveAndFlush(ethnicity);
+
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+
+ // Update the ethnicity
+ Ethnicity updatedEthnicity = ethnicityRepository.findById(ethnicity.getId()).get();
+ // Disconnect from session so that the updates on updatedEthnicity are not directly saved in db
+ em.detach(updatedEthnicity);
+ updatedEthnicity.name(UPDATED_NAME).urduName(UPDATED_URDU_NAME);
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(updatedEthnicity);
+
+ restEthnicityMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, ethnicityDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ Ethnicity testEthnicity = ethnicityList.get(ethnicityList.size() - 1);
+ assertThat(testEthnicity.getName()).isEqualTo(UPDATED_NAME);
+ assertThat(testEthnicity.getUrduName()).isEqualTo(UPDATED_URDU_NAME);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingEthnicity() throws Exception {
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+ ethnicity.setId(count.incrementAndGet());
+
+ // Create the Ethnicity
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restEthnicityMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, ethnicityDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchEthnicity() throws Exception {
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+ ethnicity.setId(count.incrementAndGet());
+
+ // Create the Ethnicity
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restEthnicityMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamEthnicity() throws Exception {
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+ ethnicity.setId(count.incrementAndGet());
+
+ // Create the Ethnicity
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restEthnicityMockMvc
+ .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)))
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateEthnicityWithPatch() throws Exception {
+ // Initialize the database
+ ethnicityRepository.saveAndFlush(ethnicity);
+
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+
+ // Update the ethnicity using partial update
+ Ethnicity partialUpdatedEthnicity = new Ethnicity();
+ partialUpdatedEthnicity.setId(ethnicity.getId());
+
+ partialUpdatedEthnicity.name(UPDATED_NAME).urduName(UPDATED_URDU_NAME);
+
+ restEthnicityMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedEthnicity.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedEthnicity))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ Ethnicity testEthnicity = ethnicityList.get(ethnicityList.size() - 1);
+ assertThat(testEthnicity.getName()).isEqualTo(UPDATED_NAME);
+ assertThat(testEthnicity.getUrduName()).isEqualTo(UPDATED_URDU_NAME);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateEthnicityWithPatch() throws Exception {
+ // Initialize the database
+ ethnicityRepository.saveAndFlush(ethnicity);
+
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+
+ // Update the ethnicity using partial update
+ Ethnicity partialUpdatedEthnicity = new Ethnicity();
+ partialUpdatedEthnicity.setId(ethnicity.getId());
+
+ partialUpdatedEthnicity.name(UPDATED_NAME).urduName(UPDATED_URDU_NAME);
+
+ restEthnicityMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedEthnicity.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedEthnicity))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ Ethnicity testEthnicity = ethnicityList.get(ethnicityList.size() - 1);
+ assertThat(testEthnicity.getName()).isEqualTo(UPDATED_NAME);
+ assertThat(testEthnicity.getUrduName()).isEqualTo(UPDATED_URDU_NAME);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingEthnicity() throws Exception {
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+ ethnicity.setId(count.incrementAndGet());
+
+ // Create the Ethnicity
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restEthnicityMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, ethnicityDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchEthnicity() throws Exception {
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+ ethnicity.setId(count.incrementAndGet());
+
+ // Create the Ethnicity
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restEthnicityMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamEthnicity() throws Exception {
+ int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size();
+ ethnicity.setId(count.incrementAndGet());
+
+ // Create the Ethnicity
+ EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restEthnicityMockMvc
+ .perform(
+ patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the Ethnicity in the database
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteEthnicity() throws Exception {
+ // Initialize the database
+ ethnicityRepository.saveAndFlush(ethnicity);
+
+ int databaseSizeBeforeDelete = ethnicityRepository.findAll().size();
+
+ // Delete the ethnicity
+ restEthnicityMockMvc
+ .perform(delete(ENTITY_API_URL_ID, ethnicity.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List ethnicityList = ethnicityRepository.findAll();
+ assertThat(ethnicityList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimAccountsHistoryResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimAccountsHistoryResourceIT.java
new file mode 100644
index 0000000..8a73f07
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimAccountsHistoryResourceIT.java
@@ -0,0 +1,807 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimAccountsHistory;
+import com.scb.fimob.repository.FimAccountsHistoryRepository;
+import com.scb.fimob.service.dto.FimAccountsHistoryDTO;
+import com.scb.fimob.service.mapper.FimAccountsHistoryMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimAccountsHistoryResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimAccountsHistoryResourceIT {
+
+ private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB";
+
+ private static final Instant DEFAULT_HISTORY_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_HISTORY_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_CUST_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CUST_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_RELN_ID = "AAAAAAAAAA";
+ private static final String UPDATED_RELN_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_RELN_TYPE = "AAAAA";
+ private static final String UPDATED_RELN_TYPE = "BBBBB";
+
+ private static final String DEFAULT_OPER_INST = "AAAAAAAAAA";
+ private static final String UPDATED_OPER_INST = "BBBBBBBBBB";
+
+ private static final String DEFAULT_IS_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_IS_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_BND_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_BND_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CLOSING_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CLOSING_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SUB_SEGMENT = "AAAAAAAAAA";
+ private static final String UPDATED_SUB_SEGMENT = "BBBBBBBBBB";
+
+ private static final String DEFAULT_BRANCH_CODE = "AAAAAAAAAA";
+ private static final String UPDATED_BRANCH_CODE = "BBBBBBBBBB";
+
+ private static final String DEFAULT_ACCT_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_ACCT_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CTRY_CODE = "AAA";
+ private static final String UPDATED_CTRY_CODE = "BBB";
+
+ private static final String DEFAULT_ACCT_OWNERS = "AAAAAAAAAA";
+ private static final String UPDATED_ACCT_OWNERS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_REMARKS = "AAAAAAAAAA";
+ private static final String UPDATED_REMARKS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-accounts-histories";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimAccountsHistoryRepository fimAccountsHistoryRepository;
+
+ @Autowired
+ private FimAccountsHistoryMapper fimAccountsHistoryMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimAccountsHistoryMockMvc;
+
+ private FimAccountsHistory fimAccountsHistory;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimAccountsHistory createEntity(EntityManager em) {
+ FimAccountsHistory fimAccountsHistory = new FimAccountsHistory()
+ .accountId(DEFAULT_ACCOUNT_ID)
+ .historyTs(DEFAULT_HISTORY_TS)
+ .custId(DEFAULT_CUST_ID)
+ .relnId(DEFAULT_RELN_ID)
+ .relnType(DEFAULT_RELN_TYPE)
+ .operInst(DEFAULT_OPER_INST)
+ .isAcctNbr(DEFAULT_IS_ACCT_NBR)
+ .bndAcctNbr(DEFAULT_BND_ACCT_NBR)
+ .closingId(DEFAULT_CLOSING_ID)
+ .subSegment(DEFAULT_SUB_SEGMENT)
+ .branchCode(DEFAULT_BRANCH_CODE)
+ .acctStatus(DEFAULT_ACCT_STATUS)
+ .ctryCode(DEFAULT_CTRY_CODE)
+ .acctOwners(DEFAULT_ACCT_OWNERS)
+ .remarks(DEFAULT_REMARKS)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS);
+ return fimAccountsHistory;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimAccountsHistory createUpdatedEntity(EntityManager em) {
+ FimAccountsHistory fimAccountsHistory = new FimAccountsHistory()
+ .accountId(UPDATED_ACCOUNT_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ return fimAccountsHistory;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimAccountsHistory = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimAccountsHistory() throws Exception {
+ int databaseSizeBeforeCreate = fimAccountsHistoryRepository.findAll().size();
+ // Create the FimAccountsHistory
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+ restFimAccountsHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isCreated());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeCreate + 1);
+ FimAccountsHistory testFimAccountsHistory = fimAccountsHistoryList.get(fimAccountsHistoryList.size() - 1);
+ assertThat(testFimAccountsHistory.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimAccountsHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS);
+ assertThat(testFimAccountsHistory.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimAccountsHistory.getRelnId()).isEqualTo(DEFAULT_RELN_ID);
+ assertThat(testFimAccountsHistory.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE);
+ assertThat(testFimAccountsHistory.getOperInst()).isEqualTo(DEFAULT_OPER_INST);
+ assertThat(testFimAccountsHistory.getIsAcctNbr()).isEqualTo(DEFAULT_IS_ACCT_NBR);
+ assertThat(testFimAccountsHistory.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR);
+ assertThat(testFimAccountsHistory.getClosingId()).isEqualTo(DEFAULT_CLOSING_ID);
+ assertThat(testFimAccountsHistory.getSubSegment()).isEqualTo(DEFAULT_SUB_SEGMENT);
+ assertThat(testFimAccountsHistory.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE);
+ assertThat(testFimAccountsHistory.getAcctStatus()).isEqualTo(DEFAULT_ACCT_STATUS);
+ assertThat(testFimAccountsHistory.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimAccountsHistory.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS);
+ assertThat(testFimAccountsHistory.getRemarks()).isEqualTo(DEFAULT_REMARKS);
+ assertThat(testFimAccountsHistory.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimAccountsHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimAccountsHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimAccountsHistory.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimAccountsHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void createFimAccountsHistoryWithExistingId() throws Exception {
+ // Create the FimAccountsHistory with an existing ID
+ fimAccountsHistory.setId(1L);
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ int databaseSizeBeforeCreate = fimAccountsHistoryRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimAccountsHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkCustIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size();
+ // set the field null
+ fimAccountsHistory.setCustId(null);
+
+ // Create the FimAccountsHistory, which fails.
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkRelnIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size();
+ // set the field null
+ fimAccountsHistory.setRelnId(null);
+
+ // Create the FimAccountsHistory, which fails.
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkRelnTypeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size();
+ // set the field null
+ fimAccountsHistory.setRelnType(null);
+
+ // Create the FimAccountsHistory, which fails.
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkIsAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size();
+ // set the field null
+ fimAccountsHistory.setIsAcctNbr(null);
+
+ // Create the FimAccountsHistory, which fails.
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkBndAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size();
+ // set the field null
+ fimAccountsHistory.setBndAcctNbr(null);
+
+ // Create the FimAccountsHistory, which fails.
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkAcctStatusIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size();
+ // set the field null
+ fimAccountsHistory.setAcctStatus(null);
+
+ // Create the FimAccountsHistory, which fails.
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimAccountsHistories() throws Exception {
+ // Initialize the database
+ fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory);
+
+ // Get all the fimAccountsHistoryList
+ restFimAccountsHistoryMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimAccountsHistory.getId().intValue())))
+ .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID)))
+ .andExpect(jsonPath("$.[*].historyTs").value(hasItem(DEFAULT_HISTORY_TS.toString())))
+ .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID)))
+ .andExpect(jsonPath("$.[*].relnId").value(hasItem(DEFAULT_RELN_ID)))
+ .andExpect(jsonPath("$.[*].relnType").value(hasItem(DEFAULT_RELN_TYPE)))
+ .andExpect(jsonPath("$.[*].operInst").value(hasItem(DEFAULT_OPER_INST)))
+ .andExpect(jsonPath("$.[*].isAcctNbr").value(hasItem(DEFAULT_IS_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].bndAcctNbr").value(hasItem(DEFAULT_BND_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].closingId").value(hasItem(DEFAULT_CLOSING_ID)))
+ .andExpect(jsonPath("$.[*].subSegment").value(hasItem(DEFAULT_SUB_SEGMENT)))
+ .andExpect(jsonPath("$.[*].branchCode").value(hasItem(DEFAULT_BRANCH_CODE)))
+ .andExpect(jsonPath("$.[*].acctStatus").value(hasItem(DEFAULT_ACCT_STATUS)))
+ .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE)))
+ .andExpect(jsonPath("$.[*].acctOwners").value(hasItem(DEFAULT_ACCT_OWNERS)))
+ .andExpect(jsonPath("$.[*].remarks").value(hasItem(DEFAULT_REMARKS)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)));
+ }
+
+ @Test
+ @Transactional
+ void getFimAccountsHistory() throws Exception {
+ // Initialize the database
+ fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory);
+
+ // Get the fimAccountsHistory
+ restFimAccountsHistoryMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimAccountsHistory.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimAccountsHistory.getId().intValue()))
+ .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID))
+ .andExpect(jsonPath("$.historyTs").value(DEFAULT_HISTORY_TS.toString()))
+ .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID))
+ .andExpect(jsonPath("$.relnId").value(DEFAULT_RELN_ID))
+ .andExpect(jsonPath("$.relnType").value(DEFAULT_RELN_TYPE))
+ .andExpect(jsonPath("$.operInst").value(DEFAULT_OPER_INST))
+ .andExpect(jsonPath("$.isAcctNbr").value(DEFAULT_IS_ACCT_NBR))
+ .andExpect(jsonPath("$.bndAcctNbr").value(DEFAULT_BND_ACCT_NBR))
+ .andExpect(jsonPath("$.closingId").value(DEFAULT_CLOSING_ID))
+ .andExpect(jsonPath("$.subSegment").value(DEFAULT_SUB_SEGMENT))
+ .andExpect(jsonPath("$.branchCode").value(DEFAULT_BRANCH_CODE))
+ .andExpect(jsonPath("$.acctStatus").value(DEFAULT_ACCT_STATUS))
+ .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE))
+ .andExpect(jsonPath("$.acctOwners").value(DEFAULT_ACCT_OWNERS))
+ .andExpect(jsonPath("$.remarks").value(DEFAULT_REMARKS))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimAccountsHistory() throws Exception {
+ // Get the fimAccountsHistory
+ restFimAccountsHistoryMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimAccountsHistory() throws Exception {
+ // Initialize the database
+ fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory);
+
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+
+ // Update the fimAccountsHistory
+ FimAccountsHistory updatedFimAccountsHistory = fimAccountsHistoryRepository.findById(fimAccountsHistory.getId()).get();
+ // Disconnect from session so that the updates on updatedFimAccountsHistory are not directly saved in db
+ em.detach(updatedFimAccountsHistory);
+ updatedFimAccountsHistory
+ .accountId(UPDATED_ACCOUNT_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(updatedFimAccountsHistory);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimAccountsHistoryDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimAccountsHistory testFimAccountsHistory = fimAccountsHistoryList.get(fimAccountsHistoryList.size() - 1);
+ assertThat(testFimAccountsHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimAccountsHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS);
+ assertThat(testFimAccountsHistory.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimAccountsHistory.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccountsHistory.getRelnType()).isEqualTo(UPDATED_RELN_TYPE);
+ assertThat(testFimAccountsHistory.getOperInst()).isEqualTo(UPDATED_OPER_INST);
+ assertThat(testFimAccountsHistory.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccountsHistory.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR);
+ assertThat(testFimAccountsHistory.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccountsHistory.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT);
+ assertThat(testFimAccountsHistory.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE);
+ assertThat(testFimAccountsHistory.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS);
+ assertThat(testFimAccountsHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimAccountsHistory.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS);
+ assertThat(testFimAccountsHistory.getRemarks()).isEqualTo(UPDATED_REMARKS);
+ assertThat(testFimAccountsHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccountsHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimAccountsHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimAccountsHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimAccountsHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimAccountsHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+ fimAccountsHistory.setId(count.incrementAndGet());
+
+ // Create the FimAccountsHistory
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimAccountsHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimAccountsHistoryDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimAccountsHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+ fimAccountsHistory.setId(count.incrementAndGet());
+
+ // Create the FimAccountsHistory
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimAccountsHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+ fimAccountsHistory.setId(count.incrementAndGet());
+
+ // Create the FimAccountsHistory
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimAccountsHistoryWithPatch() throws Exception {
+ // Initialize the database
+ fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory);
+
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+
+ // Update the fimAccountsHistory using partial update
+ FimAccountsHistory partialUpdatedFimAccountsHistory = new FimAccountsHistory();
+ partialUpdatedFimAccountsHistory.setId(fimAccountsHistory.getId());
+
+ partialUpdatedFimAccountsHistory
+ .accountId(UPDATED_ACCOUNT_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimAccountsHistory.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccountsHistory))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimAccountsHistory testFimAccountsHistory = fimAccountsHistoryList.get(fimAccountsHistoryList.size() - 1);
+ assertThat(testFimAccountsHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimAccountsHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS);
+ assertThat(testFimAccountsHistory.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimAccountsHistory.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccountsHistory.getRelnType()).isEqualTo(UPDATED_RELN_TYPE);
+ assertThat(testFimAccountsHistory.getOperInst()).isEqualTo(DEFAULT_OPER_INST);
+ assertThat(testFimAccountsHistory.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccountsHistory.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR);
+ assertThat(testFimAccountsHistory.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccountsHistory.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT);
+ assertThat(testFimAccountsHistory.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE);
+ assertThat(testFimAccountsHistory.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS);
+ assertThat(testFimAccountsHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimAccountsHistory.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS);
+ assertThat(testFimAccountsHistory.getRemarks()).isEqualTo(DEFAULT_REMARKS);
+ assertThat(testFimAccountsHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccountsHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimAccountsHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimAccountsHistory.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimAccountsHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimAccountsHistoryWithPatch() throws Exception {
+ // Initialize the database
+ fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory);
+
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+
+ // Update the fimAccountsHistory using partial update
+ FimAccountsHistory partialUpdatedFimAccountsHistory = new FimAccountsHistory();
+ partialUpdatedFimAccountsHistory.setId(fimAccountsHistory.getId());
+
+ partialUpdatedFimAccountsHistory
+ .accountId(UPDATED_ACCOUNT_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+
+ restFimAccountsHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimAccountsHistory.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccountsHistory))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimAccountsHistory testFimAccountsHistory = fimAccountsHistoryList.get(fimAccountsHistoryList.size() - 1);
+ assertThat(testFimAccountsHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimAccountsHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS);
+ assertThat(testFimAccountsHistory.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimAccountsHistory.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccountsHistory.getRelnType()).isEqualTo(UPDATED_RELN_TYPE);
+ assertThat(testFimAccountsHistory.getOperInst()).isEqualTo(UPDATED_OPER_INST);
+ assertThat(testFimAccountsHistory.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccountsHistory.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR);
+ assertThat(testFimAccountsHistory.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccountsHistory.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT);
+ assertThat(testFimAccountsHistory.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE);
+ assertThat(testFimAccountsHistory.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS);
+ assertThat(testFimAccountsHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimAccountsHistory.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS);
+ assertThat(testFimAccountsHistory.getRemarks()).isEqualTo(UPDATED_REMARKS);
+ assertThat(testFimAccountsHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccountsHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimAccountsHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimAccountsHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimAccountsHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimAccountsHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+ fimAccountsHistory.setId(count.incrementAndGet());
+
+ // Create the FimAccountsHistory
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimAccountsHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimAccountsHistoryDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimAccountsHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+ fimAccountsHistory.setId(count.incrementAndGet());
+
+ // Create the FimAccountsHistory
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimAccountsHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size();
+ fimAccountsHistory.setId(count.incrementAndGet());
+
+ // Create the FimAccountsHistory
+ FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL)
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimAccountsHistory in the database
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimAccountsHistory() throws Exception {
+ // Initialize the database
+ fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory);
+
+ int databaseSizeBeforeDelete = fimAccountsHistoryRepository.findAll().size();
+
+ // Delete the fimAccountsHistory
+ restFimAccountsHistoryMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimAccountsHistory.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll();
+ assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimAccountsResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimAccountsResourceIT.java
new file mode 100644
index 0000000..84954b8
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimAccountsResourceIT.java
@@ -0,0 +1,768 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimAccounts;
+import com.scb.fimob.repository.FimAccountsRepository;
+import com.scb.fimob.service.dto.FimAccountsDTO;
+import com.scb.fimob.service.mapper.FimAccountsMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimAccountsResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimAccountsResourceIT {
+
+ private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CUST_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CUST_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_RELN_ID = "AAAAAAAAAA";
+ private static final String UPDATED_RELN_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_RELN_TYPE = "AAAAA";
+ private static final String UPDATED_RELN_TYPE = "BBBBB";
+
+ private static final String DEFAULT_OPER_INST = "AAAAAAAAAA";
+ private static final String UPDATED_OPER_INST = "BBBBBBBBBB";
+
+ private static final String DEFAULT_IS_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_IS_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_BND_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_BND_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CLOSING_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CLOSING_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SUB_SEGMENT = "AAAAAAAAAA";
+ private static final String UPDATED_SUB_SEGMENT = "BBBBBBBBBB";
+
+ private static final String DEFAULT_BRANCH_CODE = "AAAAAAAAAA";
+ private static final String UPDATED_BRANCH_CODE = "BBBBBBBBBB";
+
+ private static final String DEFAULT_ACCT_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_ACCT_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CTRY_CODE = "AAA";
+ private static final String UPDATED_CTRY_CODE = "BBB";
+
+ private static final String DEFAULT_ACCT_OWNERS = "AAAAAAAAAA";
+ private static final String UPDATED_ACCT_OWNERS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_REMARKS = "AAAAAAAAAA";
+ private static final String UPDATED_REMARKS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-accounts";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimAccountsRepository fimAccountsRepository;
+
+ @Autowired
+ private FimAccountsMapper fimAccountsMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimAccountsMockMvc;
+
+ private FimAccounts fimAccounts;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimAccounts createEntity(EntityManager em) {
+ FimAccounts fimAccounts = new FimAccounts()
+ .accountId(DEFAULT_ACCOUNT_ID)
+ .custId(DEFAULT_CUST_ID)
+ .relnId(DEFAULT_RELN_ID)
+ .relnType(DEFAULT_RELN_TYPE)
+ .operInst(DEFAULT_OPER_INST)
+ .isAcctNbr(DEFAULT_IS_ACCT_NBR)
+ .bndAcctNbr(DEFAULT_BND_ACCT_NBR)
+ .closingId(DEFAULT_CLOSING_ID)
+ .subSegment(DEFAULT_SUB_SEGMENT)
+ .branchCode(DEFAULT_BRANCH_CODE)
+ .acctStatus(DEFAULT_ACCT_STATUS)
+ .ctryCode(DEFAULT_CTRY_CODE)
+ .acctOwners(DEFAULT_ACCT_OWNERS)
+ .remarks(DEFAULT_REMARKS)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS);
+ return fimAccounts;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimAccounts createUpdatedEntity(EntityManager em) {
+ FimAccounts fimAccounts = new FimAccounts()
+ .accountId(UPDATED_ACCOUNT_ID)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ return fimAccounts;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimAccounts = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimAccounts() throws Exception {
+ int databaseSizeBeforeCreate = fimAccountsRepository.findAll().size();
+ // Create the FimAccounts
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+ restFimAccountsMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isCreated());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeCreate + 1);
+ FimAccounts testFimAccounts = fimAccountsList.get(fimAccountsList.size() - 1);
+ assertThat(testFimAccounts.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimAccounts.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimAccounts.getRelnId()).isEqualTo(DEFAULT_RELN_ID);
+ assertThat(testFimAccounts.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE);
+ assertThat(testFimAccounts.getOperInst()).isEqualTo(DEFAULT_OPER_INST);
+ assertThat(testFimAccounts.getIsAcctNbr()).isEqualTo(DEFAULT_IS_ACCT_NBR);
+ assertThat(testFimAccounts.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR);
+ assertThat(testFimAccounts.getClosingId()).isEqualTo(DEFAULT_CLOSING_ID);
+ assertThat(testFimAccounts.getSubSegment()).isEqualTo(DEFAULT_SUB_SEGMENT);
+ assertThat(testFimAccounts.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE);
+ assertThat(testFimAccounts.getAcctStatus()).isEqualTo(DEFAULT_ACCT_STATUS);
+ assertThat(testFimAccounts.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimAccounts.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS);
+ assertThat(testFimAccounts.getRemarks()).isEqualTo(DEFAULT_REMARKS);
+ assertThat(testFimAccounts.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimAccounts.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimAccounts.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimAccounts.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimAccounts.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void createFimAccountsWithExistingId() throws Exception {
+ // Create the FimAccounts with an existing ID
+ fimAccounts.setId(1L);
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ int databaseSizeBeforeCreate = fimAccountsRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimAccountsMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkCustIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsRepository.findAll().size();
+ // set the field null
+ fimAccounts.setCustId(null);
+
+ // Create the FimAccounts, which fails.
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ restFimAccountsMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkRelnIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsRepository.findAll().size();
+ // set the field null
+ fimAccounts.setRelnId(null);
+
+ // Create the FimAccounts, which fails.
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ restFimAccountsMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkRelnTypeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsRepository.findAll().size();
+ // set the field null
+ fimAccounts.setRelnType(null);
+
+ // Create the FimAccounts, which fails.
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ restFimAccountsMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkIsAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsRepository.findAll().size();
+ // set the field null
+ fimAccounts.setIsAcctNbr(null);
+
+ // Create the FimAccounts, which fails.
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ restFimAccountsMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkBndAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsRepository.findAll().size();
+ // set the field null
+ fimAccounts.setBndAcctNbr(null);
+
+ // Create the FimAccounts, which fails.
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ restFimAccountsMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkAcctStatusIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsRepository.findAll().size();
+ // set the field null
+ fimAccounts.setAcctStatus(null);
+
+ // Create the FimAccounts, which fails.
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ restFimAccountsMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimAccounts() throws Exception {
+ // Initialize the database
+ fimAccountsRepository.saveAndFlush(fimAccounts);
+
+ // Get all the fimAccountsList
+ restFimAccountsMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimAccounts.getId().intValue())))
+ .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID)))
+ .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID)))
+ .andExpect(jsonPath("$.[*].relnId").value(hasItem(DEFAULT_RELN_ID)))
+ .andExpect(jsonPath("$.[*].relnType").value(hasItem(DEFAULT_RELN_TYPE)))
+ .andExpect(jsonPath("$.[*].operInst").value(hasItem(DEFAULT_OPER_INST)))
+ .andExpect(jsonPath("$.[*].isAcctNbr").value(hasItem(DEFAULT_IS_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].bndAcctNbr").value(hasItem(DEFAULT_BND_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].closingId").value(hasItem(DEFAULT_CLOSING_ID)))
+ .andExpect(jsonPath("$.[*].subSegment").value(hasItem(DEFAULT_SUB_SEGMENT)))
+ .andExpect(jsonPath("$.[*].branchCode").value(hasItem(DEFAULT_BRANCH_CODE)))
+ .andExpect(jsonPath("$.[*].acctStatus").value(hasItem(DEFAULT_ACCT_STATUS)))
+ .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE)))
+ .andExpect(jsonPath("$.[*].acctOwners").value(hasItem(DEFAULT_ACCT_OWNERS)))
+ .andExpect(jsonPath("$.[*].remarks").value(hasItem(DEFAULT_REMARKS)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)));
+ }
+
+ @Test
+ @Transactional
+ void getFimAccounts() throws Exception {
+ // Initialize the database
+ fimAccountsRepository.saveAndFlush(fimAccounts);
+
+ // Get the fimAccounts
+ restFimAccountsMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimAccounts.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimAccounts.getId().intValue()))
+ .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID))
+ .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID))
+ .andExpect(jsonPath("$.relnId").value(DEFAULT_RELN_ID))
+ .andExpect(jsonPath("$.relnType").value(DEFAULT_RELN_TYPE))
+ .andExpect(jsonPath("$.operInst").value(DEFAULT_OPER_INST))
+ .andExpect(jsonPath("$.isAcctNbr").value(DEFAULT_IS_ACCT_NBR))
+ .andExpect(jsonPath("$.bndAcctNbr").value(DEFAULT_BND_ACCT_NBR))
+ .andExpect(jsonPath("$.closingId").value(DEFAULT_CLOSING_ID))
+ .andExpect(jsonPath("$.subSegment").value(DEFAULT_SUB_SEGMENT))
+ .andExpect(jsonPath("$.branchCode").value(DEFAULT_BRANCH_CODE))
+ .andExpect(jsonPath("$.acctStatus").value(DEFAULT_ACCT_STATUS))
+ .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE))
+ .andExpect(jsonPath("$.acctOwners").value(DEFAULT_ACCT_OWNERS))
+ .andExpect(jsonPath("$.remarks").value(DEFAULT_REMARKS))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimAccounts() throws Exception {
+ // Get the fimAccounts
+ restFimAccountsMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimAccounts() throws Exception {
+ // Initialize the database
+ fimAccountsRepository.saveAndFlush(fimAccounts);
+
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+
+ // Update the fimAccounts
+ FimAccounts updatedFimAccounts = fimAccountsRepository.findById(fimAccounts.getId()).get();
+ // Disconnect from session so that the updates on updatedFimAccounts are not directly saved in db
+ em.detach(updatedFimAccounts);
+ updatedFimAccounts
+ .accountId(UPDATED_ACCOUNT_ID)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(updatedFimAccounts);
+
+ restFimAccountsMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimAccountsDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ FimAccounts testFimAccounts = fimAccountsList.get(fimAccountsList.size() - 1);
+ assertThat(testFimAccounts.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimAccounts.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimAccounts.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccounts.getRelnType()).isEqualTo(UPDATED_RELN_TYPE);
+ assertThat(testFimAccounts.getOperInst()).isEqualTo(UPDATED_OPER_INST);
+ assertThat(testFimAccounts.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccounts.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR);
+ assertThat(testFimAccounts.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccounts.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT);
+ assertThat(testFimAccounts.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE);
+ assertThat(testFimAccounts.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS);
+ assertThat(testFimAccounts.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimAccounts.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS);
+ assertThat(testFimAccounts.getRemarks()).isEqualTo(UPDATED_REMARKS);
+ assertThat(testFimAccounts.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccounts.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimAccounts.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimAccounts.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimAccounts.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimAccounts() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+ fimAccounts.setId(count.incrementAndGet());
+
+ // Create the FimAccounts
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimAccountsMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimAccountsDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimAccounts() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+ fimAccounts.setId(count.incrementAndGet());
+
+ // Create the FimAccounts
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimAccounts() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+ fimAccounts.setId(count.incrementAndGet());
+
+ // Create the FimAccounts
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsMockMvc
+ .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)))
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimAccountsWithPatch() throws Exception {
+ // Initialize the database
+ fimAccountsRepository.saveAndFlush(fimAccounts);
+
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+
+ // Update the fimAccounts using partial update
+ FimAccounts partialUpdatedFimAccounts = new FimAccounts();
+ partialUpdatedFimAccounts.setId(fimAccounts.getId());
+
+ partialUpdatedFimAccounts
+ .accountId(UPDATED_ACCOUNT_ID)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .recordStatus(UPDATED_RECORD_STATUS);
+
+ restFimAccountsMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimAccounts.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccounts))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ FimAccounts testFimAccounts = fimAccountsList.get(fimAccountsList.size() - 1);
+ assertThat(testFimAccounts.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimAccounts.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimAccounts.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccounts.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE);
+ assertThat(testFimAccounts.getOperInst()).isEqualTo(UPDATED_OPER_INST);
+ assertThat(testFimAccounts.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccounts.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR);
+ assertThat(testFimAccounts.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccounts.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT);
+ assertThat(testFimAccounts.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE);
+ assertThat(testFimAccounts.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS);
+ assertThat(testFimAccounts.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimAccounts.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS);
+ assertThat(testFimAccounts.getRemarks()).isEqualTo(DEFAULT_REMARKS);
+ assertThat(testFimAccounts.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccounts.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimAccounts.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimAccounts.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimAccounts.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimAccountsWithPatch() throws Exception {
+ // Initialize the database
+ fimAccountsRepository.saveAndFlush(fimAccounts);
+
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+
+ // Update the fimAccounts using partial update
+ FimAccounts partialUpdatedFimAccounts = new FimAccounts();
+ partialUpdatedFimAccounts.setId(fimAccounts.getId());
+
+ partialUpdatedFimAccounts
+ .accountId(UPDATED_ACCOUNT_ID)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+
+ restFimAccountsMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimAccounts.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccounts))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ FimAccounts testFimAccounts = fimAccountsList.get(fimAccountsList.size() - 1);
+ assertThat(testFimAccounts.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimAccounts.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimAccounts.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccounts.getRelnType()).isEqualTo(UPDATED_RELN_TYPE);
+ assertThat(testFimAccounts.getOperInst()).isEqualTo(UPDATED_OPER_INST);
+ assertThat(testFimAccounts.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccounts.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR);
+ assertThat(testFimAccounts.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccounts.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT);
+ assertThat(testFimAccounts.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE);
+ assertThat(testFimAccounts.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS);
+ assertThat(testFimAccounts.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimAccounts.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS);
+ assertThat(testFimAccounts.getRemarks()).isEqualTo(UPDATED_REMARKS);
+ assertThat(testFimAccounts.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccounts.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimAccounts.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimAccounts.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimAccounts.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimAccounts() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+ fimAccounts.setId(count.incrementAndGet());
+
+ // Create the FimAccounts
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimAccountsMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimAccountsDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimAccounts() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+ fimAccounts.setId(count.incrementAndGet());
+
+ // Create the FimAccounts
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimAccounts() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size();
+ fimAccounts.setId(count.incrementAndGet());
+
+ // Create the FimAccounts
+ FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsMockMvc
+ .perform(
+ patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimAccounts in the database
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimAccounts() throws Exception {
+ // Initialize the database
+ fimAccountsRepository.saveAndFlush(fimAccounts);
+
+ int databaseSizeBeforeDelete = fimAccountsRepository.findAll().size();
+
+ // Delete the fimAccounts
+ restFimAccountsMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimAccounts.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimAccountsList = fimAccountsRepository.findAll();
+ assertThat(fimAccountsList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimAccountsWqResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimAccountsWqResourceIT.java
new file mode 100644
index 0000000..4d0e6d8
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimAccountsWqResourceIT.java
@@ -0,0 +1,783 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimAccountsWq;
+import com.scb.fimob.repository.FimAccountsWqRepository;
+import com.scb.fimob.service.dto.FimAccountsWqDTO;
+import com.scb.fimob.service.mapper.FimAccountsWqMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimAccountsWqResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimAccountsWqResourceIT {
+
+ private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CUST_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CUST_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_RELN_ID = "AAAAAAAAAA";
+ private static final String UPDATED_RELN_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_RELN_TYPE = "AAAAA";
+ private static final String UPDATED_RELN_TYPE = "BBBBB";
+
+ private static final String DEFAULT_OPER_INST = "AAAAAAAAAA";
+ private static final String UPDATED_OPER_INST = "BBBBBBBBBB";
+
+ private static final String DEFAULT_IS_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_IS_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_BND_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_BND_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CLOSING_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CLOSING_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SUB_SEGMENT = "AAAAAAAAAA";
+ private static final String UPDATED_SUB_SEGMENT = "BBBBBBBBBB";
+
+ private static final String DEFAULT_BRANCH_CODE = "AAAAAAAAAA";
+ private static final String UPDATED_BRANCH_CODE = "BBBBBBBBBB";
+
+ private static final String DEFAULT_ACCT_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_ACCT_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CTRY_CODE = "AAA";
+ private static final String UPDATED_CTRY_CODE = "BBB";
+
+ private static final String DEFAULT_ACCT_OWNERS = "AAAAAAAAAA";
+ private static final String UPDATED_ACCT_OWNERS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_REMARKS = "AAAAAAAAAA";
+ private static final String UPDATED_REMARKS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_UPLOAD_REMARK = "AAAAAAAAAA";
+ private static final String UPDATED_UPLOAD_REMARK = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-accounts-wqs";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimAccountsWqRepository fimAccountsWqRepository;
+
+ @Autowired
+ private FimAccountsWqMapper fimAccountsWqMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimAccountsWqMockMvc;
+
+ private FimAccountsWq fimAccountsWq;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimAccountsWq createEntity(EntityManager em) {
+ FimAccountsWq fimAccountsWq = new FimAccountsWq()
+ .accountId(DEFAULT_ACCOUNT_ID)
+ .custId(DEFAULT_CUST_ID)
+ .relnId(DEFAULT_RELN_ID)
+ .relnType(DEFAULT_RELN_TYPE)
+ .operInst(DEFAULT_OPER_INST)
+ .isAcctNbr(DEFAULT_IS_ACCT_NBR)
+ .bndAcctNbr(DEFAULT_BND_ACCT_NBR)
+ .closingId(DEFAULT_CLOSING_ID)
+ .subSegment(DEFAULT_SUB_SEGMENT)
+ .branchCode(DEFAULT_BRANCH_CODE)
+ .acctStatus(DEFAULT_ACCT_STATUS)
+ .ctryCode(DEFAULT_CTRY_CODE)
+ .acctOwners(DEFAULT_ACCT_OWNERS)
+ .remarks(DEFAULT_REMARKS)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS)
+ .uploadRemark(DEFAULT_UPLOAD_REMARK);
+ return fimAccountsWq;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimAccountsWq createUpdatedEntity(EntityManager em) {
+ FimAccountsWq fimAccountsWq = new FimAccountsWq()
+ .accountId(UPDATED_ACCOUNT_ID)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+ return fimAccountsWq;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimAccountsWq = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimAccountsWq() throws Exception {
+ int databaseSizeBeforeCreate = fimAccountsWqRepository.findAll().size();
+ // Create the FimAccountsWq
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+ restFimAccountsWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isCreated());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeCreate + 1);
+ FimAccountsWq testFimAccountsWq = fimAccountsWqList.get(fimAccountsWqList.size() - 1);
+ assertThat(testFimAccountsWq.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimAccountsWq.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimAccountsWq.getRelnId()).isEqualTo(DEFAULT_RELN_ID);
+ assertThat(testFimAccountsWq.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE);
+ assertThat(testFimAccountsWq.getOperInst()).isEqualTo(DEFAULT_OPER_INST);
+ assertThat(testFimAccountsWq.getIsAcctNbr()).isEqualTo(DEFAULT_IS_ACCT_NBR);
+ assertThat(testFimAccountsWq.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR);
+ assertThat(testFimAccountsWq.getClosingId()).isEqualTo(DEFAULT_CLOSING_ID);
+ assertThat(testFimAccountsWq.getSubSegment()).isEqualTo(DEFAULT_SUB_SEGMENT);
+ assertThat(testFimAccountsWq.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE);
+ assertThat(testFimAccountsWq.getAcctStatus()).isEqualTo(DEFAULT_ACCT_STATUS);
+ assertThat(testFimAccountsWq.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimAccountsWq.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS);
+ assertThat(testFimAccountsWq.getRemarks()).isEqualTo(DEFAULT_REMARKS);
+ assertThat(testFimAccountsWq.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimAccountsWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimAccountsWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimAccountsWq.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimAccountsWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ assertThat(testFimAccountsWq.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void createFimAccountsWqWithExistingId() throws Exception {
+ // Create the FimAccountsWq with an existing ID
+ fimAccountsWq.setId(1L);
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ int databaseSizeBeforeCreate = fimAccountsWqRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimAccountsWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkCustIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size();
+ // set the field null
+ fimAccountsWq.setCustId(null);
+
+ // Create the FimAccountsWq, which fails.
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkRelnIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size();
+ // set the field null
+ fimAccountsWq.setRelnId(null);
+
+ // Create the FimAccountsWq, which fails.
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkRelnTypeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size();
+ // set the field null
+ fimAccountsWq.setRelnType(null);
+
+ // Create the FimAccountsWq, which fails.
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkIsAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size();
+ // set the field null
+ fimAccountsWq.setIsAcctNbr(null);
+
+ // Create the FimAccountsWq, which fails.
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkBndAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size();
+ // set the field null
+ fimAccountsWq.setBndAcctNbr(null);
+
+ // Create the FimAccountsWq, which fails.
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkAcctStatusIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size();
+ // set the field null
+ fimAccountsWq.setAcctStatus(null);
+
+ // Create the FimAccountsWq, which fails.
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimAccountsWqs() throws Exception {
+ // Initialize the database
+ fimAccountsWqRepository.saveAndFlush(fimAccountsWq);
+
+ // Get all the fimAccountsWqList
+ restFimAccountsWqMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimAccountsWq.getId().intValue())))
+ .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID)))
+ .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID)))
+ .andExpect(jsonPath("$.[*].relnId").value(hasItem(DEFAULT_RELN_ID)))
+ .andExpect(jsonPath("$.[*].relnType").value(hasItem(DEFAULT_RELN_TYPE)))
+ .andExpect(jsonPath("$.[*].operInst").value(hasItem(DEFAULT_OPER_INST)))
+ .andExpect(jsonPath("$.[*].isAcctNbr").value(hasItem(DEFAULT_IS_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].bndAcctNbr").value(hasItem(DEFAULT_BND_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].closingId").value(hasItem(DEFAULT_CLOSING_ID)))
+ .andExpect(jsonPath("$.[*].subSegment").value(hasItem(DEFAULT_SUB_SEGMENT)))
+ .andExpect(jsonPath("$.[*].branchCode").value(hasItem(DEFAULT_BRANCH_CODE)))
+ .andExpect(jsonPath("$.[*].acctStatus").value(hasItem(DEFAULT_ACCT_STATUS)))
+ .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE)))
+ .andExpect(jsonPath("$.[*].acctOwners").value(hasItem(DEFAULT_ACCT_OWNERS)))
+ .andExpect(jsonPath("$.[*].remarks").value(hasItem(DEFAULT_REMARKS)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)))
+ .andExpect(jsonPath("$.[*].uploadRemark").value(hasItem(DEFAULT_UPLOAD_REMARK)));
+ }
+
+ @Test
+ @Transactional
+ void getFimAccountsWq() throws Exception {
+ // Initialize the database
+ fimAccountsWqRepository.saveAndFlush(fimAccountsWq);
+
+ // Get the fimAccountsWq
+ restFimAccountsWqMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimAccountsWq.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimAccountsWq.getId().intValue()))
+ .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID))
+ .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID))
+ .andExpect(jsonPath("$.relnId").value(DEFAULT_RELN_ID))
+ .andExpect(jsonPath("$.relnType").value(DEFAULT_RELN_TYPE))
+ .andExpect(jsonPath("$.operInst").value(DEFAULT_OPER_INST))
+ .andExpect(jsonPath("$.isAcctNbr").value(DEFAULT_IS_ACCT_NBR))
+ .andExpect(jsonPath("$.bndAcctNbr").value(DEFAULT_BND_ACCT_NBR))
+ .andExpect(jsonPath("$.closingId").value(DEFAULT_CLOSING_ID))
+ .andExpect(jsonPath("$.subSegment").value(DEFAULT_SUB_SEGMENT))
+ .andExpect(jsonPath("$.branchCode").value(DEFAULT_BRANCH_CODE))
+ .andExpect(jsonPath("$.acctStatus").value(DEFAULT_ACCT_STATUS))
+ .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE))
+ .andExpect(jsonPath("$.acctOwners").value(DEFAULT_ACCT_OWNERS))
+ .andExpect(jsonPath("$.remarks").value(DEFAULT_REMARKS))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS))
+ .andExpect(jsonPath("$.uploadRemark").value(DEFAULT_UPLOAD_REMARK));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimAccountsWq() throws Exception {
+ // Get the fimAccountsWq
+ restFimAccountsWqMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimAccountsWq() throws Exception {
+ // Initialize the database
+ fimAccountsWqRepository.saveAndFlush(fimAccountsWq);
+
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+
+ // Update the fimAccountsWq
+ FimAccountsWq updatedFimAccountsWq = fimAccountsWqRepository.findById(fimAccountsWq.getId()).get();
+ // Disconnect from session so that the updates on updatedFimAccountsWq are not directly saved in db
+ em.detach(updatedFimAccountsWq);
+ updatedFimAccountsWq
+ .accountId(UPDATED_ACCOUNT_ID)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(updatedFimAccountsWq);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimAccountsWqDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ FimAccountsWq testFimAccountsWq = fimAccountsWqList.get(fimAccountsWqList.size() - 1);
+ assertThat(testFimAccountsWq.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimAccountsWq.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimAccountsWq.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccountsWq.getRelnType()).isEqualTo(UPDATED_RELN_TYPE);
+ assertThat(testFimAccountsWq.getOperInst()).isEqualTo(UPDATED_OPER_INST);
+ assertThat(testFimAccountsWq.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccountsWq.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR);
+ assertThat(testFimAccountsWq.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccountsWq.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT);
+ assertThat(testFimAccountsWq.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE);
+ assertThat(testFimAccountsWq.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS);
+ assertThat(testFimAccountsWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimAccountsWq.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS);
+ assertThat(testFimAccountsWq.getRemarks()).isEqualTo(UPDATED_REMARKS);
+ assertThat(testFimAccountsWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccountsWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimAccountsWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimAccountsWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimAccountsWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimAccountsWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimAccountsWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+ fimAccountsWq.setId(count.incrementAndGet());
+
+ // Create the FimAccountsWq
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimAccountsWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimAccountsWqDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimAccountsWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+ fimAccountsWq.setId(count.incrementAndGet());
+
+ // Create the FimAccountsWq
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimAccountsWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+ fimAccountsWq.setId(count.incrementAndGet());
+
+ // Create the FimAccountsWq
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsWqMockMvc
+ .perform(
+ put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimAccountsWqWithPatch() throws Exception {
+ // Initialize the database
+ fimAccountsWqRepository.saveAndFlush(fimAccountsWq);
+
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+
+ // Update the fimAccountsWq using partial update
+ FimAccountsWq partialUpdatedFimAccountsWq = new FimAccountsWq();
+ partialUpdatedFimAccountsWq.setId(fimAccountsWq.getId());
+
+ partialUpdatedFimAccountsWq
+ .relnId(UPDATED_RELN_ID)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimAccountsWq.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccountsWq))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ FimAccountsWq testFimAccountsWq = fimAccountsWqList.get(fimAccountsWqList.size() - 1);
+ assertThat(testFimAccountsWq.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimAccountsWq.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimAccountsWq.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccountsWq.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE);
+ assertThat(testFimAccountsWq.getOperInst()).isEqualTo(DEFAULT_OPER_INST);
+ assertThat(testFimAccountsWq.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccountsWq.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR);
+ assertThat(testFimAccountsWq.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccountsWq.getSubSegment()).isEqualTo(DEFAULT_SUB_SEGMENT);
+ assertThat(testFimAccountsWq.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE);
+ assertThat(testFimAccountsWq.getAcctStatus()).isEqualTo(DEFAULT_ACCT_STATUS);
+ assertThat(testFimAccountsWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimAccountsWq.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS);
+ assertThat(testFimAccountsWq.getRemarks()).isEqualTo(DEFAULT_REMARKS);
+ assertThat(testFimAccountsWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccountsWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimAccountsWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimAccountsWq.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimAccountsWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ assertThat(testFimAccountsWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimAccountsWqWithPatch() throws Exception {
+ // Initialize the database
+ fimAccountsWqRepository.saveAndFlush(fimAccountsWq);
+
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+
+ // Update the fimAccountsWq using partial update
+ FimAccountsWq partialUpdatedFimAccountsWq = new FimAccountsWq();
+ partialUpdatedFimAccountsWq.setId(fimAccountsWq.getId());
+
+ partialUpdatedFimAccountsWq
+ .accountId(UPDATED_ACCOUNT_ID)
+ .custId(UPDATED_CUST_ID)
+ .relnId(UPDATED_RELN_ID)
+ .relnType(UPDATED_RELN_TYPE)
+ .operInst(UPDATED_OPER_INST)
+ .isAcctNbr(UPDATED_IS_ACCT_NBR)
+ .bndAcctNbr(UPDATED_BND_ACCT_NBR)
+ .closingId(UPDATED_CLOSING_ID)
+ .subSegment(UPDATED_SUB_SEGMENT)
+ .branchCode(UPDATED_BRANCH_CODE)
+ .acctStatus(UPDATED_ACCT_STATUS)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .acctOwners(UPDATED_ACCT_OWNERS)
+ .remarks(UPDATED_REMARKS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+
+ restFimAccountsWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimAccountsWq.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccountsWq))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ FimAccountsWq testFimAccountsWq = fimAccountsWqList.get(fimAccountsWqList.size() - 1);
+ assertThat(testFimAccountsWq.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimAccountsWq.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimAccountsWq.getRelnId()).isEqualTo(UPDATED_RELN_ID);
+ assertThat(testFimAccountsWq.getRelnType()).isEqualTo(UPDATED_RELN_TYPE);
+ assertThat(testFimAccountsWq.getOperInst()).isEqualTo(UPDATED_OPER_INST);
+ assertThat(testFimAccountsWq.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR);
+ assertThat(testFimAccountsWq.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR);
+ assertThat(testFimAccountsWq.getClosingId()).isEqualTo(UPDATED_CLOSING_ID);
+ assertThat(testFimAccountsWq.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT);
+ assertThat(testFimAccountsWq.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE);
+ assertThat(testFimAccountsWq.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS);
+ assertThat(testFimAccountsWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimAccountsWq.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS);
+ assertThat(testFimAccountsWq.getRemarks()).isEqualTo(UPDATED_REMARKS);
+ assertThat(testFimAccountsWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimAccountsWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimAccountsWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimAccountsWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimAccountsWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimAccountsWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimAccountsWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+ fimAccountsWq.setId(count.incrementAndGet());
+
+ // Create the FimAccountsWq
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimAccountsWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimAccountsWqDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimAccountsWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+ fimAccountsWq.setId(count.incrementAndGet());
+
+ // Create the FimAccountsWq
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimAccountsWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size();
+ fimAccountsWq.setId(count.incrementAndGet());
+
+ // Create the FimAccountsWq
+ FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimAccountsWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL)
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimAccountsWq in the database
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimAccountsWq() throws Exception {
+ // Initialize the database
+ fimAccountsWqRepository.saveAndFlush(fimAccountsWq);
+
+ int databaseSizeBeforeDelete = fimAccountsWqRepository.findAll().size();
+
+ // Delete the fimAccountsWq
+ restFimAccountsWqMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimAccountsWq.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimAccountsWqList = fimAccountsWqRepository.findAll();
+ assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimCustHistoryResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimCustHistoryResourceIT.java
new file mode 100644
index 0000000..030ae76
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimCustHistoryResourceIT.java
@@ -0,0 +1,605 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimCustHistory;
+import com.scb.fimob.repository.FimCustHistoryRepository;
+import com.scb.fimob.service.dto.FimCustHistoryDTO;
+import com.scb.fimob.service.mapper.FimCustHistoryMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimCustHistoryResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimCustHistoryResourceIT {
+
+ private static final String DEFAULT_CUST_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CUST_ID = "BBBBBBBBBB";
+
+ private static final Instant DEFAULT_HISTORY_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_HISTORY_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_CLIENT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CLIENT_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_ID_TYPE = "AAAAAAAAAA";
+ private static final String UPDATED_ID_TYPE = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CTRY_CODE = "AAA";
+ private static final String UPDATED_CTRY_CODE = "BBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-cust-histories";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimCustHistoryRepository fimCustHistoryRepository;
+
+ @Autowired
+ private FimCustHistoryMapper fimCustHistoryMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimCustHistoryMockMvc;
+
+ private FimCustHistory fimCustHistory;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimCustHistory createEntity(EntityManager em) {
+ FimCustHistory fimCustHistory = new FimCustHistory()
+ .custId(DEFAULT_CUST_ID)
+ .historyTs(DEFAULT_HISTORY_TS)
+ .clientId(DEFAULT_CLIENT_ID)
+ .idType(DEFAULT_ID_TYPE)
+ .ctryCode(DEFAULT_CTRY_CODE)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS);
+ return fimCustHistory;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimCustHistory createUpdatedEntity(EntityManager em) {
+ FimCustHistory fimCustHistory = new FimCustHistory()
+ .custId(UPDATED_CUST_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ return fimCustHistory;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimCustHistory = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimCustHistory() throws Exception {
+ int databaseSizeBeforeCreate = fimCustHistoryRepository.findAll().size();
+ // Create the FimCustHistory
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+ restFimCustHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isCreated());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeCreate + 1);
+ FimCustHistory testFimCustHistory = fimCustHistoryList.get(fimCustHistoryList.size() - 1);
+ assertThat(testFimCustHistory.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimCustHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS);
+ assertThat(testFimCustHistory.getClientId()).isEqualTo(DEFAULT_CLIENT_ID);
+ assertThat(testFimCustHistory.getIdType()).isEqualTo(DEFAULT_ID_TYPE);
+ assertThat(testFimCustHistory.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimCustHistory.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimCustHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimCustHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimCustHistory.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimCustHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void createFimCustHistoryWithExistingId() throws Exception {
+ // Create the FimCustHistory with an existing ID
+ fimCustHistory.setId(1L);
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ int databaseSizeBeforeCreate = fimCustHistoryRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimCustHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkClientIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustHistoryRepository.findAll().size();
+ // set the field null
+ fimCustHistory.setClientId(null);
+
+ // Create the FimCustHistory, which fails.
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ restFimCustHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkIdTypeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustHistoryRepository.findAll().size();
+ // set the field null
+ fimCustHistory.setIdType(null);
+
+ // Create the FimCustHistory, which fails.
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ restFimCustHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkCtryCodeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustHistoryRepository.findAll().size();
+ // set the field null
+ fimCustHistory.setCtryCode(null);
+
+ // Create the FimCustHistory, which fails.
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ restFimCustHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkCreatedByIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustHistoryRepository.findAll().size();
+ // set the field null
+ fimCustHistory.setCreatedBy(null);
+
+ // Create the FimCustHistory, which fails.
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ restFimCustHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimCustHistories() throws Exception {
+ // Initialize the database
+ fimCustHistoryRepository.saveAndFlush(fimCustHistory);
+
+ // Get all the fimCustHistoryList
+ restFimCustHistoryMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimCustHistory.getId().intValue())))
+ .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID)))
+ .andExpect(jsonPath("$.[*].historyTs").value(hasItem(DEFAULT_HISTORY_TS.toString())))
+ .andExpect(jsonPath("$.[*].clientId").value(hasItem(DEFAULT_CLIENT_ID)))
+ .andExpect(jsonPath("$.[*].idType").value(hasItem(DEFAULT_ID_TYPE)))
+ .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)));
+ }
+
+ @Test
+ @Transactional
+ void getFimCustHistory() throws Exception {
+ // Initialize the database
+ fimCustHistoryRepository.saveAndFlush(fimCustHistory);
+
+ // Get the fimCustHistory
+ restFimCustHistoryMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimCustHistory.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimCustHistory.getId().intValue()))
+ .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID))
+ .andExpect(jsonPath("$.historyTs").value(DEFAULT_HISTORY_TS.toString()))
+ .andExpect(jsonPath("$.clientId").value(DEFAULT_CLIENT_ID))
+ .andExpect(jsonPath("$.idType").value(DEFAULT_ID_TYPE))
+ .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimCustHistory() throws Exception {
+ // Get the fimCustHistory
+ restFimCustHistoryMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimCustHistory() throws Exception {
+ // Initialize the database
+ fimCustHistoryRepository.saveAndFlush(fimCustHistory);
+
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+
+ // Update the fimCustHistory
+ FimCustHistory updatedFimCustHistory = fimCustHistoryRepository.findById(fimCustHistory.getId()).get();
+ // Disconnect from session so that the updates on updatedFimCustHistory are not directly saved in db
+ em.detach(updatedFimCustHistory);
+ updatedFimCustHistory
+ .custId(UPDATED_CUST_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(updatedFimCustHistory);
+
+ restFimCustHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimCustHistoryDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimCustHistory testFimCustHistory = fimCustHistoryList.get(fimCustHistoryList.size() - 1);
+ assertThat(testFimCustHistory.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimCustHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS);
+ assertThat(testFimCustHistory.getClientId()).isEqualTo(UPDATED_CLIENT_ID);
+ assertThat(testFimCustHistory.getIdType()).isEqualTo(UPDATED_ID_TYPE);
+ assertThat(testFimCustHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimCustHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimCustHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimCustHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimCustHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCustHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimCustHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+ fimCustHistory.setId(count.incrementAndGet());
+
+ // Create the FimCustHistory
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimCustHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimCustHistoryDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimCustHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+ fimCustHistory.setId(count.incrementAndGet());
+
+ // Create the FimCustHistory
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimCustHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+ fimCustHistory.setId(count.incrementAndGet());
+
+ // Create the FimCustHistory
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimCustHistoryWithPatch() throws Exception {
+ // Initialize the database
+ fimCustHistoryRepository.saveAndFlush(fimCustHistory);
+
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+
+ // Update the fimCustHistory using partial update
+ FimCustHistory partialUpdatedFimCustHistory = new FimCustHistory();
+ partialUpdatedFimCustHistory.setId(fimCustHistory.getId());
+
+ partialUpdatedFimCustHistory.createdBy(UPDATED_CREATED_BY).updatedTs(UPDATED_UPDATED_TS);
+
+ restFimCustHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimCustHistory.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCustHistory))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimCustHistory testFimCustHistory = fimCustHistoryList.get(fimCustHistoryList.size() - 1);
+ assertThat(testFimCustHistory.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimCustHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS);
+ assertThat(testFimCustHistory.getClientId()).isEqualTo(DEFAULT_CLIENT_ID);
+ assertThat(testFimCustHistory.getIdType()).isEqualTo(DEFAULT_ID_TYPE);
+ assertThat(testFimCustHistory.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimCustHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimCustHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimCustHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimCustHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCustHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimCustHistoryWithPatch() throws Exception {
+ // Initialize the database
+ fimCustHistoryRepository.saveAndFlush(fimCustHistory);
+
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+
+ // Update the fimCustHistory using partial update
+ FimCustHistory partialUpdatedFimCustHistory = new FimCustHistory();
+ partialUpdatedFimCustHistory.setId(fimCustHistory.getId());
+
+ partialUpdatedFimCustHistory
+ .custId(UPDATED_CUST_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+
+ restFimCustHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimCustHistory.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCustHistory))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimCustHistory testFimCustHistory = fimCustHistoryList.get(fimCustHistoryList.size() - 1);
+ assertThat(testFimCustHistory.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimCustHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS);
+ assertThat(testFimCustHistory.getClientId()).isEqualTo(UPDATED_CLIENT_ID);
+ assertThat(testFimCustHistory.getIdType()).isEqualTo(UPDATED_ID_TYPE);
+ assertThat(testFimCustHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimCustHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimCustHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimCustHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimCustHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCustHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimCustHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+ fimCustHistory.setId(count.incrementAndGet());
+
+ // Create the FimCustHistory
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimCustHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimCustHistoryDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimCustHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+ fimCustHistory.setId(count.incrementAndGet());
+
+ // Create the FimCustHistory
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimCustHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size();
+ fimCustHistory.setId(count.incrementAndGet());
+
+ // Create the FimCustHistory
+ FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL)
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimCustHistory in the database
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimCustHistory() throws Exception {
+ // Initialize the database
+ fimCustHistoryRepository.saveAndFlush(fimCustHistory);
+
+ int databaseSizeBeforeDelete = fimCustHistoryRepository.findAll().size();
+
+ // Delete the fimCustHistory
+ restFimCustHistoryMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimCustHistory.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimCustHistoryList = fimCustHistoryRepository.findAll();
+ assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimCustResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimCustResourceIT.java
new file mode 100644
index 0000000..46386d6
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimCustResourceIT.java
@@ -0,0 +1,593 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimCust;
+import com.scb.fimob.repository.FimCustRepository;
+import com.scb.fimob.service.dto.FimCustDTO;
+import com.scb.fimob.service.mapper.FimCustMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimCustResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimCustResourceIT {
+
+ private static final String DEFAULT_CUST_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CUST_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CLIENT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CLIENT_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_ID_TYPE = "AAAAAAAAAA";
+ private static final String UPDATED_ID_TYPE = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CTRY_CODE = "AAA";
+ private static final String UPDATED_CTRY_CODE = "BBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_UPLOAD_REMARK = "AAAAAAAAAA";
+ private static final String UPDATED_UPLOAD_REMARK = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-custs";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimCustRepository fimCustRepository;
+
+ @Autowired
+ private FimCustMapper fimCustMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimCustMockMvc;
+
+ private FimCust fimCust;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimCust createEntity(EntityManager em) {
+ FimCust fimCust = new FimCust()
+ .custId(DEFAULT_CUST_ID)
+ .clientId(DEFAULT_CLIENT_ID)
+ .idType(DEFAULT_ID_TYPE)
+ .ctryCode(DEFAULT_CTRY_CODE)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS)
+ .uploadRemark(DEFAULT_UPLOAD_REMARK);
+ return fimCust;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimCust createUpdatedEntity(EntityManager em) {
+ FimCust fimCust = new FimCust()
+ .custId(UPDATED_CUST_ID)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+ return fimCust;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimCust = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimCust() throws Exception {
+ int databaseSizeBeforeCreate = fimCustRepository.findAll().size();
+ // Create the FimCust
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+ restFimCustMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO)))
+ .andExpect(status().isCreated());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeCreate + 1);
+ FimCust testFimCust = fimCustList.get(fimCustList.size() - 1);
+ assertThat(testFimCust.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimCust.getClientId()).isEqualTo(DEFAULT_CLIENT_ID);
+ assertThat(testFimCust.getIdType()).isEqualTo(DEFAULT_ID_TYPE);
+ assertThat(testFimCust.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimCust.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimCust.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimCust.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimCust.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimCust.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ assertThat(testFimCust.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void createFimCustWithExistingId() throws Exception {
+ // Create the FimCust with an existing ID
+ fimCust.setId(1L);
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ int databaseSizeBeforeCreate = fimCustRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimCustMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO)))
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkClientIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustRepository.findAll().size();
+ // set the field null
+ fimCust.setClientId(null);
+
+ // Create the FimCust, which fails.
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ restFimCustMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO)))
+ .andExpect(status().isBadRequest());
+
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkIdTypeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustRepository.findAll().size();
+ // set the field null
+ fimCust.setIdType(null);
+
+ // Create the FimCust, which fails.
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ restFimCustMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO)))
+ .andExpect(status().isBadRequest());
+
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkCtryCodeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustRepository.findAll().size();
+ // set the field null
+ fimCust.setCtryCode(null);
+
+ // Create the FimCust, which fails.
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ restFimCustMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO)))
+ .andExpect(status().isBadRequest());
+
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkCreatedByIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustRepository.findAll().size();
+ // set the field null
+ fimCust.setCreatedBy(null);
+
+ // Create the FimCust, which fails.
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ restFimCustMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO)))
+ .andExpect(status().isBadRequest());
+
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimCusts() throws Exception {
+ // Initialize the database
+ fimCustRepository.saveAndFlush(fimCust);
+
+ // Get all the fimCustList
+ restFimCustMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimCust.getId().intValue())))
+ .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID)))
+ .andExpect(jsonPath("$.[*].clientId").value(hasItem(DEFAULT_CLIENT_ID)))
+ .andExpect(jsonPath("$.[*].idType").value(hasItem(DEFAULT_ID_TYPE)))
+ .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)))
+ .andExpect(jsonPath("$.[*].uploadRemark").value(hasItem(DEFAULT_UPLOAD_REMARK)));
+ }
+
+ @Test
+ @Transactional
+ void getFimCust() throws Exception {
+ // Initialize the database
+ fimCustRepository.saveAndFlush(fimCust);
+
+ // Get the fimCust
+ restFimCustMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimCust.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimCust.getId().intValue()))
+ .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID))
+ .andExpect(jsonPath("$.clientId").value(DEFAULT_CLIENT_ID))
+ .andExpect(jsonPath("$.idType").value(DEFAULT_ID_TYPE))
+ .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS))
+ .andExpect(jsonPath("$.uploadRemark").value(DEFAULT_UPLOAD_REMARK));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimCust() throws Exception {
+ // Get the fimCust
+ restFimCustMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimCust() throws Exception {
+ // Initialize the database
+ fimCustRepository.saveAndFlush(fimCust);
+
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+
+ // Update the fimCust
+ FimCust updatedFimCust = fimCustRepository.findById(fimCust.getId()).get();
+ // Disconnect from session so that the updates on updatedFimCust are not directly saved in db
+ em.detach(updatedFimCust);
+ updatedFimCust
+ .custId(UPDATED_CUST_ID)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(updatedFimCust);
+
+ restFimCustMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimCustDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ FimCust testFimCust = fimCustList.get(fimCustList.size() - 1);
+ assertThat(testFimCust.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimCust.getClientId()).isEqualTo(UPDATED_CLIENT_ID);
+ assertThat(testFimCust.getIdType()).isEqualTo(UPDATED_ID_TYPE);
+ assertThat(testFimCust.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimCust.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimCust.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimCust.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimCust.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCust.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimCust.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimCust() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+ fimCust.setId(count.incrementAndGet());
+
+ // Create the FimCust
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimCustMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimCustDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimCust() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+ fimCust.setId(count.incrementAndGet());
+
+ // Create the FimCust
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimCust() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+ fimCust.setId(count.incrementAndGet());
+
+ // Create the FimCust
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustMockMvc
+ .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO)))
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimCustWithPatch() throws Exception {
+ // Initialize the database
+ fimCustRepository.saveAndFlush(fimCust);
+
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+
+ // Update the fimCust using partial update
+ FimCust partialUpdatedFimCust = new FimCust();
+ partialUpdatedFimCust.setId(fimCust.getId());
+
+ partialUpdatedFimCust
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedTs(UPDATED_UPDATED_TS);
+
+ restFimCustMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimCust.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCust))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ FimCust testFimCust = fimCustList.get(fimCustList.size() - 1);
+ assertThat(testFimCust.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimCust.getClientId()).isEqualTo(UPDATED_CLIENT_ID);
+ assertThat(testFimCust.getIdType()).isEqualTo(UPDATED_ID_TYPE);
+ assertThat(testFimCust.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimCust.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimCust.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimCust.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimCust.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCust.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ assertThat(testFimCust.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimCustWithPatch() throws Exception {
+ // Initialize the database
+ fimCustRepository.saveAndFlush(fimCust);
+
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+
+ // Update the fimCust using partial update
+ FimCust partialUpdatedFimCust = new FimCust();
+ partialUpdatedFimCust.setId(fimCust.getId());
+
+ partialUpdatedFimCust
+ .custId(UPDATED_CUST_ID)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+
+ restFimCustMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimCust.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCust))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ FimCust testFimCust = fimCustList.get(fimCustList.size() - 1);
+ assertThat(testFimCust.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimCust.getClientId()).isEqualTo(UPDATED_CLIENT_ID);
+ assertThat(testFimCust.getIdType()).isEqualTo(UPDATED_ID_TYPE);
+ assertThat(testFimCust.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimCust.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimCust.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimCust.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimCust.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCust.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimCust.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimCust() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+ fimCust.setId(count.incrementAndGet());
+
+ // Create the FimCust
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimCustMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimCustDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimCustDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimCust() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+ fimCust.setId(count.incrementAndGet());
+
+ // Create the FimCust
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimCustDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimCust() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustRepository.findAll().size();
+ fimCust.setId(count.incrementAndGet());
+
+ // Create the FimCust
+ FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustMockMvc
+ .perform(
+ patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(fimCustDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimCust in the database
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimCust() throws Exception {
+ // Initialize the database
+ fimCustRepository.saveAndFlush(fimCust);
+
+ int databaseSizeBeforeDelete = fimCustRepository.findAll().size();
+
+ // Delete the fimCust
+ restFimCustMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimCust.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimCustList = fimCustRepository.findAll();
+ assertThat(fimCustList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimCustWqResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimCustWqResourceIT.java
new file mode 100644
index 0000000..8e46cd1
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimCustWqResourceIT.java
@@ -0,0 +1,594 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimCustWq;
+import com.scb.fimob.repository.FimCustWqRepository;
+import com.scb.fimob.service.dto.FimCustWqDTO;
+import com.scb.fimob.service.mapper.FimCustWqMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimCustWqResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimCustWqResourceIT {
+
+ private static final String DEFAULT_CUST_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CUST_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CLIENT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_CLIENT_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_ID_TYPE = "AAAAAAAAAA";
+ private static final String UPDATED_ID_TYPE = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CTRY_CODE = "AAA";
+ private static final String UPDATED_CTRY_CODE = "BBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_UPLOAD_REMARK = "AAAAAAAAAA";
+ private static final String UPDATED_UPLOAD_REMARK = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-cust-wqs";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimCustWqRepository fimCustWqRepository;
+
+ @Autowired
+ private FimCustWqMapper fimCustWqMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimCustWqMockMvc;
+
+ private FimCustWq fimCustWq;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimCustWq createEntity(EntityManager em) {
+ FimCustWq fimCustWq = new FimCustWq()
+ .custId(DEFAULT_CUST_ID)
+ .clientId(DEFAULT_CLIENT_ID)
+ .idType(DEFAULT_ID_TYPE)
+ .ctryCode(DEFAULT_CTRY_CODE)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS)
+ .uploadRemark(DEFAULT_UPLOAD_REMARK);
+ return fimCustWq;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimCustWq createUpdatedEntity(EntityManager em) {
+ FimCustWq fimCustWq = new FimCustWq()
+ .custId(UPDATED_CUST_ID)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+ return fimCustWq;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimCustWq = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimCustWq() throws Exception {
+ int databaseSizeBeforeCreate = fimCustWqRepository.findAll().size();
+ // Create the FimCustWq
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+ restFimCustWqMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)))
+ .andExpect(status().isCreated());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeCreate + 1);
+ FimCustWq testFimCustWq = fimCustWqList.get(fimCustWqList.size() - 1);
+ assertThat(testFimCustWq.getCustId()).isEqualTo(DEFAULT_CUST_ID);
+ assertThat(testFimCustWq.getClientId()).isEqualTo(DEFAULT_CLIENT_ID);
+ assertThat(testFimCustWq.getIdType()).isEqualTo(DEFAULT_ID_TYPE);
+ assertThat(testFimCustWq.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimCustWq.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimCustWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimCustWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimCustWq.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimCustWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ assertThat(testFimCustWq.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void createFimCustWqWithExistingId() throws Exception {
+ // Create the FimCustWq with an existing ID
+ fimCustWq.setId(1L);
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ int databaseSizeBeforeCreate = fimCustWqRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimCustWqMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)))
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkClientIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustWqRepository.findAll().size();
+ // set the field null
+ fimCustWq.setClientId(null);
+
+ // Create the FimCustWq, which fails.
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ restFimCustWqMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)))
+ .andExpect(status().isBadRequest());
+
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkIdTypeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustWqRepository.findAll().size();
+ // set the field null
+ fimCustWq.setIdType(null);
+
+ // Create the FimCustWq, which fails.
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ restFimCustWqMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)))
+ .andExpect(status().isBadRequest());
+
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkCtryCodeIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustWqRepository.findAll().size();
+ // set the field null
+ fimCustWq.setCtryCode(null);
+
+ // Create the FimCustWq, which fails.
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ restFimCustWqMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)))
+ .andExpect(status().isBadRequest());
+
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkCreatedByIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimCustWqRepository.findAll().size();
+ // set the field null
+ fimCustWq.setCreatedBy(null);
+
+ // Create the FimCustWq, which fails.
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ restFimCustWqMockMvc
+ .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)))
+ .andExpect(status().isBadRequest());
+
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimCustWqs() throws Exception {
+ // Initialize the database
+ fimCustWqRepository.saveAndFlush(fimCustWq);
+
+ // Get all the fimCustWqList
+ restFimCustWqMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimCustWq.getId().intValue())))
+ .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID)))
+ .andExpect(jsonPath("$.[*].clientId").value(hasItem(DEFAULT_CLIENT_ID)))
+ .andExpect(jsonPath("$.[*].idType").value(hasItem(DEFAULT_ID_TYPE)))
+ .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)))
+ .andExpect(jsonPath("$.[*].uploadRemark").value(hasItem(DEFAULT_UPLOAD_REMARK)));
+ }
+
+ @Test
+ @Transactional
+ void getFimCustWq() throws Exception {
+ // Initialize the database
+ fimCustWqRepository.saveAndFlush(fimCustWq);
+
+ // Get the fimCustWq
+ restFimCustWqMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimCustWq.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimCustWq.getId().intValue()))
+ .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID))
+ .andExpect(jsonPath("$.clientId").value(DEFAULT_CLIENT_ID))
+ .andExpect(jsonPath("$.idType").value(DEFAULT_ID_TYPE))
+ .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS))
+ .andExpect(jsonPath("$.uploadRemark").value(DEFAULT_UPLOAD_REMARK));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimCustWq() throws Exception {
+ // Get the fimCustWq
+ restFimCustWqMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimCustWq() throws Exception {
+ // Initialize the database
+ fimCustWqRepository.saveAndFlush(fimCustWq);
+
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+
+ // Update the fimCustWq
+ FimCustWq updatedFimCustWq = fimCustWqRepository.findById(fimCustWq.getId()).get();
+ // Disconnect from session so that the updates on updatedFimCustWq are not directly saved in db
+ em.detach(updatedFimCustWq);
+ updatedFimCustWq
+ .custId(UPDATED_CUST_ID)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(updatedFimCustWq);
+
+ restFimCustWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimCustWqDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ FimCustWq testFimCustWq = fimCustWqList.get(fimCustWqList.size() - 1);
+ assertThat(testFimCustWq.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimCustWq.getClientId()).isEqualTo(UPDATED_CLIENT_ID);
+ assertThat(testFimCustWq.getIdType()).isEqualTo(UPDATED_ID_TYPE);
+ assertThat(testFimCustWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimCustWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimCustWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimCustWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimCustWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCustWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimCustWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimCustWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+ fimCustWq.setId(count.incrementAndGet());
+
+ // Create the FimCustWq
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimCustWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimCustWqDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimCustWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+ fimCustWq.setId(count.incrementAndGet());
+
+ // Create the FimCustWq
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimCustWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+ fimCustWq.setId(count.incrementAndGet());
+
+ // Create the FimCustWq
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustWqMockMvc
+ .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)))
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimCustWqWithPatch() throws Exception {
+ // Initialize the database
+ fimCustWqRepository.saveAndFlush(fimCustWq);
+
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+
+ // Update the fimCustWq using partial update
+ FimCustWq partialUpdatedFimCustWq = new FimCustWq();
+ partialUpdatedFimCustWq.setId(fimCustWq.getId());
+
+ partialUpdatedFimCustWq
+ .custId(UPDATED_CUST_ID)
+ .createdBy(UPDATED_CREATED_BY)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+
+ restFimCustWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimCustWq.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCustWq))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ FimCustWq testFimCustWq = fimCustWqList.get(fimCustWqList.size() - 1);
+ assertThat(testFimCustWq.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimCustWq.getClientId()).isEqualTo(DEFAULT_CLIENT_ID);
+ assertThat(testFimCustWq.getIdType()).isEqualTo(DEFAULT_ID_TYPE);
+ assertThat(testFimCustWq.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE);
+ assertThat(testFimCustWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimCustWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimCustWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimCustWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCustWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimCustWq.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimCustWqWithPatch() throws Exception {
+ // Initialize the database
+ fimCustWqRepository.saveAndFlush(fimCustWq);
+
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+
+ // Update the fimCustWq using partial update
+ FimCustWq partialUpdatedFimCustWq = new FimCustWq();
+ partialUpdatedFimCustWq.setId(fimCustWq.getId());
+
+ partialUpdatedFimCustWq
+ .custId(UPDATED_CUST_ID)
+ .clientId(UPDATED_CLIENT_ID)
+ .idType(UPDATED_ID_TYPE)
+ .ctryCode(UPDATED_CTRY_CODE)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+
+ restFimCustWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimCustWq.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCustWq))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ FimCustWq testFimCustWq = fimCustWqList.get(fimCustWqList.size() - 1);
+ assertThat(testFimCustWq.getCustId()).isEqualTo(UPDATED_CUST_ID);
+ assertThat(testFimCustWq.getClientId()).isEqualTo(UPDATED_CLIENT_ID);
+ assertThat(testFimCustWq.getIdType()).isEqualTo(UPDATED_ID_TYPE);
+ assertThat(testFimCustWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE);
+ assertThat(testFimCustWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimCustWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimCustWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimCustWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimCustWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimCustWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimCustWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+ fimCustWq.setId(count.incrementAndGet());
+
+ // Create the FimCustWq
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimCustWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimCustWqDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimCustWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+ fimCustWq.setId(count.incrementAndGet());
+
+ // Create the FimCustWq
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimCustWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size();
+ fimCustWq.setId(count.incrementAndGet());
+
+ // Create the FimCustWq
+ FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimCustWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimCustWq in the database
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimCustWq() throws Exception {
+ // Initialize the database
+ fimCustWqRepository.saveAndFlush(fimCustWq);
+
+ int databaseSizeBeforeDelete = fimCustWqRepository.findAll().size();
+
+ // Delete the fimCustWq
+ restFimCustWqMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimCustWq.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimCustWqList = fimCustWqRepository.findAll();
+ assertThat(fimCustWqList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimSettAcctHistoryResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimSettAcctHistoryResourceIT.java
new file mode 100644
index 0000000..df21b7b
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimSettAcctHistoryResourceIT.java
@@ -0,0 +1,636 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimSettAcctHistory;
+import com.scb.fimob.repository.FimSettAcctHistoryRepository;
+import com.scb.fimob.service.dto.FimSettAcctHistoryDTO;
+import com.scb.fimob.service.mapper.FimSettAcctHistoryMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimSettAcctHistoryResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimSettAcctHistoryResourceIT {
+
+ private static final String DEFAULT_SETTACC_ID = "AAAAAAAAAA";
+ private static final String UPDATED_SETTACC_ID = "BBBBBBBBBB";
+
+ private static final Instant DEFAULT_HISTORY_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_HISTORY_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SETT_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_SETT_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SETT_CCY = "AAA";
+ private static final String UPDATED_SETT_CCY = "BBB";
+
+ private static final String DEFAULT_SETT_ACCT_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_SETT_ACCT_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-sett-acct-histories";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimSettAcctHistoryRepository fimSettAcctHistoryRepository;
+
+ @Autowired
+ private FimSettAcctHistoryMapper fimSettAcctHistoryMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimSettAcctHistoryMockMvc;
+
+ private FimSettAcctHistory fimSettAcctHistory;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimSettAcctHistory createEntity(EntityManager em) {
+ FimSettAcctHistory fimSettAcctHistory = new FimSettAcctHistory()
+ .settaccId(DEFAULT_SETTACC_ID)
+ .historyTs(DEFAULT_HISTORY_TS)
+ .accountId(DEFAULT_ACCOUNT_ID)
+ .settAcctNbr(DEFAULT_SETT_ACCT_NBR)
+ .settCcy(DEFAULT_SETT_CCY)
+ .settAcctStatus(DEFAULT_SETT_ACCT_STATUS)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS);
+ return fimSettAcctHistory;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimSettAcctHistory createUpdatedEntity(EntityManager em) {
+ FimSettAcctHistory fimSettAcctHistory = new FimSettAcctHistory()
+ .settaccId(UPDATED_SETTACC_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ return fimSettAcctHistory;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimSettAcctHistory = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimSettAcctHistory() throws Exception {
+ int databaseSizeBeforeCreate = fimSettAcctHistoryRepository.findAll().size();
+ // Create the FimSettAcctHistory
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isCreated());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeCreate + 1);
+ FimSettAcctHistory testFimSettAcctHistory = fimSettAcctHistoryList.get(fimSettAcctHistoryList.size() - 1);
+ assertThat(testFimSettAcctHistory.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID);
+ assertThat(testFimSettAcctHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS);
+ assertThat(testFimSettAcctHistory.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimSettAcctHistory.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR);
+ assertThat(testFimSettAcctHistory.getSettCcy()).isEqualTo(DEFAULT_SETT_CCY);
+ assertThat(testFimSettAcctHistory.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcctHistory.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimSettAcctHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimSettAcctHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimSettAcctHistory.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimSettAcctHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void createFimSettAcctHistoryWithExistingId() throws Exception {
+ // Create the FimSettAcctHistory with an existing ID
+ fimSettAcctHistory.setId(1L);
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ int databaseSizeBeforeCreate = fimSettAcctHistoryRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkAccountIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctHistoryRepository.findAll().size();
+ // set the field null
+ fimSettAcctHistory.setAccountId(null);
+
+ // Create the FimSettAcctHistory, which fails.
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctHistoryRepository.findAll().size();
+ // set the field null
+ fimSettAcctHistory.setSettAcctNbr(null);
+
+ // Create the FimSettAcctHistory, which fails.
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettCcyIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctHistoryRepository.findAll().size();
+ // set the field null
+ fimSettAcctHistory.setSettCcy(null);
+
+ // Create the FimSettAcctHistory, which fails.
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettAcctStatusIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctHistoryRepository.findAll().size();
+ // set the field null
+ fimSettAcctHistory.setSettAcctStatus(null);
+
+ // Create the FimSettAcctHistory, which fails.
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ post(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimSettAcctHistories() throws Exception {
+ // Initialize the database
+ fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory);
+
+ // Get all the fimSettAcctHistoryList
+ restFimSettAcctHistoryMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimSettAcctHistory.getId().intValue())))
+ .andExpect(jsonPath("$.[*].settaccId").value(hasItem(DEFAULT_SETTACC_ID)))
+ .andExpect(jsonPath("$.[*].historyTs").value(hasItem(DEFAULT_HISTORY_TS.toString())))
+ .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID)))
+ .andExpect(jsonPath("$.[*].settAcctNbr").value(hasItem(DEFAULT_SETT_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].settCcy").value(hasItem(DEFAULT_SETT_CCY)))
+ .andExpect(jsonPath("$.[*].settAcctStatus").value(hasItem(DEFAULT_SETT_ACCT_STATUS)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)));
+ }
+
+ @Test
+ @Transactional
+ void getFimSettAcctHistory() throws Exception {
+ // Initialize the database
+ fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory);
+
+ // Get the fimSettAcctHistory
+ restFimSettAcctHistoryMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimSettAcctHistory.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimSettAcctHistory.getId().intValue()))
+ .andExpect(jsonPath("$.settaccId").value(DEFAULT_SETTACC_ID))
+ .andExpect(jsonPath("$.historyTs").value(DEFAULT_HISTORY_TS.toString()))
+ .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID))
+ .andExpect(jsonPath("$.settAcctNbr").value(DEFAULT_SETT_ACCT_NBR))
+ .andExpect(jsonPath("$.settCcy").value(DEFAULT_SETT_CCY))
+ .andExpect(jsonPath("$.settAcctStatus").value(DEFAULT_SETT_ACCT_STATUS))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimSettAcctHistory() throws Exception {
+ // Get the fimSettAcctHistory
+ restFimSettAcctHistoryMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimSettAcctHistory() throws Exception {
+ // Initialize the database
+ fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory);
+
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+
+ // Update the fimSettAcctHistory
+ FimSettAcctHistory updatedFimSettAcctHistory = fimSettAcctHistoryRepository.findById(fimSettAcctHistory.getId()).get();
+ // Disconnect from session so that the updates on updatedFimSettAcctHistory are not directly saved in db
+ em.detach(updatedFimSettAcctHistory);
+ updatedFimSettAcctHistory
+ .settaccId(UPDATED_SETTACC_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(updatedFimSettAcctHistory);
+
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimSettAcctHistoryDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcctHistory testFimSettAcctHistory = fimSettAcctHistoryList.get(fimSettAcctHistoryList.size() - 1);
+ assertThat(testFimSettAcctHistory.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID);
+ assertThat(testFimSettAcctHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS);
+ assertThat(testFimSettAcctHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimSettAcctHistory.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR);
+ assertThat(testFimSettAcctHistory.getSettCcy()).isEqualTo(UPDATED_SETT_CCY);
+ assertThat(testFimSettAcctHistory.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcctHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcctHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimSettAcctHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimSettAcctHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcctHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimSettAcctHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+ fimSettAcctHistory.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctHistory
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimSettAcctHistoryDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimSettAcctHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+ fimSettAcctHistory.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctHistory
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimSettAcctHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+ fimSettAcctHistory.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctHistory
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ put(ENTITY_API_URL)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimSettAcctHistoryWithPatch() throws Exception {
+ // Initialize the database
+ fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory);
+
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+
+ // Update the fimSettAcctHistory using partial update
+ FimSettAcctHistory partialUpdatedFimSettAcctHistory = new FimSettAcctHistory();
+ partialUpdatedFimSettAcctHistory.setId(fimSettAcctHistory.getId());
+
+ partialUpdatedFimSettAcctHistory
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .createdBy(UPDATED_CREATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS);
+
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcctHistory.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcctHistory))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcctHistory testFimSettAcctHistory = fimSettAcctHistoryList.get(fimSettAcctHistoryList.size() - 1);
+ assertThat(testFimSettAcctHistory.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID);
+ assertThat(testFimSettAcctHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS);
+ assertThat(testFimSettAcctHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimSettAcctHistory.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR);
+ assertThat(testFimSettAcctHistory.getSettCcy()).isEqualTo(DEFAULT_SETT_CCY);
+ assertThat(testFimSettAcctHistory.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcctHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcctHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimSettAcctHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimSettAcctHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcctHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimSettAcctHistoryWithPatch() throws Exception {
+ // Initialize the database
+ fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory);
+
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+
+ // Update the fimSettAcctHistory using partial update
+ FimSettAcctHistory partialUpdatedFimSettAcctHistory = new FimSettAcctHistory();
+ partialUpdatedFimSettAcctHistory.setId(fimSettAcctHistory.getId());
+
+ partialUpdatedFimSettAcctHistory
+ .settaccId(UPDATED_SETTACC_ID)
+ .historyTs(UPDATED_HISTORY_TS)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcctHistory.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcctHistory))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcctHistory testFimSettAcctHistory = fimSettAcctHistoryList.get(fimSettAcctHistoryList.size() - 1);
+ assertThat(testFimSettAcctHistory.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID);
+ assertThat(testFimSettAcctHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS);
+ assertThat(testFimSettAcctHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimSettAcctHistory.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR);
+ assertThat(testFimSettAcctHistory.getSettCcy()).isEqualTo(UPDATED_SETT_CCY);
+ assertThat(testFimSettAcctHistory.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcctHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcctHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimSettAcctHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimSettAcctHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcctHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimSettAcctHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+ fimSettAcctHistory.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctHistory
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimSettAcctHistoryDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimSettAcctHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+ fimSettAcctHistory.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctHistory
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimSettAcctHistory() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size();
+ fimSettAcctHistory.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctHistory
+ FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctHistoryMockMvc
+ .perform(
+ patch(ENTITY_API_URL)
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimSettAcctHistory in the database
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimSettAcctHistory() throws Exception {
+ // Initialize the database
+ fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory);
+
+ int databaseSizeBeforeDelete = fimSettAcctHistoryRepository.findAll().size();
+
+ // Delete the fimSettAcctHistory
+ restFimSettAcctHistoryMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimSettAcctHistory.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll();
+ assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimSettAcctResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimSettAcctResourceIT.java
new file mode 100644
index 0000000..d91ae1f
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimSettAcctResourceIT.java
@@ -0,0 +1,606 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimSettAcct;
+import com.scb.fimob.repository.FimSettAcctRepository;
+import com.scb.fimob.service.dto.FimSettAcctDTO;
+import com.scb.fimob.service.mapper.FimSettAcctMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimSettAcctResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimSettAcctResourceIT {
+
+ private static final String DEFAULT_SETTACC_ID = "AAAAAAAAAA";
+ private static final String UPDATED_SETTACC_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SETT_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_SETT_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SETT_CCY = "AAA";
+ private static final String UPDATED_SETT_CCY = "BBB";
+
+ private static final String DEFAULT_SETT_ACCT_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_SETT_ACCT_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-sett-accts";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimSettAcctRepository fimSettAcctRepository;
+
+ @Autowired
+ private FimSettAcctMapper fimSettAcctMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimSettAcctMockMvc;
+
+ private FimSettAcct fimSettAcct;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimSettAcct createEntity(EntityManager em) {
+ FimSettAcct fimSettAcct = new FimSettAcct()
+ .settaccId(DEFAULT_SETTACC_ID)
+ .accountId(DEFAULT_ACCOUNT_ID)
+ .settAcctNbr(DEFAULT_SETT_ACCT_NBR)
+ .settCcy(DEFAULT_SETT_CCY)
+ .settAcctStatus(DEFAULT_SETT_ACCT_STATUS)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS);
+ return fimSettAcct;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimSettAcct createUpdatedEntity(EntityManager em) {
+ FimSettAcct fimSettAcct = new FimSettAcct()
+ .settaccId(UPDATED_SETTACC_ID)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ return fimSettAcct;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimSettAcct = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimSettAcct() throws Exception {
+ int databaseSizeBeforeCreate = fimSettAcctRepository.findAll().size();
+ // Create the FimSettAcct
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+ restFimSettAcctMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isCreated());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeCreate + 1);
+ FimSettAcct testFimSettAcct = fimSettAcctList.get(fimSettAcctList.size() - 1);
+ assertThat(testFimSettAcct.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID);
+ assertThat(testFimSettAcct.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimSettAcct.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR);
+ assertThat(testFimSettAcct.getSettCcy()).isEqualTo(DEFAULT_SETT_CCY);
+ assertThat(testFimSettAcct.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcct.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimSettAcct.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimSettAcct.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimSettAcct.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimSettAcct.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void createFimSettAcctWithExistingId() throws Exception {
+ // Create the FimSettAcct with an existing ID
+ fimSettAcct.setId(1L);
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ int databaseSizeBeforeCreate = fimSettAcctRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimSettAcctMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkAccountIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctRepository.findAll().size();
+ // set the field null
+ fimSettAcct.setAccountId(null);
+
+ // Create the FimSettAcct, which fails.
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ restFimSettAcctMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctRepository.findAll().size();
+ // set the field null
+ fimSettAcct.setSettAcctNbr(null);
+
+ // Create the FimSettAcct, which fails.
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ restFimSettAcctMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettCcyIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctRepository.findAll().size();
+ // set the field null
+ fimSettAcct.setSettCcy(null);
+
+ // Create the FimSettAcct, which fails.
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ restFimSettAcctMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettAcctStatusIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctRepository.findAll().size();
+ // set the field null
+ fimSettAcct.setSettAcctStatus(null);
+
+ // Create the FimSettAcct, which fails.
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ restFimSettAcctMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimSettAccts() throws Exception {
+ // Initialize the database
+ fimSettAcctRepository.saveAndFlush(fimSettAcct);
+
+ // Get all the fimSettAcctList
+ restFimSettAcctMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimSettAcct.getId().intValue())))
+ .andExpect(jsonPath("$.[*].settaccId").value(hasItem(DEFAULT_SETTACC_ID)))
+ .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID)))
+ .andExpect(jsonPath("$.[*].settAcctNbr").value(hasItem(DEFAULT_SETT_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].settCcy").value(hasItem(DEFAULT_SETT_CCY)))
+ .andExpect(jsonPath("$.[*].settAcctStatus").value(hasItem(DEFAULT_SETT_ACCT_STATUS)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)));
+ }
+
+ @Test
+ @Transactional
+ void getFimSettAcct() throws Exception {
+ // Initialize the database
+ fimSettAcctRepository.saveAndFlush(fimSettAcct);
+
+ // Get the fimSettAcct
+ restFimSettAcctMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimSettAcct.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimSettAcct.getId().intValue()))
+ .andExpect(jsonPath("$.settaccId").value(DEFAULT_SETTACC_ID))
+ .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID))
+ .andExpect(jsonPath("$.settAcctNbr").value(DEFAULT_SETT_ACCT_NBR))
+ .andExpect(jsonPath("$.settCcy").value(DEFAULT_SETT_CCY))
+ .andExpect(jsonPath("$.settAcctStatus").value(DEFAULT_SETT_ACCT_STATUS))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimSettAcct() throws Exception {
+ // Get the fimSettAcct
+ restFimSettAcctMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimSettAcct() throws Exception {
+ // Initialize the database
+ fimSettAcctRepository.saveAndFlush(fimSettAcct);
+
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+
+ // Update the fimSettAcct
+ FimSettAcct updatedFimSettAcct = fimSettAcctRepository.findById(fimSettAcct.getId()).get();
+ // Disconnect from session so that the updates on updatedFimSettAcct are not directly saved in db
+ em.detach(updatedFimSettAcct);
+ updatedFimSettAcct
+ .settaccId(UPDATED_SETTACC_ID)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(updatedFimSettAcct);
+
+ restFimSettAcctMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimSettAcctDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcct testFimSettAcct = fimSettAcctList.get(fimSettAcctList.size() - 1);
+ assertThat(testFimSettAcct.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID);
+ assertThat(testFimSettAcct.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimSettAcct.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR);
+ assertThat(testFimSettAcct.getSettCcy()).isEqualTo(UPDATED_SETT_CCY);
+ assertThat(testFimSettAcct.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcct.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcct.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimSettAcct.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimSettAcct.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcct.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimSettAcct() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+ fimSettAcct.setId(count.incrementAndGet());
+
+ // Create the FimSettAcct
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimSettAcctMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimSettAcctDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimSettAcct() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+ fimSettAcct.setId(count.incrementAndGet());
+
+ // Create the FimSettAcct
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimSettAcct() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+ fimSettAcct.setId(count.incrementAndGet());
+
+ // Create the FimSettAcct
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctMockMvc
+ .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)))
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimSettAcctWithPatch() throws Exception {
+ // Initialize the database
+ fimSettAcctRepository.saveAndFlush(fimSettAcct);
+
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+
+ // Update the fimSettAcct using partial update
+ FimSettAcct partialUpdatedFimSettAcct = new FimSettAcct();
+ partialUpdatedFimSettAcct.setId(fimSettAcct.getId());
+
+ partialUpdatedFimSettAcct
+ .settaccId(UPDATED_SETTACC_ID)
+ .settCcy(UPDATED_SETT_CCY)
+ .createdBy(UPDATED_CREATED_BY)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS);
+
+ restFimSettAcctMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcct.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcct))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcct testFimSettAcct = fimSettAcctList.get(fimSettAcctList.size() - 1);
+ assertThat(testFimSettAcct.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID);
+ assertThat(testFimSettAcct.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimSettAcct.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR);
+ assertThat(testFimSettAcct.getSettCcy()).isEqualTo(UPDATED_SETT_CCY);
+ assertThat(testFimSettAcct.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcct.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcct.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimSettAcct.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimSettAcct.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcct.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimSettAcctWithPatch() throws Exception {
+ // Initialize the database
+ fimSettAcctRepository.saveAndFlush(fimSettAcct);
+
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+
+ // Update the fimSettAcct using partial update
+ FimSettAcct partialUpdatedFimSettAcct = new FimSettAcct();
+ partialUpdatedFimSettAcct.setId(fimSettAcct.getId());
+
+ partialUpdatedFimSettAcct
+ .settaccId(UPDATED_SETTACC_ID)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS);
+
+ restFimSettAcctMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcct.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcct))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcct testFimSettAcct = fimSettAcctList.get(fimSettAcctList.size() - 1);
+ assertThat(testFimSettAcct.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID);
+ assertThat(testFimSettAcct.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimSettAcct.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR);
+ assertThat(testFimSettAcct.getSettCcy()).isEqualTo(UPDATED_SETT_CCY);
+ assertThat(testFimSettAcct.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcct.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcct.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimSettAcct.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimSettAcct.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcct.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimSettAcct() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+ fimSettAcct.setId(count.incrementAndGet());
+
+ // Create the FimSettAcct
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimSettAcctMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimSettAcctDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimSettAcct() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+ fimSettAcct.setId(count.incrementAndGet());
+
+ // Create the FimSettAcct
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimSettAcct() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size();
+ fimSettAcct.setId(count.incrementAndGet());
+
+ // Create the FimSettAcct
+ FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctMockMvc
+ .perform(
+ patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimSettAcct in the database
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimSettAcct() throws Exception {
+ // Initialize the database
+ fimSettAcctRepository.saveAndFlush(fimSettAcct);
+
+ int databaseSizeBeforeDelete = fimSettAcctRepository.findAll().size();
+
+ // Delete the fimSettAcct
+ restFimSettAcctMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimSettAcct.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimSettAcctList = fimSettAcctRepository.findAll();
+ assertThat(fimSettAcctList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/FimSettAcctWqResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimSettAcctWqResourceIT.java
new file mode 100644
index 0000000..573a072
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/FimSettAcctWqResourceIT.java
@@ -0,0 +1,622 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+import com.scb.fimob.IntegrationTest;
+import com.scb.fimob.domain.FimSettAcctWq;
+import com.scb.fimob.repository.FimSettAcctWqRepository;
+import com.scb.fimob.service.dto.FimSettAcctWqDTO;
+import com.scb.fimob.service.mapper.FimSettAcctWqMapper;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.persistence.EntityManager;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Integration tests for the {@link FimSettAcctWqResource} REST controller.
+ */
+@IntegrationTest
+@AutoConfigureMockMvc
+@WithMockUser
+class FimSettAcctWqResourceIT {
+
+ private static final String DEFAULT_SETTACC_ID = "AAAAAAAAAA";
+ private static final String UPDATED_SETTACC_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA";
+ private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SETT_ACCT_NBR = "AAAAAAAAAA";
+ private static final String UPDATED_SETT_ACCT_NBR = "BBBBBBBBBB";
+
+ private static final String DEFAULT_SETT_CCY = "AAA";
+ private static final String UPDATED_SETT_CCY = "BBB";
+
+ private static final String DEFAULT_SETT_ACCT_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_SETT_ACCT_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_CREATED_BY = "AAAAAAAA";
+ private static final String UPDATED_CREATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_UPDATED_BY = "AAAAAAAA";
+ private static final String UPDATED_UPDATED_BY = "BBBBBBBB";
+
+ private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L);
+ private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS);
+
+ private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA";
+ private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB";
+
+ private static final String DEFAULT_UPLOAD_REMARK = "AAAAAAAAAA";
+ private static final String UPDATED_UPLOAD_REMARK = "BBBBBBBBBB";
+
+ private static final String ENTITY_API_URL = "/api/fim-sett-acct-wqs";
+ private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}";
+
+ private static Random random = new Random();
+ private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE));
+
+ @Autowired
+ private FimSettAcctWqRepository fimSettAcctWqRepository;
+
+ @Autowired
+ private FimSettAcctWqMapper fimSettAcctWqMapper;
+
+ @Autowired
+ private EntityManager em;
+
+ @Autowired
+ private MockMvc restFimSettAcctWqMockMvc;
+
+ private FimSettAcctWq fimSettAcctWq;
+
+ /**
+ * Create an entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimSettAcctWq createEntity(EntityManager em) {
+ FimSettAcctWq fimSettAcctWq = new FimSettAcctWq()
+ .settaccId(DEFAULT_SETTACC_ID)
+ .accountId(DEFAULT_ACCOUNT_ID)
+ .settAcctNbr(DEFAULT_SETT_ACCT_NBR)
+ .settCcy(DEFAULT_SETT_CCY)
+ .settAcctStatus(DEFAULT_SETT_ACCT_STATUS)
+ .createdBy(DEFAULT_CREATED_BY)
+ .createdTs(DEFAULT_CREATED_TS)
+ .updatedBy(DEFAULT_UPDATED_BY)
+ .updatedTs(DEFAULT_UPDATED_TS)
+ .recordStatus(DEFAULT_RECORD_STATUS)
+ .uploadRemark(DEFAULT_UPLOAD_REMARK);
+ return fimSettAcctWq;
+ }
+
+ /**
+ * Create an updated entity for this test.
+ *
+ * This is a static method, as tests for other entities might also need it,
+ * if they test an entity which requires the current entity.
+ */
+ public static FimSettAcctWq createUpdatedEntity(EntityManager em) {
+ FimSettAcctWq fimSettAcctWq = new FimSettAcctWq()
+ .settaccId(UPDATED_SETTACC_ID)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+ return fimSettAcctWq;
+ }
+
+ @BeforeEach
+ public void initTest() {
+ fimSettAcctWq = createEntity(em);
+ }
+
+ @Test
+ @Transactional
+ void createFimSettAcctWq() throws Exception {
+ int databaseSizeBeforeCreate = fimSettAcctWqRepository.findAll().size();
+ // Create the FimSettAcctWq
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+ restFimSettAcctWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isCreated());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeCreate + 1);
+ FimSettAcctWq testFimSettAcctWq = fimSettAcctWqList.get(fimSettAcctWqList.size() - 1);
+ assertThat(testFimSettAcctWq.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID);
+ assertThat(testFimSettAcctWq.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimSettAcctWq.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR);
+ assertThat(testFimSettAcctWq.getSettCcy()).isEqualTo(DEFAULT_SETT_CCY);
+ assertThat(testFimSettAcctWq.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcctWq.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY);
+ assertThat(testFimSettAcctWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimSettAcctWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimSettAcctWq.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS);
+ assertThat(testFimSettAcctWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ assertThat(testFimSettAcctWq.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void createFimSettAcctWqWithExistingId() throws Exception {
+ // Create the FimSettAcctWq with an existing ID
+ fimSettAcctWq.setId(1L);
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ int databaseSizeBeforeCreate = fimSettAcctWqRepository.findAll().size();
+
+ // An entity with an existing ID cannot be created, so this API call must fail
+ restFimSettAcctWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeCreate);
+ }
+
+ @Test
+ @Transactional
+ void checkAccountIdIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctWqRepository.findAll().size();
+ // set the field null
+ fimSettAcctWq.setAccountId(null);
+
+ // Create the FimSettAcctWq, which fails.
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ restFimSettAcctWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettAcctNbrIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctWqRepository.findAll().size();
+ // set the field null
+ fimSettAcctWq.setSettAcctNbr(null);
+
+ // Create the FimSettAcctWq, which fails.
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ restFimSettAcctWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettCcyIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctWqRepository.findAll().size();
+ // set the field null
+ fimSettAcctWq.setSettCcy(null);
+
+ // Create the FimSettAcctWq, which fails.
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ restFimSettAcctWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void checkSettAcctStatusIsRequired() throws Exception {
+ int databaseSizeBeforeTest = fimSettAcctWqRepository.findAll().size();
+ // set the field null
+ fimSettAcctWq.setSettAcctStatus(null);
+
+ // Create the FimSettAcctWq, which fails.
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ restFimSettAcctWqMockMvc
+ .perform(
+ post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeTest);
+ }
+
+ @Test
+ @Transactional
+ void getAllFimSettAcctWqs() throws Exception {
+ // Initialize the database
+ fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq);
+
+ // Get all the fimSettAcctWqList
+ restFimSettAcctWqMockMvc
+ .perform(get(ENTITY_API_URL + "?sort=id,desc"))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.[*].id").value(hasItem(fimSettAcctWq.getId().intValue())))
+ .andExpect(jsonPath("$.[*].settaccId").value(hasItem(DEFAULT_SETTACC_ID)))
+ .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID)))
+ .andExpect(jsonPath("$.[*].settAcctNbr").value(hasItem(DEFAULT_SETT_ACCT_NBR)))
+ .andExpect(jsonPath("$.[*].settCcy").value(hasItem(DEFAULT_SETT_CCY)))
+ .andExpect(jsonPath("$.[*].settAcctStatus").value(hasItem(DEFAULT_SETT_ACCT_STATUS)))
+ .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY)))
+ .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY)))
+ .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString())))
+ .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS)))
+ .andExpect(jsonPath("$.[*].uploadRemark").value(hasItem(DEFAULT_UPLOAD_REMARK)));
+ }
+
+ @Test
+ @Transactional
+ void getFimSettAcctWq() throws Exception {
+ // Initialize the database
+ fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq);
+
+ // Get the fimSettAcctWq
+ restFimSettAcctWqMockMvc
+ .perform(get(ENTITY_API_URL_ID, fimSettAcctWq.getId()))
+ .andExpect(status().isOk())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
+ .andExpect(jsonPath("$.id").value(fimSettAcctWq.getId().intValue()))
+ .andExpect(jsonPath("$.settaccId").value(DEFAULT_SETTACC_ID))
+ .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID))
+ .andExpect(jsonPath("$.settAcctNbr").value(DEFAULT_SETT_ACCT_NBR))
+ .andExpect(jsonPath("$.settCcy").value(DEFAULT_SETT_CCY))
+ .andExpect(jsonPath("$.settAcctStatus").value(DEFAULT_SETT_ACCT_STATUS))
+ .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY))
+ .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString()))
+ .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY))
+ .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString()))
+ .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS))
+ .andExpect(jsonPath("$.uploadRemark").value(DEFAULT_UPLOAD_REMARK));
+ }
+
+ @Test
+ @Transactional
+ void getNonExistingFimSettAcctWq() throws Exception {
+ // Get the fimSettAcctWq
+ restFimSettAcctWqMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound());
+ }
+
+ @Test
+ @Transactional
+ void putNewFimSettAcctWq() throws Exception {
+ // Initialize the database
+ fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq);
+
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+
+ // Update the fimSettAcctWq
+ FimSettAcctWq updatedFimSettAcctWq = fimSettAcctWqRepository.findById(fimSettAcctWq.getId()).get();
+ // Disconnect from session so that the updates on updatedFimSettAcctWq are not directly saved in db
+ em.detach(updatedFimSettAcctWq);
+ updatedFimSettAcctWq
+ .settaccId(UPDATED_SETTACC_ID)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(updatedFimSettAcctWq);
+
+ restFimSettAcctWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimSettAcctWqDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcctWq testFimSettAcctWq = fimSettAcctWqList.get(fimSettAcctWqList.size() - 1);
+ assertThat(testFimSettAcctWq.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID);
+ assertThat(testFimSettAcctWq.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimSettAcctWq.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR);
+ assertThat(testFimSettAcctWq.getSettCcy()).isEqualTo(UPDATED_SETT_CCY);
+ assertThat(testFimSettAcctWq.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcctWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcctWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimSettAcctWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimSettAcctWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcctWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimSettAcctWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void putNonExistingFimSettAcctWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+ fimSettAcctWq.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctWq
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimSettAcctWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, fimSettAcctWqDTO.getId())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithIdMismatchFimSettAcctWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+ fimSettAcctWq.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctWq
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctWqMockMvc
+ .perform(
+ put(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void putWithMissingIdPathParamFimSettAcctWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+ fimSettAcctWq.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctWq
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctWqMockMvc
+ .perform(
+ put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void partialUpdateFimSettAcctWqWithPatch() throws Exception {
+ // Initialize the database
+ fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq);
+
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+
+ // Update the fimSettAcctWq using partial update
+ FimSettAcctWq partialUpdatedFimSettAcctWq = new FimSettAcctWq();
+ partialUpdatedFimSettAcctWq.setId(fimSettAcctWq.getId());
+
+ partialUpdatedFimSettAcctWq
+ .settCcy(UPDATED_SETT_CCY)
+ .createdBy(UPDATED_CREATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+
+ restFimSettAcctWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcctWq.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcctWq))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcctWq testFimSettAcctWq = fimSettAcctWqList.get(fimSettAcctWqList.size() - 1);
+ assertThat(testFimSettAcctWq.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID);
+ assertThat(testFimSettAcctWq.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID);
+ assertThat(testFimSettAcctWq.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR);
+ assertThat(testFimSettAcctWq.getSettCcy()).isEqualTo(UPDATED_SETT_CCY);
+ assertThat(testFimSettAcctWq.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcctWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcctWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS);
+ assertThat(testFimSettAcctWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY);
+ assertThat(testFimSettAcctWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcctWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS);
+ assertThat(testFimSettAcctWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void fullUpdateFimSettAcctWqWithPatch() throws Exception {
+ // Initialize the database
+ fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq);
+
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+
+ // Update the fimSettAcctWq using partial update
+ FimSettAcctWq partialUpdatedFimSettAcctWq = new FimSettAcctWq();
+ partialUpdatedFimSettAcctWq.setId(fimSettAcctWq.getId());
+
+ partialUpdatedFimSettAcctWq
+ .settaccId(UPDATED_SETTACC_ID)
+ .accountId(UPDATED_ACCOUNT_ID)
+ .settAcctNbr(UPDATED_SETT_ACCT_NBR)
+ .settCcy(UPDATED_SETT_CCY)
+ .settAcctStatus(UPDATED_SETT_ACCT_STATUS)
+ .createdBy(UPDATED_CREATED_BY)
+ .createdTs(UPDATED_CREATED_TS)
+ .updatedBy(UPDATED_UPDATED_BY)
+ .updatedTs(UPDATED_UPDATED_TS)
+ .recordStatus(UPDATED_RECORD_STATUS)
+ .uploadRemark(UPDATED_UPLOAD_REMARK);
+
+ restFimSettAcctWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcctWq.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcctWq))
+ )
+ .andExpect(status().isOk());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ FimSettAcctWq testFimSettAcctWq = fimSettAcctWqList.get(fimSettAcctWqList.size() - 1);
+ assertThat(testFimSettAcctWq.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID);
+ assertThat(testFimSettAcctWq.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID);
+ assertThat(testFimSettAcctWq.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR);
+ assertThat(testFimSettAcctWq.getSettCcy()).isEqualTo(UPDATED_SETT_CCY);
+ assertThat(testFimSettAcctWq.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS);
+ assertThat(testFimSettAcctWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY);
+ assertThat(testFimSettAcctWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS);
+ assertThat(testFimSettAcctWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY);
+ assertThat(testFimSettAcctWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS);
+ assertThat(testFimSettAcctWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS);
+ assertThat(testFimSettAcctWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK);
+ }
+
+ @Test
+ @Transactional
+ void patchNonExistingFimSettAcctWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+ fimSettAcctWq.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctWq
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ // If the entity doesn't have an ID, it will throw BadRequestAlertException
+ restFimSettAcctWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, fimSettAcctWqDTO.getId())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithIdMismatchFimSettAcctWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+ fimSettAcctWq.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctWq
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL_ID, count.incrementAndGet())
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isBadRequest());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void patchWithMissingIdPathParamFimSettAcctWq() throws Exception {
+ int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size();
+ fimSettAcctWq.setId(count.incrementAndGet());
+
+ // Create the FimSettAcctWq
+ FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq);
+
+ // If url ID doesn't match entity ID, it will throw BadRequestAlertException
+ restFimSettAcctWqMockMvc
+ .perform(
+ patch(ENTITY_API_URL)
+ .contentType("application/merge-patch+json")
+ .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO))
+ )
+ .andExpect(status().isMethodNotAllowed());
+
+ // Validate the FimSettAcctWq in the database
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate);
+ }
+
+ @Test
+ @Transactional
+ void deleteFimSettAcctWq() throws Exception {
+ // Initialize the database
+ fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq);
+
+ int databaseSizeBeforeDelete = fimSettAcctWqRepository.findAll().size();
+
+ // Delete the fimSettAcctWq
+ restFimSettAcctWqMockMvc
+ .perform(delete(ENTITY_API_URL_ID, fimSettAcctWq.getId()).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent());
+
+ // Validate the database contains one less item
+ List fimSettAcctWqList = fimSettAcctWqRepository.findAll();
+ assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeDelete - 1);
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/TestUtil.java b/src/test/java/com/scb/fimob/web/rest/TestUtil.java
new file mode 100644
index 0000000..6670739
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/TestUtil.java
@@ -0,0 +1,206 @@
+package com.scb.fimob.web.rest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeParseException;
+import java.util.List;
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Root;
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeDiagnosingMatcher;
+import org.hamcrest.TypeSafeMatcher;
+import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
+import org.springframework.format.support.DefaultFormattingConversionService;
+import org.springframework.format.support.FormattingConversionService;
+
+/**
+ * Utility class for testing REST controllers.
+ */
+public final class TestUtil {
+
+ private static final ObjectMapper mapper = createObjectMapper();
+
+ private static ObjectMapper createObjectMapper() {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ mapper.registerModule(new JavaTimeModule());
+ return mapper;
+ }
+
+ /**
+ * Convert an object to JSON byte array.
+ *
+ * @param object the object to convert.
+ * @return the JSON byte array.
+ * @throws IOException
+ */
+ public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
+ return mapper.writeValueAsBytes(object);
+ }
+
+ /**
+ * Create a byte array with a specific size filled with specified data.
+ *
+ * @param size the size of the byte array.
+ * @param data the data to put in the byte array.
+ * @return the JSON byte array.
+ */
+ public static byte[] createByteArray(int size, String data) {
+ byte[] byteArray = new byte[size];
+ for (int i = 0; i < size; i++) {
+ byteArray[i] = Byte.parseByte(data, 2);
+ }
+ return byteArray;
+ }
+
+ /**
+ * A matcher that tests that the examined string represents the same instant as the reference datetime.
+ */
+ public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher {
+
+ private final ZonedDateTime date;
+
+ public ZonedDateTimeMatcher(ZonedDateTime date) {
+ this.date = date;
+ }
+
+ @Override
+ protected boolean matchesSafely(String item, Description mismatchDescription) {
+ try {
+ if (!date.isEqual(ZonedDateTime.parse(item))) {
+ mismatchDescription.appendText("was ").appendValue(item);
+ return false;
+ }
+ return true;
+ } catch (DateTimeParseException e) {
+ mismatchDescription.appendText("was ").appendValue(item).appendText(", which could not be parsed as a ZonedDateTime");
+ return false;
+ }
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("a String representing the same Instant as ").appendValue(date);
+ }
+ }
+
+ /**
+ * Creates a matcher that matches when the examined string represents the same instant as the reference datetime.
+ *
+ * @param date the reference datetime against which the examined string is checked.
+ */
+ public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) {
+ return new ZonedDateTimeMatcher(date);
+ }
+
+ /**
+ * A matcher that tests that the examined number represents the same value - it can be Long, Double, etc - as the reference BigDecimal.
+ */
+ public static class NumberMatcher extends TypeSafeMatcher {
+
+ final BigDecimal value;
+
+ public NumberMatcher(BigDecimal value) {
+ this.value = value;
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("a numeric value is ").appendValue(value);
+ }
+
+ @Override
+ protected boolean matchesSafely(Number item) {
+ BigDecimal bigDecimal = asDecimal(item);
+ return bigDecimal != null && value.compareTo(bigDecimal) == 0;
+ }
+
+ private static BigDecimal asDecimal(Number item) {
+ if (item == null) {
+ return null;
+ }
+ if (item instanceof BigDecimal) {
+ return (BigDecimal) item;
+ } else if (item instanceof Long) {
+ return BigDecimal.valueOf((Long) item);
+ } else if (item instanceof Integer) {
+ return BigDecimal.valueOf((Integer) item);
+ } else if (item instanceof Double) {
+ return BigDecimal.valueOf((Double) item);
+ } else if (item instanceof Float) {
+ return BigDecimal.valueOf((Float) item);
+ } else {
+ return BigDecimal.valueOf(item.doubleValue());
+ }
+ }
+ }
+
+ /**
+ * Creates a matcher that matches when the examined number represents the same value as the reference BigDecimal.
+ *
+ * @param number the reference BigDecimal against which the examined number is checked.
+ */
+ public static NumberMatcher sameNumber(BigDecimal number) {
+ return new NumberMatcher(number);
+ }
+
+ /**
+ * Verifies the equals/hashcode contract on the domain object.
+ */
+ public static void equalsVerifier(Class clazz) throws Exception {
+ T domainObject1 = clazz.getConstructor().newInstance();
+ assertThat(domainObject1.toString()).isNotNull();
+ assertThat(domainObject1).isEqualTo(domainObject1);
+ assertThat(domainObject1).hasSameHashCodeAs(domainObject1);
+ // Test with an instance of another class
+ Object testOtherObject = new Object();
+ assertThat(domainObject1).isNotEqualTo(testOtherObject);
+ assertThat(domainObject1).isNotEqualTo(null);
+ // Test with an instance of the same class
+ T domainObject2 = clazz.getConstructor().newInstance();
+ assertThat(domainObject1).isNotEqualTo(domainObject2);
+ // HashCodes are equals because the objects are not persisted yet
+ assertThat(domainObject1).hasSameHashCodeAs(domainObject2);
+ }
+
+ /**
+ * Create a {@link FormattingConversionService} which use ISO date format, instead of the localized one.
+ * @return the {@link FormattingConversionService}.
+ */
+ public static FormattingConversionService createFormattingConversionService() {
+ DefaultFormattingConversionService dfcs = new DefaultFormattingConversionService();
+ DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
+ registrar.setUseIsoFormat(true);
+ registrar.registerFormatters(dfcs);
+ return dfcs;
+ }
+
+ /**
+ * Makes a an executes a query to the EntityManager finding all stored objects.
+ * @param The type of objects to be searched
+ * @param em The instance of the EntityManager
+ * @param clss The class type to be searched
+ * @return A list of all found objects
+ */
+ public static List findAll(EntityManager em, Class clss) {
+ CriteriaBuilder cb = em.getCriteriaBuilder();
+ CriteriaQuery cq = cb.createQuery(clss);
+ Root rootEntry = cq.from(clss);
+ CriteriaQuery all = cq.select(rootEntry);
+ TypedQuery allQuery = em.createQuery(all);
+ return allQuery.getResultList();
+ }
+
+ private TestUtil() {}
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/WithUnauthenticatedMockUser.java b/src/test/java/com/scb/fimob/web/rest/WithUnauthenticatedMockUser.java
new file mode 100644
index 0000000..b425361
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/WithUnauthenticatedMockUser.java
@@ -0,0 +1,23 @@
+package com.scb.fimob.web.rest;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.test.context.support.WithSecurityContext;
+import org.springframework.security.test.context.support.WithSecurityContextFactory;
+
+@Target({ ElementType.METHOD, ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@WithSecurityContext(factory = WithUnauthenticatedMockUser.Factory.class)
+public @interface WithUnauthenticatedMockUser {
+ class Factory implements WithSecurityContextFactory {
+
+ @Override
+ public SecurityContext createSecurityContext(WithUnauthenticatedMockUser annotation) {
+ return SecurityContextHolder.createEmptyContext();
+ }
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorIT.java b/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorIT.java
new file mode 100644
index 0000000..9b8bf32
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorIT.java
@@ -0,0 +1,118 @@
+package com.scb.fimob.web.rest.errors;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import com.scb.fimob.IntegrationTest;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
+import org.springframework.test.web.servlet.MockMvc;
+
+/**
+ * Integration tests {@link ExceptionTranslator} controller advice.
+ */
+@WithMockUser
+@AutoConfigureMockMvc
+@IntegrationTest
+class ExceptionTranslatorIT {
+
+ @Autowired
+ private MockMvc mockMvc;
+
+ @Test
+ void testConcurrencyFailure() throws Exception {
+ mockMvc
+ .perform(get("/api/exception-translator-test/concurrency-failure"))
+ .andExpect(status().isConflict())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE));
+ }
+
+ @Test
+ void testMethodArgumentNotValid() throws Exception {
+ mockMvc
+ .perform(post("/api/exception-translator-test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isBadRequest())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION))
+ .andExpect(jsonPath("$.fieldErrors.[0].objectName").value("test"))
+ .andExpect(jsonPath("$.fieldErrors.[0].field").value("test"))
+ .andExpect(jsonPath("$.fieldErrors.[0].message").value("must not be null"));
+ }
+
+ @Test
+ void testMissingServletRequestPartException() throws Exception {
+ mockMvc
+ .perform(get("/api/exception-translator-test/missing-servlet-request-part"))
+ .andExpect(status().isBadRequest())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value("error.http.400"));
+ }
+
+ @Test
+ void testMissingServletRequestParameterException() throws Exception {
+ mockMvc
+ .perform(get("/api/exception-translator-test/missing-servlet-request-parameter"))
+ .andExpect(status().isBadRequest())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value("error.http.400"));
+ }
+
+ @Test
+ void testAccessDenied() throws Exception {
+ mockMvc
+ .perform(get("/api/exception-translator-test/access-denied"))
+ .andExpect(status().isForbidden())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value("error.http.403"))
+ .andExpect(jsonPath("$.detail").value("test access denied!"));
+ }
+
+ @Test
+ void testUnauthorized() throws Exception {
+ mockMvc
+ .perform(get("/api/exception-translator-test/unauthorized"))
+ .andExpect(status().isUnauthorized())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value("error.http.401"))
+ .andExpect(jsonPath("$.path").value("/api/exception-translator-test/unauthorized"))
+ .andExpect(jsonPath("$.detail").value("test authentication failed!"));
+ }
+
+ @Test
+ void testMethodNotSupported() throws Exception {
+ mockMvc
+ .perform(post("/api/exception-translator-test/access-denied"))
+ .andExpect(status().isMethodNotAllowed())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value("error.http.405"))
+ .andExpect(jsonPath("$.detail").value("Request method 'POST' not supported"));
+ }
+
+ @Test
+ void testExceptionWithResponseStatus() throws Exception {
+ mockMvc
+ .perform(get("/api/exception-translator-test/response-status"))
+ .andExpect(status().isBadRequest())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value("error.http.400"))
+ .andExpect(jsonPath("$.title").value("test response status"));
+ }
+
+ @Test
+ void testInternalServerError() throws Exception {
+ mockMvc
+ .perform(get("/api/exception-translator-test/internal-server-error"))
+ .andExpect(status().isInternalServerError())
+ .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
+ .andExpect(jsonPath("$.message").value("error.http.500"))
+ .andExpect(jsonPath("$.title").value("Internal Server Error"));
+ }
+}
diff --git a/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorTestController.java b/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorTestController.java
new file mode 100644
index 0000000..2060727
--- /dev/null
+++ b/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorTestController.java
@@ -0,0 +1,66 @@
+package com.scb.fimob.web.rest.errors;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import org.springframework.dao.ConcurrencyFailureException;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/api/exception-translator-test")
+public class ExceptionTranslatorTestController {
+
+ @GetMapping("/concurrency-failure")
+ public void concurrencyFailure() {
+ throw new ConcurrencyFailureException("test concurrency failure");
+ }
+
+ @PostMapping("/method-argument")
+ public void methodArgument(@Valid @RequestBody TestDTO testDTO) {}
+
+ @GetMapping("/missing-servlet-request-part")
+ public void missingServletRequestPartException(@RequestPart String part) {}
+
+ @GetMapping("/missing-servlet-request-parameter")
+ public void missingServletRequestParameterException(@RequestParam String param) {}
+
+ @GetMapping("/access-denied")
+ public void accessdenied() {
+ throw new AccessDeniedException("test access denied!");
+ }
+
+ @GetMapping("/unauthorized")
+ public void unauthorized() {
+ throw new BadCredentialsException("test authentication failed!");
+ }
+
+ @GetMapping("/response-status")
+ public void exceptionWithResponseStatus() {
+ throw new TestResponseStatusException();
+ }
+
+ @GetMapping("/internal-server-error")
+ public void internalServerError() {
+ throw new RuntimeException();
+ }
+
+ public static class TestDTO {
+
+ @NotNull
+ private String test;
+
+ public String getTest() {
+ return test;
+ }
+
+ public void setTest(String test) {
+ this.test = test;
+ }
+ }
+
+ @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "test response status")
+ @SuppressWarnings("serial")
+ public static class TestResponseStatusException extends RuntimeException {}
+}
diff --git a/src/test/resources/config/application-testcontainers.yml b/src/test/resources/config/application-testcontainers.yml
index 4c616c6..4464917 100644
--- a/src/test/resources/config/application-testcontainers.yml
+++ b/src/test/resources/config/application-testcontainers.yml
@@ -15,7 +15,7 @@ spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver
- url: jdbc:tc:sqlserver:2019-CU15-ubuntu-20.04://;database=Springboot?TC_TMPFS=/testtmpfs:rw
+ url: jdbc:tc:sqlserver:2019-CU15-ubuntu-20.04://;database=FIM?TC_TMPFS=/testtmpfs:rw
username: SA
password: yourStrong(!)Password
hikari:
diff --git a/src/test/resources/config/application.yml b/src/test/resources/config/application.yml
index 1341636..eedd8fd 100644
--- a/src/test/resources/config/application.yml
+++ b/src/test/resources/config/application.yml
@@ -17,21 +17,21 @@ eureka:
client:
enabled: false
instance:
- appname: Springboot
- instanceId: Springboot:${spring.application.instance-id:${random.value}}
+ appname: FIM
+ instanceId: FIM:${spring.application.instance-id:${random.value}}
spring:
profiles:
# Uncomment the following line to enable tests against production database type rather than H2, using Testcontainers
#active: testcontainers
application:
- name: Springboot
+ name: FIM
cloud:
config:
enabled: false
datasource:
type: com.zaxxer.hikari.HikariDataSource
- url: jdbc:h2:mem:springboot;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
+ url: jdbc:h2:mem:fim;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
name:
username:
password:
@@ -71,13 +71,13 @@ spring:
basename: i18n/messages
task:
execution:
- thread-name-prefix: springboot-task-
+ thread-name-prefix: fim-task-
pool:
core-size: 1
max-size: 50
queue-capacity: 10000
scheduling:
- thread-name-prefix: springboot-scheduling-
+ thread-name-prefix: fim-scheduling-
pool:
size: 1
thymeleaf:
@@ -95,7 +95,7 @@ server:
jhipster:
clientApp:
- name: 'springbootApp'
+ name: 'fimApp'
logging:
# To test json console appender
use-json-format: false
diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml
index 2f75d2d..7b12e20 100644
--- a/src/test/resources/logback.xml
+++ b/src/test/resources/logback.xml
@@ -4,7 +4,7 @@
-
+
@@ -25,6 +25,7 @@
+
diff --git a/test_fim.jh b/test_fim.jh
new file mode 100644
index 0000000..9019601
--- /dev/null
+++ b/test_fim.jh
@@ -0,0 +1,167 @@
+application {
+ config {
+ baseName FIM,
+ applicationType microservice,
+ packageName com.scb.fimob,
+ authenticationType jwt,
+ prodDatabaseType mssql,
+ buildTool maven
+ }
+ entities *
+}
+entity FimAccounts{
+ AccountId String
+ CustId String maxlength(30) required
+ RelnId String maxlength(30) required
+ RelnType String maxlength(5) required
+ OperInst String maxlength(10)
+ IsAcctNbr String maxlength(30) required
+ BndAcctNbr String maxlength(30) required
+ ClosingId String maxlength(10)
+ SubSegment String maxlength(10)
+ BranchCode String maxlength(10)
+ AcctStatus String maxlength(10) required
+ CtryCode String maxlength(3)
+ AcctOwners String maxlength(100)
+ Remarks String maxlength(200)
+ CreatedBy String maxlength(8)
+ CreatedTs Instant
+ UpdatedBy String maxlength(8)
+ UpdatedTs Instant
+ RecordStatus String maxlength(10)
+}
+entity FimAccountsWq{
+ AccountId String
+ CustId String maxlength(30) required
+ RelnId String maxlength(30) required
+ RelnType String maxlength(5) required
+ OperInst String maxlength(10)
+ IsAcctNbr String maxlength(30) required
+ BndAcctNbr String maxlength(30) required
+ ClosingId String maxlength(10)
+ SubSegment String maxlength(10)
+ BranchCode String maxlength(10)
+ AcctStatus String maxlength(10) required
+ CtryCode String maxlength(3)
+ AcctOwners String maxlength(100)
+ Remarks String maxlength(200)
+ CreatedBy String maxlength(8)
+ CreatedTs Instant
+ UpdatedBy String maxlength(8)
+ UpdatedTs Instant
+ RecordStatus String maxlength(10)
+ UploadRemark String
+}
+
+entity FimAccountsHistory{
+ AccountId String
+ HistoryTs Instant
+ CustId String maxlength(30) required
+ RelnId String maxlength(30) required
+ RelnType String maxlength(5) required
+ OperInst String maxlength(10)
+ IsAcctNbr String maxlength(30) required
+ BndAcctNbr String maxlength(30) required
+ ClosingId String maxlength(10)
+ SubSegment String maxlength(10)
+ BranchCode String maxlength(10)
+ AcctStatus String maxlength(10) required
+ CtryCode String maxlength(3)
+ AcctOwners String maxlength(100)
+ Remarks String maxlength(200)
+ CreatedBy String maxlength(8)
+ CreatedTs Instant
+ UpdatedBy String maxlength(8)
+ UpdatedTs Instant
+ RecordStatus String maxlength(10)
+}
+entity FimSettAcct{
+ SettaccId String
+ AccountId String maxlength(15) required
+ SettAcctNbr String maxlength(30) required
+ SettCcy String maxlength(3) required
+ SettAcctStatus String maxlength(10) required
+ CreatedBy String maxlength(8)
+ CreatedTs Instant
+ UpdatedBy String maxlength(8)
+ UpdatedTs Instant
+ RecordStatus String maxlength(10)
+}
+
+entity FimSettAcctWq{
+ SettaccId String
+ AccountId String maxlength(15) required
+ SettAcctNbr String maxlength(30) required
+ SettCcy String maxlength(3) required
+ SettAcctStatus String maxlength(10) required
+ CreatedBy String maxlength(8)
+ CreatedTs Instant
+ UpdatedBy String maxlength(8)
+ UpdatedTs Instant
+ RecordStatus String maxlength(10)
+ UploadRemark String
+}
+
+entity FimSettAcctHistory{
+ SettaccId String
+ HistoryTs Instant
+ AccountId String maxlength(15) required
+ SettAcctNbr String maxlength(30) required
+ SettCcy String maxlength(3) required
+ SettAcctStatus String maxlength(10) required
+ CreatedBy String maxlength(8)
+ CreatedTs Instant
+ UpdatedBy String maxlength(8)
+ UpdatedTs Instant
+ RecordStatus String maxlength(10)
+}
+entity FimCust{
+CustId String
+ClientId String maxlength(30) required
+IdType String maxlength(10) required
+CtryCode String maxlength(3) required
+CreatedBy String maxlength(8) required
+CreatedTs Instant
+UpdatedBy String maxlength(8)
+UpdatedTs Instant
+RecordStatus String
+UploadRemark String
+}
+
+entity FimCustWq{
+CustId String
+ClientId String maxlength(30) required
+IdType String maxlength(10) required
+CtryCode String maxlength(3) required
+CreatedBy String maxlength(8) required
+CreatedTs Instant
+UpdatedBy String maxlength(8)
+UpdatedTs Instant
+RecordStatus String
+UploadRemark String
+}
+entity FimCustHistory{
+CustId String
+HistoryTs Instant
+ClientId String maxlength(30) required
+IdType String maxlength(10) required
+CtryCode String maxlength(3) required
+CreatedBy String maxlength(8) required
+CreatedTs Instant
+UpdatedBy String maxlength(8)
+UpdatedTs Instant
+RecordStatus String
+}
+entity Ethnicity{
+Name String required
+UrduName String
+}
+
+
+
+
+service * with serviceClass
+dto all with mapstruct
+
+paginate FimCust,FimSettAcct with pagination
+
\ No newline at end of file