unified code format
This commit is contained in:
@@ -29,45 +29,45 @@ import static net.chrisrichardson.eventstorestore.javaexamples.testutil.Customer
|
||||
@IntegrationTest({"server.port=0", "management.port=0"})
|
||||
public class BankingAuthTest {
|
||||
|
||||
@Value("${local.server.port}")
|
||||
private int port;
|
||||
@Value("${local.server.port}")
|
||||
private int port;
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
||||
CustomersTestUtils customersTestUtils;
|
||||
CustomersTestUtils customersTestUtils;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
customersTestUtils = new CustomersTestUtils(restTemplate, baseUrl("/customers/"));
|
||||
}
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
customersTestUtils = new CustomersTestUtils(restTemplate, baseUrl("/customers/"));
|
||||
}
|
||||
|
||||
private String baseUrl(String path) {
|
||||
return "http://localhost:" + port + "/" + path;
|
||||
}
|
||||
private String baseUrl(String path) {
|
||||
return "http://localhost:" + port + "/" + path;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateCustomerAndLogin() {
|
||||
String email = uniqueEmail();
|
||||
CustomerInfo customerInfo = generateCustomerInfo(email);
|
||||
@Test
|
||||
public void shouldCreateCustomerAndLogin() {
|
||||
String email = uniqueEmail();
|
||||
CustomerInfo customerInfo = generateCustomerInfo(email);
|
||||
|
||||
final CustomerResponse customerResponse = restTemplate.postForEntity(baseUrl("/customers"), customerInfo, CustomerResponse.class).getBody();
|
||||
final String customerId = customerResponse.getId();
|
||||
final CustomerResponse customerResponse = restTemplate.postForEntity(baseUrl("/customers"), customerInfo, CustomerResponse.class).getBody();
|
||||
final String customerId = customerResponse.getId();
|
||||
|
||||
Assert.assertNotNull(customerId);
|
||||
Assert.assertEquals(customerInfo, customerResponse.getCustomerInfo());
|
||||
Assert.assertNotNull(customerId);
|
||||
Assert.assertEquals(customerInfo, customerResponse.getCustomerInfo());
|
||||
|
||||
customersTestUtils.assertCustomerResponse(customerId, customerInfo);
|
||||
customersTestUtils.assertCustomerResponse(customerId, customerInfo);
|
||||
|
||||
AuthRequest authRequest = new AuthRequest(email);
|
||||
AuthRequest authRequest = new AuthRequest(email);
|
||||
|
||||
final QuerySideCustomer loginQuerySideCustomer = restTemplate.postForEntity(baseUrl("/login"), authRequest, QuerySideCustomer.class).getBody();
|
||||
final QuerySideCustomer loginQuerySideCustomer = restTemplate.postForEntity(baseUrl("/login"), authRequest, QuerySideCustomer.class).getBody();
|
||||
|
||||
customersTestUtils.assertQuerySideCustomerEqualscCustomerInfo(loginQuerySideCustomer, customerResponse.getCustomerInfo());
|
||||
}
|
||||
customersTestUtils.assertQuerySideCustomerEqualscCustomerInfo(loginQuerySideCustomer, customerResponse.getCustomerInfo());
|
||||
}
|
||||
|
||||
|
||||
private String uniqueEmail() {
|
||||
return System.currentTimeMillis() + "@email.com";
|
||||
}
|
||||
private String uniqueEmail() {
|
||||
return System.currentTimeMillis() + "@email.com";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,36 +20,36 @@ import javax.annotation.PostConstruct;
|
||||
@IntegrationTest({"server.port=0", "management.port=0"})
|
||||
public class BankingWebIntegrationTest extends AbstractRestAPITest {
|
||||
|
||||
@Value("${local.server.port}")
|
||||
private int port;
|
||||
@Value("${local.server.port}")
|
||||
private int port;
|
||||
|
||||
CustomersTestUtils customersTestUtils;
|
||||
CustomersTestUtils customersTestUtils;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
customersTestUtils = new CustomersTestUtils(restTemplate, baseUrl("/customers/"));
|
||||
}
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
customersTestUtils = new CustomersTestUtils(restTemplate, baseUrl("/customers/"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String baseUrl(String path) {
|
||||
return "http://localhost:" + port + "/" + path;
|
||||
}
|
||||
@Override
|
||||
public String baseUrl(String path) {
|
||||
return "http://localhost:" + port + "/" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomersTestUtils getCustomersTestUtils() {
|
||||
return customersTestUtils;
|
||||
}
|
||||
@Override
|
||||
public CustomersTestUtils getCustomersTestUtils() {
|
||||
return customersTestUtils;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
||||
@Override
|
||||
public AuthenticatedRestTemplate getAuthenticatedRestTemplate() {
|
||||
return new AuthenticatedRestTemplate(restTemplate);
|
||||
}
|
||||
@Override
|
||||
public AuthenticatedRestTemplate getAuthenticatedRestTemplate() {
|
||||
return new AuthenticatedRestTemplate(restTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestTemplate getRestTemplate() {
|
||||
return restTemplate;
|
||||
}
|
||||
@Override
|
||||
public RestTemplate getRestTemplate() {
|
||||
return restTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user