|
@@ -1,19 +1,35 @@
|
|
|
package com.example.yiupang.freefoodfinder;
|
|
package com.example.yiupang.freefoodfinder;
|
|
|
|
|
|
|
|
|
|
+import android.widget.ListView;
|
|
|
|
|
+
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertEquals;
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Created by yiupang on 6/1/2017.
|
|
* Created by yiupang on 6/1/2017.
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
-class TestHttpRequest
|
|
|
|
|
|
|
+public class TestHttpRequest
|
|
|
{
|
|
{
|
|
|
@Test
|
|
@Test
|
|
|
- public void testParingDataString()
|
|
|
|
|
|
|
+ public void testGetCall()
|
|
|
{
|
|
{
|
|
|
|
|
+ final String expected = "200";
|
|
|
|
|
|
|
|
|
|
+ HttpCall httpCall = new HttpCall();
|
|
|
|
|
+ httpCall.setMethodType(HttpCall.GET);
|
|
|
|
|
+ httpCall.setUrl("http://free-food-finder.herokuapp.com/events");
|
|
|
|
|
+ new HttpRequest(){
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onResponse(Object response, int code)
|
|
|
|
|
+ {
|
|
|
|
|
+ super.onResponse(response, code);
|
|
|
|
|
+ assertEquals(expected, Integer.toString(code));
|
|
|
|
|
+ }
|
|
|
|
|
+ }.execute(httpCall);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|