@Test public void nothing_set_results_simply_in_valid_json_but_without_any_text_targets_and_field_as_null() throws Exception{ String result = builderToTest.build(); JSONObject asJson = new JSONObject(result); assertEquals("null", asJson.getString("uuid")); JSONObject settings = asJson.getJSONObject("settings"); assertEquals("null", settings.get("name")); assertEquals("", settings.getString("text_targets")); assertEquals("null", settings.get("description")); }
public String build() { String targets = buildTargetsCommaSeparated(); StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append(" \"uuid\":\"").append(uuid).append("\","); sb.append(" \"settings\":{\n"); sb.append(" \"name\":\"").append(name).append("\",\n"); sb.append(" \"description\":\"").append(description).append("\",\n"); sb.append(" \"text_targets\":\"").append(targets).append("\"\n"); sb.append(" }\n"); sb.append("}"); return sb.toString(); }
NessusAdapterV1NewScanJSONBuilder { public String build() { String targets = buildTargetsCommaSeparated(); StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append(" \"uuid\":\"").append(uuid).append("\","); sb.append(" \"settings\":{\n"); sb.append(" \"name\":\"").append(name).append("\",\n"); sb.append(" \"description\":\"").append(description).append("\",\n"); sb.append(" \"text_targets\":\"").append(targets).append("\"\n"); sb.append(" }\n"); sb.append("}"); return sb.toString(); } }
NessusAdapterV1NewScanJSONBuilder { public String build() { String targets = buildTargetsCommaSeparated(); StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append(" \"uuid\":\"").append(uuid).append("\","); sb.append(" \"settings\":{\n"); sb.append(" \"name\":\"").append(name).append("\",\n"); sb.append(" \"description\":\"").append(description).append("\",\n"); sb.append(" \"text_targets\":\"").append(targets).append("\"\n"); sb.append(" }\n"); sb.append("}"); return sb.toString(); }  }
NessusAdapterV1NewScanJSONBuilder { public String build() { String targets = buildTargetsCommaSeparated(); StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append(" \"uuid\":\"").append(uuid).append("\","); sb.append(" \"settings\":{\n"); sb.append(" \"name\":\"").append(name).append("\",\n"); sb.append(" \"description\":\"").append(description).append("\",\n"); sb.append(" \"text_targets\":\"").append(targets).append("\"\n"); sb.append(" }\n"); sb.append("}"); return sb.toString(); }  NessusAdapterV1NewScanJSONBuilder uuid(String uuid); NessusAdapterV1NewScanJSONBuilder name(String name); NessusAdapterV1NewScanJSONBuilder description(String description); NessusAdapterV1NewScanJSONBuilder targetsURIs(Set<URI> targetURIs); NessusAdapterV1NewScanJSONBuilder targetIPs(Set<InetAddress> targetIPs); String build(); }
NessusAdapterV1NewScanJSONBuilder { public String build() { String targets = buildTargetsCommaSeparated(); StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append(" \"uuid\":\"").append(uuid).append("\","); sb.append(" \"settings\":{\n"); sb.append(" \"name\":\"").append(name).append("\",\n"); sb.append(" \"description\":\"").append(description).append("\",\n"); sb.append(" \"text_targets\":\"").append(targets).append("\"\n"); sb.append(" }\n"); sb.append("}"); return sb.toString(); }  NessusAdapterV1NewScanJSONBuilder uuid(String uuid); NessusAdapterV1NewScanJSONBuilder name(String name); NessusAdapterV1NewScanJSONBuilder description(String description); NessusAdapterV1NewScanJSONBuilder targetsURIs(Set<URI> targetURIs); NessusAdapterV1NewScanJSONBuilder targetIPs(Set<InetAddress> targetIPs); String build();  }