public static Matcher<Point> pointWithLonLatAlt(final double lon, final double lat, final double alt) { return pointThatHave(positionWithLonLatAlt(lon, lat, alt)); }
public static Matcher<Point> pointWithLonLat(final double lon, final double lat) { return pointThatHave(positionsWithLonLat(lon, lat)); }
@Test public void ofLonLatShouldReturnRightValues() { assertThat(Point.from(10, 20), is(pointWithLonLat(10, 20))); }
@Override protected boolean matchesSafely(Positions item) { return positionsWithLonLat(lon, lat).matches((item)); }
@Override protected boolean matchesSafely(Positions item) { return positionWithLonLatAlt(lon, lat, alt).matches(item); }
@Test public void readShouldReadSinglePositionWithAlt() throws Exception { Positions positions = toTest.fromJson("[12.5,45.8,56.8]", Positions.class); assertThat(positions, is(singlePositionsWithLonLatAlt(12.5, 45.8, 56.8))); assertThat(toTest.toJson(positions, Positions.class), is("[12.5,45.8,56.8]")); }
@Test public void readShouldReadSinglePosition() throws Exception { Positions positions = toTest.fromJson(givenSinglePositionJson(12.5, 45.8), Positions.class); assertThat(positions, is(singlePositionsWithLonLat(12.5, 45.8))); assertThat(toTest.toJson(positions, Positions.class), is("[12.5,45.8]")); }
@Test public void shouldHandleNullProperties() { String nullPropertiesJson = "{" + "\"type\": \"Feature\", " + "\"geometry\": " + JsonUtils.givenPointJson(10,10) + ", " + "\"properties\": null" + "}"; Feature parsed = toTest.fromJson(nullPropertiesJson, Feature.class); assertThat(parsed.properties(), emptyMap()); }
@Test public void withLatShouldReturnRightValues() { assertThat(Point.from(10, 20).withLat(25), is(pointWithLonLat(10, 25))); }
@Override public void describeTo(Description description) { description.appendText("Single positions with position: ").appendDescriptionOf(positionsWithLonLat(lon, lat)); } };
@Override public void describeTo(Description description) { description.appendText("Single positions with position: ").appendDescriptionOf(positionWithLonLatAlt(lon, lat, alt)); } };
@Test public void withLonShouldReturnRightValues() { assertThat(Point.from(10, 20).withLon(15), is(pointWithLonLat(15, 20))); }