NonEmptyGeometryOperator implements GeometryOperator { @Override public Geometry apply(Geometry geometry, Context context) { return (geometry == null || geometry.isEmpty()) ? null : geometry; }  @Override Geometry apply(Geometry geometry, Context context);  }
@Test public void testEmptyGeometry() { Geometry geometry = mock(Geometry.class); when(geometry.isEmpty()).thenReturn(true); Geometry actual = nonEmptyGeometryOperator.apply(geometry, new GeometryOperator.Context()); assertThat(actual, is(nullValue())); }
@Test public void testNonEmptyGeometry() { Geometry geometry = mock(Geometry.class); when(geometry.isEmpty()).thenReturn(false); Geometry actual = nonEmptyGeometryOperator.apply(geometry, new GeometryOperator.Context()); assertThat(actual, is(geometry)); }