1212import static org .hamcrest .MatcherAssert .assertThat ;
1313import static org .junit .jupiter .api .Assertions .assertThrows ;
1414
15- public class TransactionSearchParamsValidatorTest {
15+ class TransactionSearchParamsValidatorTest {
1616
17- TransactionSearchParams searchParams ;
17+ private TransactionSearchParams searchParams ;
1818
1919 @ BeforeEach
20- public void setup () {
20+ void setup () {
2121 searchParams = new TransactionSearchParams ();
2222 }
2323
2424 @ Test
25- public void shouldThrowException_whenInvalidFromDate () {
25+ void shouldThrowException_whenInvalidFromDate () {
2626 searchParams .setFromDate ("wrong-date" );
2727 UnparsableDateException unparsableDateException = assertThrows (UnparsableDateException .class ,
2828 () -> TransactionSearchParamsValidator .validateSearchParams (searchParams , null ));
2929 assertThat (unparsableDateException .getMessage (), is ("Input from_date (wrong-date) is wrong format" ));
3030 }
3131
3232 @ Test
33- public void shouldThrowException_whenInvalidToDate () {
33+ void shouldThrowException_whenInvalidToDate () {
3434 searchParams .setToDate ("wrong-date" );
3535 UnparsableDateException unparsableDateException = assertThrows (UnparsableDateException .class ,
3636 () -> TransactionSearchParamsValidator .validateSearchParams (searchParams , null ));
3737 assertThat (unparsableDateException .getMessage (), is ("Input to_date (wrong-date) is wrong format" ));
3838 }
3939
4040 @ Test
41- public void shouldThrowException_whenInvalidFromSettledDate () {
41+ void shouldThrowException_whenInvalidFromSettledDate () {
4242 searchParams .setFromSettledDate ("wrong-date" );
4343 UnparsableDateException unparsableDateException = assertThrows (UnparsableDateException .class ,
4444 () -> TransactionSearchParamsValidator .validateSearchParams (searchParams , null ));
4545 assertThat (unparsableDateException .getMessage (), is ("Input from_settled_date (wrong-date) is wrong format" ));
4646 }
4747
4848 @ Test
49- public void shouldThrowException_whenInvalidToSettledDate () {
49+ void shouldThrowException_whenInvalidToSettledDate () {
5050 searchParams .setToSettledDate ("wrong-date" );
5151 UnparsableDateException unparsableDateException = assertThrows (UnparsableDateException .class ,
5252 () -> TransactionSearchParamsValidator .validateSearchParams (searchParams , null ));
5353 assertThat (unparsableDateException .getMessage (), is ("Input to_settled_date (wrong-date) is wrong format" ));
5454 }
5555
5656 @ Test
57- public void shouldNotThrowException_whenValidDateFormats () {
57+ void shouldNotThrowException_whenValidDateFormats () {
5858 searchParams .setFromDate ("2019-05-01T10:15:30Z" );
5959 searchParams .setToDate ("2019-05-01T10:15:30Z" );
6060 TransactionSearchParamsValidator .validateSearchParams (searchParams , null );
6161 }
6262
6363 @ Test
64- public void shouldNotThrowException_whenValidSettledDateFormats () {
64+ void shouldNotThrowException_whenValidSettledDateFormats () {
6565 searchParams .setFromSettledDate ("2020-09-10" );
6666 searchParams .setToSettledDate ("2020-09-10" );
6767 TransactionSearchParamsValidator .validateSearchParams (searchParams , null );
6868 }
6969
7070 @ Test
71- public void validateSearchParamsForCsvShouldNotThrowExceptionForValidParams () {
71+ void validateSearchParamsForCsvShouldNotThrowExceptionForValidParams () {
7272 searchParams .setFromDate ("2019-05-01T10:15:30Z" );
7373 searchParams .setToDate ("2019-05-01T10:15:30Z" );
7474 TransactionSearchParamsValidator .validateSearchParamsForCsv (
7575 searchParams , new CommaDelimitedSetParameter ("1,2" ));
7676 }
7777
7878 @ Test
79- public void validateSearchParamsForCsvShouldThrowExceptionIfGatewayAccountIsNotAvailable () {
79+ void validateSearchParamsForCsvShouldThrowExceptionIfGatewayAccountIsNotAvailable () {
8080 assertThrows (ValidationException .class , () -> TransactionSearchParamsValidator .validateSearchParamsForCsv (
8181 searchParams , null ));
8282 }
8383
8484 @ Test
85- public void validateSearchParamsForCsvShouldThrowExceptionIfGatewayAccountIdsIsEmptyString () {
85+ void validateSearchParamsForCsvShouldThrowExceptionIfGatewayAccountIdsIsEmptyString () {
8686 assertThrows (ValidationException .class , () -> TransactionSearchParamsValidator .validateSearchParamsForCsv (
8787 searchParams , new CommaDelimitedSetParameter ("" )));
8888 }
@@ -92,7 +92,7 @@ public void validateSearchParamsForCsvShouldThrowExceptionIfGatewayAccountIdsIsE
9292 "wrong-date, 2019-05-01T10:15:30Z" ,
9393 "2019-05-01T10:15:30Z, wrong-date"
9494 })
95- public void validateSearchParamsForCsvShouldThrowExceptionForInvalidDates (String fromDate , String toDate ) {
95+ void validateSearchParamsForCsvShouldThrowExceptionForInvalidDates (String fromDate , String toDate ) {
9696 searchParams .setFromDate (fromDate );
9797 searchParams .setToDate (toDate );
9898
@@ -101,15 +101,15 @@ public void validateSearchParamsForCsvShouldThrowExceptionForInvalidDates(String
101101 }
102102
103103 @ Test
104- public void validateFromSettledDateSearchParamsShouldThrowExceptionForInvalidDates () {
104+ void validateFromSettledDateSearchParamsShouldThrowExceptionForInvalidDates () {
105105 searchParams .setFromSettledDate ("25/09/2020" );
106106 UnparsableDateException unparsableDateException = assertThrows (UnparsableDateException .class ,
107107 () -> TransactionSearchParamsValidator .validateSearchParams (searchParams , null ));
108108 assertThat (unparsableDateException .getMessage (), is ("Input from_settled_date (25/09/2020) is wrong format" ));
109109 }
110110
111111 @ Test
112- public void validateToSettledDateSearchParamsShouldThrowExceptionForInvalidDates () {
112+ void validateToSettledDateSearchParamsShouldThrowExceptionForInvalidDates () {
113113 searchParams .setToSettledDate ("2020.09.25" );
114114 UnparsableDateException unparsableDateException = assertThrows (UnparsableDateException .class ,
115115 () -> TransactionSearchParamsValidator .validateSearchParams (searchParams , null ));
0 commit comments