BAEL-4321 move to new module and use BDD for test names

This commit is contained in:
Trixi Turny 2020-08-12 19:22:31 +01:00
parent e23d7f8efb
commit dbe203e40a
10 changed files with 5 additions and 18 deletions

View File

@ -1,13 +0,0 @@
package yamltopojo.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}

View File

@ -7,7 +7,7 @@ import yamltopojo.demo.service.SizeConverterService;
@RequestMapping(value = "/")
public class TshirtSizeController {
private SizeConverterService service;
private final SizeConverterService service;
public TshirtSizeController(SizeConverterService service) {
this.service = service;

View File

@ -7,7 +7,7 @@ import yamltopojo.demo.config.TshirtSizeConfig;
@Service
public class SizeConverterImpl implements SizeConverterService {
private TshirtSizeConfig tshirtSizeConfig;
private final TshirtSizeConfig tshirtSizeConfig;
public SizeConverterImpl(TshirtSizeConfig tshirtSizeConfig) {
this.tshirtSizeConfig = tshirtSizeConfig;
@ -17,6 +17,6 @@ public class SizeConverterImpl implements SizeConverterService {
if(countryCode == null) {
return tshirtSizeConfig.getSimpleMapping().get(label);
}
return tshirtSizeConfig.getComplexMapping().get(label).get(countryCode);
return tshirtSizeConfig.getComplexMapping().get(label).get(countryCode.toLowerCase());
}
}

View File

@ -20,14 +20,14 @@ class TshirtSizeControllerTest {
private TshirtSizeController tested;
@Test
void convertSize() {
void givenSizeConverter_whenLabelIsSandCountryCodeIsFr_thenReturnCorrectSize() {
// Given
String label = "S";
String countryCode = "fr";
int result = 36;
//
// When
when(service.convertSize(label, countryCode)).thenReturn(result);
int actual = tested.convertSize(label, countryCode);