minor formatting cleanup
This commit is contained in:
parent
bdc59432a6
commit
b18f2a58c8
|
@ -54,8 +54,6 @@ public class GenericEntityController {
|
||||||
|
|
||||||
@GetMapping("/entity/findbyversion")
|
@GetMapping("/entity/findbyversion")
|
||||||
public ResponseEntity findByVersion(@Version String version) {
|
public ResponseEntity findByVersion(@Version String version) {
|
||||||
return version != null
|
return version != null ? new ResponseEntity(entityList.stream().findFirst().get(), HttpStatus.OK) : new ResponseEntity(HttpStatus.NOT_FOUND);
|
||||||
? new ResponseEntity(entityList.stream().findFirst().get(), HttpStatus.OK)
|
|
||||||
: new ResponseEntity(HttpStatus.NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,29 +45,22 @@ public class SpringBootApplicationIntegrationTest {
|
||||||
public void givenRequestHasBeenMade_whenMeetsFindByDateOfGivenConditions_thenCorrect() throws Exception {
|
public void givenRequestHasBeenMade_whenMeetsFindByDateOfGivenConditions_thenCorrect() throws Exception {
|
||||||
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
||||||
|
|
||||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30"))
|
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(jsonPath("$.id", equalTo(1)));
|
||||||
.andExpect(MockMvcResultMatchers.content().contentType(contentType))
|
|
||||||
.andExpect(jsonPath("$.id", equalTo(1)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenRequestHasBeenMade_whenMeetsFindByModeOfGivenConditions_thenCorrect() throws Exception {
|
public void givenRequestHasBeenMade_whenMeetsFindByModeOfGivenConditions_thenCorrect() throws Exception {
|
||||||
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
||||||
|
|
||||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name()))
|
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name())).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)).andExpect(jsonPath("$.id", equalTo(1)));
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
|
||||||
.andExpect(MockMvcResultMatchers.content().contentType(contentType))
|
|
||||||
.andExpect(jsonPath("$.id", equalTo(1)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenRequestHasBeenMade_whenMeetsFindByVersionOfGivenConditions_thenCorrect() throws Exception {
|
public void givenRequestHasBeenMade_whenMeetsFindByVersionOfGivenConditions_thenCorrect() throws Exception {
|
||||||
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
||||||
|
|
||||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0"))
|
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType))
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
.andExpect(jsonPath("$.id", equalTo(1)));
|
||||||
.andExpect(MockMvcResultMatchers.content().contentType(contentType))
|
|
||||||
.andExpect(jsonPath("$.id", equalTo(1)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,8 @@ public class ProductInfoRepositoryIntegrationTest {
|
||||||
private static final String EXPECTED_PRICE = "50";
|
private static final String EXPECTED_PRICE = "50";
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@Ignore //TODO Remove Ignore annotations when running locally with Local DynamoDB instance
|
@Ignore // TODO Remove Ignore annotations when running locally with Local DynamoDB instance
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dynamoDBMapper = new DynamoDBMapper(amazonDynamoDB);
|
dynamoDBMapper = new DynamoDBMapper(amazonDynamoDB);
|
||||||
|
@ -64,7 +64,7 @@ public class ProductInfoRepositoryIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore //TODO Remove Ignore annotations when running locally with Local DynamoDB instance
|
@Ignore // TODO Remove Ignore annotations when running locally with Local DynamoDB instance
|
||||||
public void givenItemWithExpectedCost_whenRunFindAll_thenItemIsFound() {
|
public void givenItemWithExpectedCost_whenRunFindAll_thenItemIsFound() {
|
||||||
|
|
||||||
ProductInfo productInfo = new ProductInfo(EXPECTED_COST, EXPECTED_PRICE);
|
ProductInfo productInfo = new ProductInfo(EXPECTED_COST, EXPECTED_PRICE);
|
||||||
|
|
Loading…
Reference in New Issue