Created
May 23, 2018 07:22
-
-
Save tamboer/bf9f41f601a8fa41ed46823728c34c94 to your computer and use it in GitHub Desktop.
Test with sql queries.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@Sql(scripts = {"/create_devices.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) | |
@Sql(scripts = {"/remove_devices.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) | |
public void create_shouldFailWhenTheSameDeviceIsAddedASecondTime() throws Exception { | |
final ResultActions secondResultActions = mockMvc.perform(post("/devices") | |
.contentType(APPLICATION_JSON) | |
.content(objectMapper.writeValueAsString(bulkDeviceUploadRequestWithDeviceThatWeAlreadyKnow()))) | |
.andExpect(status().isOk()); | |
expectSingleError(secondResultActions, DEVICE_INTERNAL_ID_DUPLICATE, new Error("DEVICE.UPLOAD.ERROR.DEVICE_EXISTS", "Device already known in the system.")); | |
verifyZeroInteractions(eventPublisher); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment