SLDStore { public static String getSLD(final String wmsName) { if(wmsName == null) { return defaultSLD; } if(sldCache.containsKey(wmsName)) { return sldCache.get(wmsName); } try { final String resource = IOHelper.readString(SLDStore.class.getResourceAsStream(wmsName + ".sld")); if(resource == null || resource.isEmpty()) { return defaultSLD; } sldCache.put(wmsName, resource); return resource; } catch(Exception ex) { log.warn(ex, "Error loading SLD for wmsName:", wmsName); } return ""; }  static String getSLD(final String wmsName);  }
@Test public void testGetSLD() { assertNotSame("Expect 'gtk_wfs' to return some content", "", SLDStore.getSLD("gtk_wfs")); final String defaultSLD = SLDStore.getSLD("default"); assertEquals("Expect <null> to return default SLD", defaultSLD, SLDStore.getSLD(null)); assertEquals("Expect 'test dummy random stuff' to return default SLD", defaultSLD, SLDStore.getSLD("test dummy random stuff")); }