Skip to content

Commit a45c395

Browse files
author
Cameron Mace
committed
fixed all checkstyle issues in geojson test
1 parent a2f71f2 commit a45c395

12 files changed

Lines changed: 124 additions & 129 deletions

services-geojson/src/test/java/com/mapbox/geojson/BoundingBoxTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,64 @@
11
package com.mapbox.geojson;
22

3-
import com.mapbox.services.TestUtils;
4-
5-
import org.junit.Test;
6-
73
import static org.junit.Assert.assertEquals;
84
import static org.junit.Assert.assertNotNull;
95
import static org.junit.Assert.assertTrue;
106

7+
import com.mapbox.services.TestUtils;
8+
import org.junit.Test;
9+
1110
public final class BoundingBoxTest extends TestUtils {
1211

1312
@Test
14-
public final void sanity() throws Exception {
13+
public void sanity() throws Exception {
1514
Point southwest = Point.fromLngLat(2.0, 2.0);
1615
Point northeast = Point.fromLngLat(4.0, 4.0);
1716
BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast);
1817
assertNotNull(boundingBox);
1918
}
2019

2120
@Test
22-
public final void southWest_doesReturnMostSouthwestCoordinate() throws Exception {
21+
public void southWest_doesReturnMostSouthwestCoordinate() throws Exception {
2322
Point southwest = Point.fromLngLat(1.0, 2.0);
2423
Point northeast = Point.fromLngLat(3.0, 4.0);
2524
BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast);
2625
assertTrue(southwest.equals(boundingBox.southwest()));
2726
}
2827

2928
@Test
30-
public final void northEast_doesReturnMostNortheastCoordinate() throws Exception {
29+
public void northEast_doesReturnMostNortheastCoordinate() throws Exception {
3130
Point southwest = Point.fromLngLat(1.0, 2.0);
3231
Point northeast = Point.fromLngLat(3.0, 4.0);
3332
BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast);
3433
assertTrue(northeast.equals(boundingBox.northeast()));
3534
}
3635

3736
@Test
38-
public final void west_doesReturnMostWestCoordinate() throws Exception {
37+
public void west_doesReturnMostWestCoordinate() throws Exception {
3938
Point southwest = Point.fromLngLat(1.0, 2.0);
4039
Point northeast = Point.fromLngLat(3.0, 4.0);
4140
BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast);
4241
assertEquals(1.0, boundingBox.west(), DELTA);
4342
}
4443

4544
@Test
46-
public final void south_doesReturnMostSouthCoordinate() throws Exception {
45+
public void south_doesReturnMostSouthCoordinate() throws Exception {
4746
Point southwest = Point.fromLngLat(1.0, 2.0);
4847
Point northeast = Point.fromLngLat(3.0, 4.0);
4948
BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast);
5049
assertEquals(2.0, boundingBox.south(), DELTA);
5150
}
5251

5352
@Test
54-
public final void east_doesReturnMostEastCoordinate() throws Exception {
53+
public void east_doesReturnMostEastCoordinate() throws Exception {
5554
Point southwest = Point.fromLngLat(1.0, 2.0);
5655
Point northeast = Point.fromLngLat(3.0, 4.0);
5756
BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast);
5857
assertEquals(3.0, boundingBox.east(), DELTA);
5958
}
6059

6160
@Test
62-
public final void north_doesReturnMostNorthCoordinate() throws Exception {
61+
public void north_doesReturnMostNorthCoordinate() throws Exception {
6362
Point southwest = Point.fromLngLat(1.0, 2.0);
6463
Point northeast = Point.fromLngLat(3.0, 4.0);
6564
BoundingBox boundingBox = BoundingBox.fromPoints(southwest, northeast);

services-geojson/src/test/java/com/mapbox/geojson/FeatureCollectionTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import static org.junit.Assert.assertNull;
66

77
import com.mapbox.services.TestUtils;
8-
98
import org.junit.Test;
109

1110
import java.io.IOException;

services-geojson/src/test/java/com/mapbox/geojson/FeatureTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package com.mapbox.geojson;
22

3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertNotNull;
5+
import static org.junit.Assert.assertNull;
6+
import static org.junit.Assert.assertTrue;
7+
38
import com.google.gson.JsonObject;
49
import com.mapbox.services.TestUtils;
5-
610
import org.junit.Test;
711

812
import java.io.IOException;
913
import java.util.ArrayList;
1014
import java.util.List;
1115

12-
import static org.junit.Assert.assertEquals;
13-
import static org.junit.Assert.assertNotNull;
14-
import static org.junit.Assert.assertNull;
15-
import static org.junit.Assert.assertTrue;
16-
1716
public class FeatureTest extends TestUtils {
1817

1918
private static final String SAMPLE_FEATURE = "sample-feature.json";
Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
11
package com.mapbox.geojson;
22

33
import com.mapbox.services.TestUtils;
4+
import org.junit.Test;
5+
6+
import java.io.IOException;
7+
import java.util.ArrayList;
8+
import java.util.List;
49

510
public class GeoJsonTest extends TestUtils {
611

712
private static final String GEOJSON_FIXTURE = "sample-geojson-result.json";
813

9-
// /**
10-
// * Test whether we are rounding correctly to conform to the RFC 7946 GeoJson spec.
11-
// *
12-
// * @throws IOException If fixture fails loading.
13-
// * @see <a href="https://tools.ietf.org/html/rfc7946#section-3.1.10">section 3.1.10</a>
14-
// */
15-
// @Test
16-
// public void testSevenDigitRounding() throws IOException {
17-
// Point roundDown = Point.fromLngLat(1.123456789, 1.123456789);
18-
// Point noRound = Point.fromLngLat(1.1234, 1.12345);
19-
// Point matchRound = Point.fromLngLat(1.1234567, 1.1234567);
20-
// Point roundLat = Point.fromLngLat(1.1234567, 1.12345678910);
21-
// Point roundLon = Point.fromLngLat(1.12345678910, 1.1234567);
22-
// Point largeRound = Point.fromLngLat(105.12345678910, 89.1234567);
23-
// Point negRound = Point.fromLngLat(-105.12345678910, -89.1234567);
24-
//
25-
// List<Feature> features = new ArrayList<>();
26-
// features.add(Feature.fromGeometry(roundDown));
27-
// features.add(Feature.fromGeometry(noRound));
28-
// features.add(Feature.fromGeometry(matchRound));
29-
// features.add(Feature.fromGeometry(roundLat));
30-
// features.add(Feature.fromGeometry(roundLon));
31-
// features.add(Feature.fromGeometry(largeRound));
32-
// features.add(Feature.fromGeometry(negRound));
33-
//
34-
// FeatureCollection featureCollection = FeatureCollection.fromFeatures(features);
35-
// compareJson(loadJsonFixture(GEOJSON_FIXTURE), featureCollection.toJson());
36-
// }
14+
/**
15+
* Test whether we are rounding correctly to conform to the RFC 7946 GeoJson spec.
16+
*
17+
* @throws IOException If fixture fails loading.
18+
* @see <a href="https://tools.ietf.org/html/rfc7946#section-3.1.10">section 3.1.10</a>
19+
*/
20+
@Test
21+
public void testSevenDigitRounding() throws IOException {
22+
Point roundDown = Point.fromLngLat(1.12345678, 1.12345678);
23+
Point noRound = Point.fromLngLat(1.1234, 1.12345);
24+
Point matchRound = Point.fromLngLat(1.1234567, 1.1234567);
25+
Point roundLat = Point.fromLngLat(1.1234567, 1.12345678);
26+
Point roundLon = Point.fromLngLat(1.12345678, 1.1234567);
27+
Point largeRound = Point.fromLngLat(105.12345678, 89.1234567);
28+
Point negRound = Point.fromLngLat(-105.12345678, -89.1234567);
29+
30+
List<Feature> features = new ArrayList<>();
31+
features.add(Feature.fromGeometry(roundDown));
32+
features.add(Feature.fromGeometry(noRound));
33+
features.add(Feature.fromGeometry(matchRound));
34+
features.add(Feature.fromGeometry(roundLat));
35+
features.add(Feature.fromGeometry(roundLon));
36+
features.add(Feature.fromGeometry(largeRound));
37+
features.add(Feature.fromGeometry(negRound));
38+
39+
FeatureCollection featureCollection = FeatureCollection.fromFeatures(features);
40+
compareJson(loadJsonFixture(GEOJSON_FIXTURE), featureCollection.toJson());
41+
}
3742
}

services-geojson/src/test/java/com/mapbox/geojson/GeometryCollectionTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
package com.mapbox.geojson;
22

3-
import com.mapbox.services.TestUtils;
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertNotNull;
5+
import static org.junit.Assert.assertNull;
46

7+
import com.mapbox.services.TestUtils;
58
import org.junit.Test;
69

710
import java.io.IOException;
811
import java.util.ArrayList;
912
import java.util.List;
1013

11-
import static org.junit.Assert.assertEquals;
12-
import static org.junit.Assert.assertNotNull;
13-
import static org.junit.Assert.assertNull;
14-
1514
public class GeometryCollectionTest extends TestUtils {
1615

1716
private static final String SAMPLE_GEOMETRYCOLLECTION = "sample-geometrycollection.json";
@@ -56,8 +55,8 @@ public void bbox_doesNotSerializeWhenNotPresent() throws Exception {
5655

5756
GeometryCollection geometryCollection = GeometryCollection.fromGeometries(geometries);
5857
compareJson(geometryCollection.toJson(),
59-
"{\"type\":\"GeometryCollection\",\"geometries\":["+ "{\"type\":\"Point\",\"coordinates\":[1.0,2.0]},"
60-
+ "{\"type\":\"LineString\",\"coordinates\":[[1,2],[2,3]]}]}");
58+
"{\"type\":\"GeometryCollection\",\"geometries\":[" + "{\"type\":\"Point\","
59+
+ "\"coordinates\":[1.0,2.0]},{\"type\":\"LineString\",\"coordinates\":[[1,2],[2,3]]}]}");
6160
}
6261

6362
@Test

services-geojson/src/test/java/com/mapbox/geojson/LineStringTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package com.mapbox.geojson;
22

3-
import com.mapbox.services.TestUtils;
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertFalse;
5+
import static org.junit.Assert.assertNotNull;
6+
import static org.junit.Assert.assertNull;
47

8+
import com.mapbox.services.TestUtils;
59
import org.junit.Test;
610

711
import java.io.IOException;
812
import java.util.ArrayList;
913
import java.util.List;
1014

11-
import static org.junit.Assert.assertEquals;
12-
import static org.junit.Assert.assertFalse;
13-
import static org.junit.Assert.assertNotNull;
14-
import static org.junit.Assert.assertNull;
15-
1615
public class LineStringTest extends TestUtils {
1716

1817
private static final String SAMPLE_LINESTRING_FIXTURE = "sample-linestring.json";
@@ -72,8 +71,8 @@ public void bbox_doesSerializeWhenPresent() throws Exception {
7271
BoundingBox bbox = BoundingBox.fromCoordinates(1.0, 2.0, 3.0, 4.0);
7372
LineString lineString = LineString.fromLngLats(points, bbox);
7473
compareJson(lineString.toJson(),
75-
"{\"coordinates\":[[1,1],[2,2],[3,3]]," +
76-
"\"type\":\"LineString\",\"bbox\":[1.0,2.0,3.0,4.0]}");
74+
"{\"coordinates\":[[1,1],[2,2],[3,3]],"
75+
+ "\"type\":\"LineString\",\"bbox\":[1.0,2.0,3.0,4.0]}");
7776
}
7877

7978
@Test

services-geojson/src/test/java/com/mapbox/geojson/MultiLineStringTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package com.mapbox.geojson;
22

3-
import com.mapbox.services.TestUtils;
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertFalse;
5+
import static org.junit.Assert.assertNotNull;
6+
import static org.junit.Assert.assertNull;
47

8+
import com.mapbox.services.TestUtils;
59
import org.junit.Test;
610

711
import java.io.IOException;
812
import java.util.ArrayList;
913
import java.util.List;
1014

11-
import static org.junit.Assert.assertEquals;
12-
import static org.junit.Assert.assertFalse;
13-
import static org.junit.Assert.assertNotNull;
14-
import static org.junit.Assert.assertNull;
15-
1615
public class MultiLineStringTest extends TestUtils {
1716

1817
private static final String SAMPLE_MULTILINESTRING = "sample-multilinestring.json";

services-geojson/src/test/java/com/mapbox/geojson/MultiPointTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package com.mapbox.geojson;
22

3-
import com.mapbox.services.TestUtils;
3+
import static junit.framework.Assert.assertFalse;
4+
import static org.junit.Assert.assertEquals;
5+
import static org.junit.Assert.assertNotNull;
6+
import static org.junit.Assert.assertNull;
47

8+
import com.mapbox.services.TestUtils;
59
import org.junit.Test;
610

711
import java.io.IOException;
812
import java.util.ArrayList;
913
import java.util.List;
1014

11-
import static junit.framework.Assert.assertFalse;
12-
import static org.junit.Assert.assertEquals;
13-
import static org.junit.Assert.assertNotNull;
14-
import static org.junit.Assert.assertNull;
15-
1615
public class MultiPointTest extends TestUtils {
1716

1817
private static final String SAMPLE_MULTIPOINT = "sample-multipoint.json";

services-geojson/src/test/java/com/mapbox/geojson/MultiPolygonTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package com.mapbox.geojson;
22

3-
import com.mapbox.services.TestUtils;
3+
import static junit.framework.Assert.assertFalse;
4+
import static org.junit.Assert.assertEquals;
5+
import static org.junit.Assert.assertNotNull;
6+
import static org.junit.Assert.assertNull;
47

8+
import com.mapbox.services.TestUtils;
59
import org.junit.Test;
610

711
import java.io.IOException;
812
import java.util.ArrayList;
913
import java.util.List;
1014

11-
import static junit.framework.Assert.assertFalse;
12-
import static org.junit.Assert.assertEquals;
13-
import static org.junit.Assert.assertNotNull;
14-
import static org.junit.Assert.assertNull;
15-
1615
public class MultiPolygonTest extends TestUtils {
1716
private static final String SAMPLE_MULTIPOLYGON = "sample-multipolygon.json";
1817

services-geojson/src/test/java/com/mapbox/geojson/PointTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package com.mapbox.geojson;
22

3-
import com.mapbox.services.TestUtils;
3+
import static junit.framework.Assert.assertTrue;
4+
import static org.junit.Assert.assertEquals;
5+
import static org.junit.Assert.assertFalse;
6+
import static org.junit.Assert.assertNotNull;
7+
import static org.junit.Assert.assertNull;
48

9+
import com.mapbox.services.TestUtils;
510
import org.junit.Test;
611

712
import java.io.IOException;
813
import java.util.ArrayList;
914
import java.util.List;
1015

11-
import static junit.framework.Assert.assertTrue;
12-
import static org.junit.Assert.assertEquals;
13-
import static org.junit.Assert.assertFalse;
14-
import static org.junit.Assert.assertNotNull;
15-
import static org.junit.Assert.assertNull;
16-
1716
public class PointTest extends TestUtils {
1817

1918
private static final String SAMPLE_POINT = "sample-point.json";
@@ -91,8 +90,8 @@ public void bbox_doesSerializeWhenPresent() throws Exception {
9190
BoundingBox bbox = BoundingBox.fromCoordinates(1.0, 2.0, 3.0, 4.0);
9291
LineString lineString = LineString.fromLngLats(points, bbox);
9392
compareJson(lineString.toJson(),
94-
"{\"coordinates\":[[1,1],[2,2],[3,3]]," +
95-
"\"type\":\"LineString\",\"bbox\":[1.0,2.0,3.0,4.0]}");
93+
"{\"coordinates\":[[1,1],[2,2],[3,3]],"
94+
+ "\"type\":\"LineString\",\"bbox\":[1.0,2.0,3.0,4.0]}");
9695
}
9796

9897
@Test

0 commit comments

Comments
 (0)