Created
October 16, 2017 10:55
-
-
Save edwardinubuntu/49fd71b29e0ae2adc158ec2b3518ac56 to your computer and use it in GitHub Desktop.
AndroidTestCase Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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