Skip to content

Instantly share code, notes, and snippets.

@thiagoolsilva
Created May 19, 2016 15:48
Show Gist options
  • Save thiagoolsilva/bb9fef23bb3b21a5be1e28cebd00dccf to your computer and use it in GitHub Desktop.
Save thiagoolsilva/bb9fef23bb3b21a5be1e28cebd00dccf to your computer and use it in GitHub Desktop.
public void test_update_content() {
//1.
//Insert the content and check if the test was successfully
final String fakeRg = "0000000";
Contact contact = new Contact(fakeRg);
contact.setAge(30);
contact.setEmail("thiagoolsilva@gmail.com");
contact.setName("Lopes");
//2
//Check if the row was inserted
boolean result = databaseController.insertContact(contact);
Assert.assertEquals(true, result);
//3
//Create a row to be updated
Contact rowUpdate = new Contact("");
rowUpdate.setName("Silva");
rowUpdate.setEmail("silva@fakeemail.com");
rowUpdate.setAge(20);
//4
//Update the content
boolean updateRow = databaseController.updateContactByRg(rowUpdate, fakeRg);
Assert.assertEquals(true, updateRow);
Contact queryContact = databaseController.getContactByRg(fakeRg);
//5
//Check the name
Assert.assertEquals(rowUpdate.getName(), queryContact.getName());
//6
//Check the Age
Assert.assertEquals(rowUpdate.getAge(), queryContact.getAge());
//7
//Check the Email
Assert.assertEquals(rowUpdate.getEmail(), queryContact.getEmail());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment