### Question:
NessusAdapterV1 extends AbstractAdapter<NessusAdapterContext, NessusAdapterConfig> implements NessusAdapter { String resolvePolicyUIDByTitle(String content, String searchedPolicyTitle, NessusAdapterContext context) throws AdapterException { try { ArrayNode templatesArray = context.json().fetch("templates", content).asArray(); for (Iterator<JsonNode> elements = templatesArray.elements(); elements.hasNext();) { JsonNode node = elements.next(); String title = context.json().fetch("title", node).asText(); if (searchedPolicyTitle.equals(title)) { return context.json().fetch("uuid", node).asText(); } } return null; } catch (Exception e) { throw asAdapterException("Was not able to resolve policy uid", e, context); } }  @Override String execute(NessusAdapterConfig config,AdapterRuntimeContext runtimeContext); @Override int getAdapterVersion();  }### Answer:
@Test public void resolvePolicyUIDByTitle_null_throws_adapterexception() throws Exception { expected.expect(AdapterException.class); adapterToTest.resolvePolicyUIDByTitle(null, "x",context); }
@Test public void resolvePolicyUIDByTitle_empty_throws_adapterexception() throws Exception { expected.expect(AdapterException.class); adapterToTest.resolvePolicyUIDByTitle("", "x",context); }
@Test public void resolvePolicyUIDByTitle_empty_obj_throws_adapterexception() throws Exception { expected.expect(AdapterException.class); adapterToTest.resolvePolicyUIDByTitle("{}", "x",context); }
@Test public void resolvePolicyUIDByTitle_origin_nessus_file_with_advanced_scan_title_returns_uuid() throws Exception { String uuid = adapterToTest.resolvePolicyUIDByTitle(NESSUS_7_0_2_GET_POLICIES_RESULT_JSON, "Advanced Scan",context); assertEquals("ad629e16-03b6-8c1d-cef6-ef8c9dd3c658d24bd260ef5f9e66",uuid); }
@Test public void resolvePolicyUIDByTitle_origin_nessus_file_with_not_existing_title_returns_null() throws Exception { String uuid = adapterToTest.resolvePolicyUIDByTitle(NESSUS_7_0_2_GET_POLICIES_RESULT_JSON, "Not existing title",context); assertNull(uuid); }