Skip to content

Instantly share code, notes, and snippets.

View thiagoolsilva's full-sized avatar
🏠
Working from home

thiago lopes silva thiagoolsilva

🏠
Working from home
View GitHub Profile
public class SimpleLog extends AndroidTestCase {
private static final String TAG = "test";
@Override
protected void setUp() throws Exception {
super.setUp();
Log.d(TAG, "setUp");
}
public class DatabaseControllerTest extends AndroidTestCase{
private DatabaseController databaseController;
@Override
protected void setUp() throws Exception {
super.setUp();
final String prefixContext = "test_";
RenamingDelegatingContext mockContext = new RenamingDelegatingContext(getContext(),prefixContext);
public void test_check_insert_object() {
final String fakeRg = "0000000";
Contact contact = new Contact(fakeRg);
contact.setAge(30);
contact.setEmail("thiagoolsilva@gmail.com");
contact.setName("Lopes");
boolean result = databaseController.insertContact(contact);
Assert.assertEquals(true, result);
public void test_check_fetch_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");
public void test_remove_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");
public void test_remove_invalid_content() {
final String invalidRg = "12345678";
//1
//Check if a invalid content was not deleted
boolean result = databaseController.deleteContactByRg(invalidRg);
Assert.assertEquals(false, result);
}
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");
public class FirstTest extends AndroidTestCase {
public void test_first_test_1() {
String firstObject = "Lopes";
//This step won´t fail because it is not null
Assert.assertNotNull(firstObject);
String secondObject = "Lopes";
//Check the content of object. This test won´t fail
//Check if the given object is not null
public void assertNotNull(Object object)
//Check if the given object is equals with actual value
public void assertEquals(Object expected, Object actual)
//Fail the current Test if any check was failed
public void fail(String message)
productFlavors {
production {
}
development {
}
}