Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AndroidTestCase Example
package tw.com.dynasafe.cix.service;
import android.test.AndroidTestCase;
import android.util.Log;
import com.google.gson.JsonObject;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import tw.com.dynasafe.cix.CIX;
import tw.com.dynasafe.cix.Demo;
import tw.com.dynasafe.cix.object.Contact;
/**
* Created by edwardchiang on 16/03/2017.
*/
public class ContactsAPITest extends AndroidTestCase {
public void testLoad() throws InterruptedException {
final CountDownLatch signal = new CountDownLatch(1);
JsonObject params = new JsonObject();
params.addProperty("id", Demo.ID);
ContactsAPI api = new ContactsAPI(getContext());
api.load(params, new OKAPICall.LoadObjectsHandler<Contact>() {
@Override
public void callback(List<Contact> objectList, Exception e) {
assertNotNull(objectList);
assertTrue("Must have data", objectList.size() > 0);
Log.d(CIX.TAG, "Data result: " + objectList);
signal.countDown();
}
});
signal.await();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.