### Question:
FrameworkIDService { public void save(final String id) { if (!regCenter.isExisted(HANode.FRAMEWORK_ID_NODE)) { regCenter.persist(HANode.FRAMEWORK_ID_NODE, id); } }  Optional<String> fetch(); void save(final String id);  }### Answer:
@Test public void assertSave() throws Exception { when(registryCenter.isExisted(HANode.FRAMEWORK_ID_NODE)).thenReturn(false); frameworkIDService.save("1"); verify(registryCenter).isExisted(HANode.FRAMEWORK_ID_NODE); verify(registryCenter).persist(HANode.FRAMEWORK_ID_NODE, "1"); }
@Test public void assertSave() { when(registryCenter.isExisted(HANode.FRAMEWORK_ID_NODE)).thenReturn(false); frameworkIDService.save("1"); verify(registryCenter).isExisted(HANode.FRAMEWORK_ID_NODE); verify(registryCenter).persist(HANode.FRAMEWORK_ID_NODE, "1"); }