### Question:
App { protected List<String> findPluginNamess(JsonNode design){ List<String> plugins = new ArrayList<String>(); try { for (JsonNode plugin : design.get("advanced").get("plugins")) { plugins.add(plugin.getTextValue()); } } catch (Exception e) {} try { String appClass = design.get("advanced").get("appClass").getTextValue(); plugins.add(appClass); } catch(Exception e) { } return plugins; } App(String appName, String src_host, String src_db, int src_port, String src_username); void setLocalCouchManager(LocalCouch localCouchManager); void start(); String getSrcReplicationUrl(boolean includeUserDetails); CouchDbConnector getSrcConnector(); static void main(String[] args); static String[] parseUsernamePass(String arg);  }### Answer:
@Test public void testFindPluginNames() throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode design = mapper.readTree("{ \"advanced\" : { \"plugins\" : [ \"com.test.Alpha\" ] } }"); App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); List<String> results = app2.findPluginNamess(design); assertEquals(1, results.size()); assertEquals("com.test.Alpha", results.get(0)); }
@Test public void testFindPluginNamesEmpty() throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode design = mapper.readTree("{ \"advanced\" : { \"plugins\" : [ ] } }"); App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); List<String> results = app2.findPluginNamess(design); assertEquals(0, results.size()); }
@Test public void testFindPluginNamesNothing() throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode design = mapper.readTree("{ \"advanced\" : { } }"); App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); List<String> results = app2.findPluginNamess(design); assertEquals(0, results.size()); }
@Test public void testFindPluginNamesNoAdvanced() throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode design = mapper.readTree("{ \"pizza\" : { } }"); App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null); List<String> results = app2.findPluginNamess(design); assertEquals(0, results.size()); }