Skip to content

Commit

Permalink
FINERACT-1971: Align dates and dateformat in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsaghy committed Sep 21, 2023
1 parent 710e614 commit 0927c8e
Show file tree
Hide file tree
Showing 11 changed files with 425 additions and 404 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ private PostClientsClientIdRequest() {}

@Schema(example = "03 August 2021")
public String activationDate;
@Schema(example = "dd MMM yyyy")
@Schema(example = "dd MMMM yyyy")
public String dateFormat;
@Schema(example = "en")
public String locale;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2235,7 +2235,7 @@ public void testSavingsAccountBlockStatus() {
Integer releaseTransactionId = this.savingsAccountHelper.releaseAmount(savingsId, holdTransactionId);
Date today = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(Utils.getZoneIdOfTenant()).toInstant());
String todayDate = today.toString();
SimpleDateFormat dt1 = new SimpleDateFormat("dd MMM yyyy");
SimpleDateFormat dt1 = new SimpleDateFormat("dd MMMM yyyy");
todayDate = dt1.format(today).toString();
withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "300", todayDate,
CommonConstants.RESPONSE_RESOURCE_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
public class SavingsAccountTransactionTest {

public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
public static final String DEFAULT_DATE_FORMAT = "dd MMM yyyy";
public static final String DEFAULT_DATE_FORMAT = "dd MMMM yyyy";
final String startDateString = "03 June 2023";
final String depositDateString = "05 June 2023";
final String withdrawDateString = "10 June 2023";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
public class SavingsAccountTransactionsSearchIntegrationTest {

public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
public static final String DEFAULT_DATE_FORMAT = "dd MMM yyyy";
public static final String DEFAULT_DATE_FORMAT = "dd MMMM yyyy";
public static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
final String startDate = "01 May 2023";
final String firstDepositDate = "05 May 2023";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public class SavingsAccountsExternalIdTest extends IntegrationTest {
public static final String EXTERNAL_ID = UUID.randomUUID().toString();
private final String dateFormat = "dd MMMM yyyy";
private final String locale = "en";
private final String formattedDate = LocalDate.now(ZoneId.systemDefault()).minusDays(5)
.format(DateTimeFormatter.ofPattern("dd MMM yyyy"));
private final String formattedDate = LocalDate.now(ZoneId.systemDefault()).minusDays(5).format(DateTimeFormatter.ofPattern(dateFormat));

@Test
@Order(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class SavingsAccountsTest extends IntegrationTest {
private static final Logger LOG = LoggerFactory.getLogger(SavingsAccountsTest.class);
private final String dateFormat = "dd MMMM yyyy";
private final String locale = "en";
private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM yyyy");
private final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
private final String formattedDate = simpleDateFormat.format(new Date());
private int savingId = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static String jsonRequestToCreateCenter(Integer id, Integer statusId, Str
if (active) {
map.put("active", "true");
map.put("locale", "en");
map.put("dateFormat", "dd MMM yyyy");
map.put("dateFormat", "dd MMMM yyyy");
map.put("activationDate", activationDate);
} else {
map.put("active", "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static int createCenter(final String name, final int officeId, final Stri
if (activationDate != null) {
hm.put("active", true);
hm.put("locale", "en");
hm.put("dateFormat", "dd MMM yyyy");
hm.put("dateFormat", "dd MMMM yyyy");
hm.put("activationDate", activationDate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void setup() {
@SuppressWarnings("unchecked")
@Test
public void testCreateDividends() {
DateFormat simple = new SimpleDateFormat("dd MMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
final Integer productId = createShareProduct();
ArrayList<Integer> shareAccounts = new ArrayList<>();
for (int i = 0; i < 5; i++) {
Expand Down Expand Up @@ -109,12 +109,12 @@ public void testCreateDividends() {
Calendar cal = Calendar.getInstance();
cal.set(startdateList.get(0), startdateList.get(1) - 1, startdateList.get(2));
Date startDate = cal.getTime();
Assertions.assertEquals("01 Jan 2015", simple.format(startDate));
Assertions.assertEquals("01 January 2015", simple.format(startDate));
List<Integer> enddateList = (List<Integer>) dividend.get("dividendPeriodEndDate");
cal = Calendar.getInstance();
cal.set(enddateList.get(0), enddateList.get(1) - 1, enddateList.get(2));
Date endDate = cal.getTime();
Assertions.assertEquals("01 Apr 2016", simple.format(endDate));
Assertions.assertEquals("01 April 2016", simple.format(endDate));

Map<String, Object> dividenddetails = ShareDividendsTransactionHelper.retrieveDividendDetails(productId, dividendId, requestSpec,
responseSpec);
Expand Down Expand Up @@ -151,12 +151,12 @@ public void testCreateDividends() {
cal = Calendar.getInstance();
cal.set(startdateList.get(0), startdateList.get(1) - 1, startdateList.get(2));
startDate = cal.getTime();
Assertions.assertEquals("01 Jan 2015", simple.format(startDate));
Assertions.assertEquals("01 January 2015", simple.format(startDate));
enddateList = (List<Integer>) dividend.get("dividendPeriodEndDate");
cal = Calendar.getInstance();
cal.set(enddateList.get(0), enddateList.get(1) - 1, enddateList.get(2));
endDate = cal.getTime();
Assertions.assertEquals("01 Apr 2016", simple.format(endDate));
Assertions.assertEquals("01 April 2016", simple.format(endDate));

dividenddetails = ShareDividendsTransactionHelper.retrieveDividendDetails(productId, dividendId, requestSpec, responseSpec);
Assertions.assertEquals("5", String.valueOf(dividenddetails.get("totalFilteredRecords")));
Expand Down
Loading

0 comments on commit 0927c8e

Please sign in to comment.