BAEL-4362 - Generate WSDL Stubs with Maven

Removing blank lines
Fixing test names to BDD-style
This commit is contained in:
Sallo Szrajbman 2021-03-08 21:15:42 +00:00
parent 422d2359e5
commit dddfc05349
2 changed files with 7 additions and 8 deletions

View File

@ -9,6 +9,7 @@ public class CountryServiceClient {
public CountryServiceClient(CountryService countryService) {
this.countryService = countryService;
}
public String getCapitalByCountryName(String countryName) {
return Optional.of(countryService.findByName(countryName))
.map(Country::getCapital).orElseThrow(CountryNotFoundException::new);
@ -23,6 +24,4 @@ public class CountryServiceClient {
return Optional.of(countryService.findByName(countryName))
.map(Country::getCurrency).orElseThrow(CountryNotFoundException::new);
}
}

View File

@ -18,14 +18,14 @@ class CountryServiceClientUnitTest {
@DisplayName("Get capital by country name when country not found")
@Test
void getCapitalByCountryName_WhenCountryDoesNotExists_ThenShouldThrowCountryNotFoundException() {
void givenCountryDoesNotExist_whenGetCapitalByCountryName_thenThrowsCountryNotFoundException() {
doThrow(CountryNotFoundException.class).when(countryService).findByName(any());
Assertions.assertThrows(CountryNotFoundException.class, () -> countryServiceClient.getCapitalByCountryName(any()));
}
@DisplayName("Get capital by country name when country is India then should return capital")
@Test
void getCapitalByCountryName_WhenCountryEqualsIndia_ThenShouldReturnCapital() {
void givenCountryIndia_whenGetCapitalByCountryName_thenShouldReturnCapital() {
Country country = mock(Country.class);
doReturn("New Delhi").when(country).getCapital();
@ -36,14 +36,14 @@ class CountryServiceClientUnitTest {
@DisplayName("Get population by country name when country not found")
@Test
void getPopulationByCountryName_WhenCountryDoesNotExists_ThenShouldThrowCountryNotFoundException() {
void givenCountryDoesNotExist_getPopulationByCountryName_thenThrowsCountryNotFoundException() {
doThrow(CountryNotFoundException.class).when(countryService).findByName(any());
Assertions.assertThrows(CountryNotFoundException.class, () -> countryServiceClient.getPopulationByCountryName(any()));
}
@DisplayName("Get population by country name when country is India then should return population")
@Test
void getPopulationByCountryName_WhenCountryEqualsIndia_ThenShouldReturnPopulation() {
void givenCountryIndia_getPopulationByCountryName_thenShouldReturnPopulation() {
Country country = mock(Country.class);
doReturn(1000000).when(country).getPopulation();
@ -54,14 +54,14 @@ class CountryServiceClientUnitTest {
@DisplayName("Get currency by country name when country not found")
@Test
void getCurrencyByCountryName_WhenCountryDoesNotExists_ThenShouldThrowCountryNotFoundException() {
void givenCountryDoesNotExist_getCurrencyByCountryName_thenThrowsCountryNotFoundException() {
doThrow(CountryNotFoundException.class).when(countryService).findByName(any());
Assertions.assertThrows(CountryNotFoundException.class, () -> countryServiceClient.getCurrencyByCountryName(any()));
}
@DisplayName("Get currency by country name when country is India then should return currency")
@Test
void getCurrencyByCountryName_WhenCountryEqualsIndia_ThenShouldReturnCurrency() {
void givenCountryIndia_getCurrencyByCountryName_thenShouldReturnCurrency() {
Country country = mock(Country.class);
doReturn(Currency.INR).when(country).getCurrency();