### Question:
StateRunner extends BaseSaltJobRunner { @Override public String submit(SaltConnector saltConnector) throws SaltJobFailedException { HostList targets = new HostList(getTargetHostnames()); return SaltStates.applyState(saltConnector, state, targets).getJid(); } StateRunner(Set<String> targetHostnames, Set<Node> allNode, String state); @Override String submit(SaltConnector saltConnector); @Override String toString(); String getState();  }### Answer:
@Test public void submit() throws Exception { targets = new HashSet<>(); targets.add("10-0-0-1.example.com"); allNode = new HashSet<>(); allNode.add(new Node("10.0.0.1", "5.5.5.1", "10-0-0-1.example.com", "hg")); allNode.add(new Node("10.0.0.2", "5.5.5.2", "10-0-0-2.example.com", "hg")); allNode.add(new Node("10.0.0.3", "5.5.5.3", "10-0-0-3.example.com", "hg")); StateRunner stateRunner = new StateRunner(targets, allNode, "example_state"); SaltConnector saltConnector = Mockito.mock(SaltConnector.class); PowerMockito.mockStatic(SaltStates.class); String jobId = "1"; ApplyResponse applyResponse = new ApplyResponse(); List<Map<String, JsonNode>> result = new ArrayList<>(); Map<String, JsonNode> nodes = new HashMap<>(); ObjectMapper objectMapper = new ObjectMapper(); nodes.put("jid", objectMapper.valueToTree(jobId)); result.add(nodes); applyResponse.setResult(result); PowerMockito.when(SaltStates.applyState(any(), any(), any())).thenReturn(applyResponse); String jid = stateRunner.submit(saltConnector); assertEquals(jobId, jid); PowerMockito.verifyStatic(SaltStates.class); ArgumentCaptor acHostList = ArgumentCaptor.forClass(HostList.class); SaltStates.applyState(eq(saltConnector), eq("example_state"), (Target<String>) acHostList.capture()); assertTrue(acHostList.getValue() instanceof HostList); HostList hostList = (HostList) acHostList.getValue(); assertEquals("10-0-0-1.example.com", hostList.getTarget()); }