@@ -0,0 +1,3009 @@
+package edu.berkeley.eecs.cfc_tracker.test;%0A%0Aimport android.content.Context;%0Aimport android.location.Location;%0Aimport android.test.AndroidTestCase;%0Aimport android.test.RenamingDelegatingContext;%0A%0Aimport com.google.android.gms.location.DetectedActivity;%0Aimport com.google.gson.Gson;%0Aimport com.google.gson.GsonBuilder;%0A%0Aimport org.json.JSONObject;%0A%0A/**%0A * Created by shankari on 6/28/15.%0A */%0Apublic class WrapperTest extends AndroidTestCase %7B%0A    private Context testCtxt;%0A%0A    // We want to store a long-term log for%0A    public WrapperTest() %7B%0A        super();%0A    %7D%0A%0A    protected void setUp() throws Exception %7B%0A%09%09/*%0A%09%09 * Don't need to populate with test data here, can do that in the test cases.%0A%09%09 */%0A        super.setUp();%0A        RenamingDelegatingContext context =%0A                new RenamingDelegatingContext(getContext(), %22test_%22);%0A        testCtxt = context;%0A    %7D%0A%0A    protected void tearDown() throws Exception %7B%0A        super.tearDown();%0A    %7D%0A%0A    public void testLocationSerDeser() throws Exception %7B%0A        Location testLoc = new Location(%22TEST%22);%0A        testLoc.setAccuracy(25.25f);%0A        testLoc.setAltitude(26.26);%0A        testLoc.setBearing(27);%0A        testLoc.setElapsedRealtimeNanos(28l);%0A        testLoc.setLatitude(29.29);%0A        testLoc.setLongitude(30.30);%0A        testLoc.setSpeed(31.31f);%0A        testLoc.setTime(32l);%0A        Gson gson = new GsonBuilder().setPrettyPrinting().create();%0A        String locJson = gson.toJson(testLoc);%0A        System.out.println(%22Serialized JSON = %22 + locJson);%0A        JSONObject parsedJSON = new JSONObject(locJson);%0A        assertEquals(parsedJSON.getDouble(%22mAccuracy%22), 25.25);%0A        assertEquals(parsedJSON.getLong(%22mElapsedRealtimeNanos%22), 28);%0A        assertEquals(parsedJSON.getDouble(%22mLatitude%22), 29.29);%0A        assertEquals(parsedJSON.getDouble(%22mLongitude%22), 30.30);%0A    %7D%0A%0A    public void testDetectedActivitySerDeser() throws Exception %7B%0A        DetectedActivity testDetectedBicycle = new DetectedActivity(DetectedActivity.ON_BICYCLE, 80);%0A        DetectedActivity testDetectedWalking = new DetectedActivity(DetectedActivity.WALKING, 90);%0A        DetectedActivity testDetectedInVehicle = new DetectedActivity(DetectedActivity.IN_VEHICLE, 70);%0A%0A        Gson gson = new GsonBuilder().setPrettyPrinting().create();%0A%0A        String bicycleJson = gson.toJson(testDetectedBicycle);%0A        System.out.println(%22Serialized JSON for bicycle = %22 + gson.toJson(testDetectedBicycle));%0A        System.out.println(%22Serialized JSON for walking = %22 + gson.toJson(testDetectedWalking));%0A        System.out.println(%22Serialized JSON for vehicle = %22 + gson.toJson(testDetectedInVehicle));%0A        JSONObject parsedJSON = new JSONObject(bicycleJson);%0A        /*%0A        assertEquals(parsedJSON.getDouble(%22mAccuracy%22), 25.25);%0A        assertEquals(parsedJSON.getLong(%22mElapsedRealtimeNanos%22), 28);%0A        assertEquals(parsedJSON.getDouble(%22mLatitude%22), 29.29);%0A        assertEquals(parsedJSON.getDouble(%22mLongitude%22), 30.30);%0A        */%0A    %7D%0A%7D%0A

Add a new unit test which tests the serialization/deserialization of classes using gson