### Question:
FrameworkIDService { public Optional<String> fetch() { String frameworkId = regCenter.getDirectly(HANode.FRAMEWORK_ID_NODE); return Strings.isNullOrEmpty(frameworkId) ? Optional.<String>absent() : Optional.of(frameworkId); }  Optional<String> fetch(); void save(final String id);  }### Answer:
@Test public void assertFetch() throws Exception { when(registryCenter.getDirectly(HANode.FRAMEWORK_ID_NODE)).thenReturn("1"); Optional<String> frameworkIDOptional = frameworkIDService.fetch(); assertTrue(frameworkIDOptional.isPresent()); assertThat(frameworkIDOptional.get(), is("1")); verify(registryCenter).getDirectly(HANode.FRAMEWORK_ID_NODE); }