LonLatMultiLevelSource extends GenericMultiLevelSource { public static MultiLevelSource create(MultiLevelSource lonSource, MultiLevelSource latSource, LonLatFunction function, int targetDataType) { Assert.argument(lonSource != null, "lonSource != null"); Assert.argument(latSource != null, "latSource != null"); Assert.argument(function != null, "function != null"); Rectangle2D lonModelBounds = lonSource.getModel().getModelBounds(); Rectangle2D latModelBounds = latSource.getModel().getModelBounds(); Assert.argument(Objects.equals(lonModelBounds, latModelBounds), "Model bounds of lat and lon source must be equal"); return new LonLatMultiLevelSource(lonSource, latSource, function, targetDataType); } private  LonLatMultiLevelSource(MultiLevelSource lonSource, MultiLevelSource latSource, LonLatFunction function,
                                   int targetDataType); static MultiLevelSource create(MultiLevelSource lonSource, MultiLevelSource latSource,
                                          LonLatFunction function, int targetDataType);  }
@Test public void testCreate_WithNullSources() { final MultiLevelSource lonSource = new TestMultiLevelSource(10, 10); final MultiLevelSource latSource = new TestMultiLevelSource(10, 10); final LonLatFunction function = new TestLonLatFunction(); try { LonLatMultiLevelSource.create(null, latSource, function, DataBuffer.TYPE_DOUBLE); fail(); } catch (IllegalArgumentException ignored) { } try { LonLatMultiLevelSource.create(lonSource, null, function, DataBuffer.TYPE_DOUBLE); fail(); } catch (IllegalArgumentException ignored) { } }
@Test public void testCreate_WithNullFunction() { final MultiLevelSource lonSource = new TestMultiLevelSource(10, 10); final MultiLevelSource latSource = new TestMultiLevelSource(10, 10); final LonLatFunction function = null; try { LonLatMultiLevelSource.create(lonSource, latSource, function, DataBuffer.TYPE_DOUBLE); fail(); } catch (IllegalArgumentException ignored) { } }
@Test public void testCreate_WithIncompatibleSources() { final MultiLevelSource lonSource = new TestMultiLevelSource(10, 10); final MultiLevelSource latSource = new TestMultiLevelSource(11, 11); final LonLatFunction function = new TestLonLatFunction(); try { LonLatMultiLevelSource.create(lonSource, latSource, function, DataBuffer.TYPE_BYTE); fail(); } catch (IllegalArgumentException ignored) { } }
@Test public void testCreate() { final MultiLevelSource lonSource = new TestMultiLevelSource(10, 10); final MultiLevelSource latSource = new TestMultiLevelSource(10, 10); final LonLatFunction function = new TestLonLatFunction(); assertNotNull(LonLatMultiLevelSource.create(lonSource, latSource, function, DataBuffer.TYPE_DOUBLE)); assertNotNull(LonLatMultiLevelSource.create(lonSource, latSource, function, DataBuffer.TYPE_FLOAT)); }