Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
issue #46 updated update multiple test with missing id to check that …
Browse files Browse the repository at this point in the history
…it throws the exception correctly
  • Loading branch information
James Cullimore committed Mar 18, 2019
1 parent 364cf73 commit 7637cd7
Showing 1 changed file with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class SaveTest extends ServiceFunctionalTest {
@Test
public void testCreate() throws Exception {
DbConfigurationTest.setPropertiesIfNotInitialized("postgresql");
DbConfigurationTest.setPropertiesIfNotInitialized("mysql");
try (Connection connection = getSql2o().open()) {
String sql = "CREATE TABLE " + escapeTableName("country") + "(" +
"id integer NOT NULL," +
Expand All @@ -41,7 +41,7 @@ public void testCreate() throws Exception {

@Test
public void testUpdate() throws Exception {
DbConfigurationTest.setPropertiesIfNotInitialized("postgresql");
DbConfigurationTest.setPropertiesIfNotInitialized("mysql");
try (Connection connection = getSql2o().open()) {
String sql = "CREATE TABLE " + escapeTableName("country") + "(" +
"id integer NOT NULL," +
Expand Down Expand Up @@ -124,7 +124,7 @@ private void assertCountOfTestTable (int expected) throws Exception {

@Test
public void createMultipleTest() throws Exception {
DbConfigurationTest.setPropertiesIfNotInitialized("postgresql");
DbConfigurationTest.setPropertiesIfNotInitialized("mysql");

createTestTable();

Expand Down Expand Up @@ -156,7 +156,7 @@ public void updateMultipleTest() throws Exception {

@Test
public void updateAndCreateTest() throws Exception {
DbConfigurationTest.setPropertiesIfNotInitialized("postgresql");
DbConfigurationTest.setPropertiesIfNotInitialized("mysql");

createTestTable();

Expand All @@ -178,12 +178,22 @@ public void updateMultipleMissingId() throws Exception {

insertToTestTable(1,"first");

DefaultApiRequest.saveDataRequestAndAssertion("/data",
"suites/common/data/save/update/update-multiple-missing-request.json",
configurationParameters(),
"suites/common/data/save/update/update-multiple-missing-response.json",
dispatcher
);
try {
DefaultApiRequest.saveDataRequestAndAssertion("/data",
"suites/common/data/save/update/update-multiple-missing-request.json",
configurationParameters(),
"suites/common/data/save/update/update-multiple-missing-response.json",
dispatcher
);
} catch (Exception ex) {
if (ex.getCause() instanceof RecordNotFoundException) {
return;
}
ex.printStackTrace();
Assert.fail("Unexpected exception: " +ex);
throw ex;
}
Assert.fail("Expected RecordNotFoundException");
}

@After
Expand Down

0 comments on commit 7637cd7

Please sign in to comment.