### Question:
MesosStateService { public Collection<ExecutorStateInfo> executors(final String appName) throws JSONException { return Collections2.transform(findExecutors(fetch(stateUrl).getJSONArray("frameworks"), appName), new Function<JSONObject, ExecutorStateInfo>() { @Override public ExecutorStateInfo apply(final JSONObject input) { try { return ExecutorStateInfo.builder().id(getExecutorId(input)).slaveId(input.getString("slave_id")).build(); } catch (final JSONException ex) { throw new RuntimeException(ex); } } }); } MesosStateService(final CoordinatorRegistryCenter regCenter); static synchronized void register(final String hostName, final int port); static synchronized void deregister(); JsonArray sandbox(final String appName); Collection<ExecutorStateInfo> executors(final String appName); Collection<ExecutorStateInfo> executors();  }### Answer:
@Test public void assertExecutors() throws Exception { Mockito.when(registryCenter.getDirectly(HANode.FRAMEWORK_ID_NODE)).thenReturn("d8701508-41b7-471e-9b32-61cf824a660d-0000"); MesosStateService service = new MesosStateService(registryCenter); Collection<MesosStateService.ExecutorStateInfo> executorStateInfo = service.executors("foo_app"); Assert.assertThat(executorStateInfo.size(), Is.is(1)); MesosStateService.ExecutorStateInfo executor = executorStateInfo.iterator().next(); Assert.assertThat(executor.getId(), Is.is("foo_app@-@d8701508-41b7-471e-9b32-61cf824a660d-S0")); Assert.assertThat(executor.getSlaveId(), Is.is("d8701508-41b7-471e-9b32-61cf824a660d-S0")); }
@Test public void assertAllExecutors() throws Exception { Mockito.when(registryCenter.getDirectly(HANode.FRAMEWORK_ID_NODE)).thenReturn("d8701508-41b7-471e-9b32-61cf824a660d-0000"); MesosStateService service = new MesosStateService(registryCenter); Collection<MesosStateService.ExecutorStateInfo> executorStateInfo = service.executors(); Assert.assertThat(executorStateInfo.size(), Is.is(1)); MesosStateService.ExecutorStateInfo executor = executorStateInfo.iterator().next(); Assert.assertThat(executor.getId(), Is.is("foo_app@-@d8701508-41b7-471e-9b32-61cf824a660d-S0")); Assert.assertThat(executor.getSlaveId(), Is.is("d8701508-41b7-471e-9b32-61cf824a660d-S0")); }