InfoToolHelperLookup { public static InfoToolHelper getHelper(Layer layer) { loadProviders(); for (InfoToolHelper helper : cachedInstances) { try { if (helper.isSupportedLayer(layer)) { return helper.getClass().newInstance(); } } catch (Exception ex) { throw new RuntimeException(ex); } } return null; }  static InfoToolHelper getHelper(Layer layer);  }
@Test public void featureLayerHelper() throws Exception { Layer layer = TestDataUtils.getPolygonLayer(); InfoToolHelper helper = InfoToolHelperLookup.getHelper(layer); assertNotNull(helper); assertEquals(FeatureLayerHelper.class, helper.getClass()); }
@Test public void gridCoverageLayerHelper() throws Exception { float[][] data = { {1, 2, 3, 4}, {5, 6, 7, 8} }; ReferencedEnvelope env = new ReferencedEnvelope(0, 4, 0, 2, null); GridCoverageFactory gcf = CoverageFactoryFinder.getGridCoverageFactory(null); GridCoverage2D cov = gcf.create("coverage", data, env); Layer layer = new GridCoverageLayer(cov, null); InfoToolHelper helper = InfoToolHelperLookup.getHelper(layer); assertNotNull(helper); assertEquals(GridCoverageLayerHelper.class, helper.getClass()); }