Created
April 25, 2016 19:41
-
-
Save wviana/b670dfd7abc43b4a60285d7d2cfd47c3 to your computer and use it in GitHub Desktop.
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
import com.cocoahero.android.geojson.FeatureCollection; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import org.junit.Before; | |
import org.junit.BeforeClass; | |
import org.junit.Test; | |
import org.mockito.internal.util.io.IOUtil; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.io.UnsupportedEncodingException; | |
import static org.junit.Assert.*; | |
import neocom.dealerbook.models.layer.dataAdapter.GeojsonLatLngDataAdapter; | |
import neocom.dealerbook.models.layer.exceptions.InvalidInputDataException; | |
/** | |
* Created by wviana on 25/04/16. | |
*/ | |
public class GeojsonWeightedDataAdapterTest { | |
private static String data; | |
private static final String fileName = "dnc_feature_collection.json"; | |
private GeojsonLatLngDataAdapter dataAdapter; | |
private FeatureCollection featureCollection; | |
@Before | |
public void before() throws JSONException, InvalidInputDataException { | |
featureCollection = new FeatureCollection(new JSONObject()); | |
dataAdapter = new GeojsonLatLngDataAdapter(featureCollection); | |
} | |
@BeforeClass | |
public static void populateData() throws IOException { | |
FileReader reader = new FileReader(fileName); | |
BufferedReader br = new BufferedReader(reader); | |
StringBuilder sb = new StringBuilder(); | |
String line = br.readLine(); | |
while (line != null){ | |
sb.append(line); | |
} | |
data = sb.toString(); | |
} | |
@Test | |
public void test_sizes() { | |
assertEquals(dataAdapter.getSize(), featureCollection.getFeatures().size()); | |
assertEquals(dataAdapter.getSize(), dataAdapter.getList().size()); | |
assertEquals(featureCollection.getFeatures().size(), dataAdapter.getList().size()); | |
} | |
@Test | |
public void test_getData() { | |
assertEquals(featureCollection, dataAdapter.getData()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment