### Question:
PillarSave implements OrchestratorBootstrap { private Map<String, Object> discovery(String hostname, String publicAddress, String instanceId, String instanceType) { Map<String, Object> map = new HashMap<>(); map.put("fqdn", hostname); map.put("hostname", hostname.split("\\.")[0]); map.put("domain", hostname.replaceFirst(hostname.split("\\.")[0] + '.', "")); map.put("custom_domain", true); map.put("public_address", StringUtils.isEmpty(publicAddress) ? Boolean.FALSE : Boolean.TRUE); map.put("instance_id", instanceId); map.put("instance_type", instanceType); return map; } PillarSave(SaltConnector sc, Set<String> targets, Collection<Node> hosts);  PillarSave(SaltConnector sc, Set<String> targets, Map<String, List<RecipeModel>> recipes, Long recipeExecutionTimeout);  PillarSave(SaltConnector sc, Set<String> targets, SaltPillarProperties pillarProperties); @Override Boolean call();  }### Answer:
@Test public void testDiscovery() throws Exception { SaltConnector saltConnector = mock(SaltConnector.class); GenericResponses responses = new GenericResponses(); GenericResponse response = new GenericResponse(); response.setStatusCode(HttpStatus.OK.value()); response.setAddress("10.0.0.2"); responses.setResponses(Collections.singletonList(response)); when(saltConnector.pillar(any(), any(Pillar.class))).thenReturn(responses); Set<Node> nodes = new HashSet<>(); nodes.add(new Node("10.0.0.1", "1.1.1.1", "i-1234", "m5.xlarge", "10-0-0-1.example.com", "hg")); nodes.add(new Node("10.0.0.2", "1.1.1.2", "i-1234", "m5.xlarge", "10-0-0-2.example.com", "hg")); nodes.add(new Node("10.0.0.3", "1.1.1.3", "i-1234", "m5.xlarge", "10-0-0-3.example.com", "hg")); PillarSave pillarSave = new PillarSave(saltConnector, Sets.newHashSet("10.0.0.1"), nodes); pillarSave.call(); ArgumentCaptor<Pillar> pillarCaptor = ArgumentCaptor.forClass(Pillar.class); ArgumentCaptor<Set<String>> targetCaptor = ArgumentCaptor.forClass(Set.class); verify(saltConnector).pillar(targetCaptor.capture(), pillarCaptor.capture()); Pillar pillar = pillarCaptor.getValue(); Map<String, Map<String, Map<String, Object>>> pillarJson = (Map<String, Map<String, Map<String, Object>>>) pillar.getJson(); Map<String, Map<String, Object>> hostMap = pillarJson.entrySet().iterator().next().getValue(); for (Node node : nodes) { Assert.assertEquals(node.getHostname(), hostMap.get(node.getPrivateIp()).get("fqdn")); Assert.assertEquals(node.getHostname().split("\\.")[0], hostMap.get(node.getPrivateIp()).get("hostname")); Assert.assertEquals(Boolean.TRUE, hostMap.get(node.getPrivateIp()).get("public_address")); } }