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
/**
* Get message from web server
*
* @return The message received
*/
@WorkerThread
public String GetMessageFromWebServer(@NonNull Context context) {
...
try {
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="id_message_request">57806d2e1000003c1f62fd31</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="id_message_request">57806d521000002b1f62fd33</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="id_message_request">57806d2e1000003c1f62fd31</string>
</resources>
productFlavors {
production {
}
development {
}
}
//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)
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
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("[email protected]");
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_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("[email protected]");
contact.setName("Lopes");