StubConfigurationSaver { public void saveAllStubConfigurations(final Map<String, StubDescriptor> descriptors) throws JsonTransformationException { getCacheFolderPath(); int index = 1; for (String groupname : descriptors.keySet()) { StubDescriptor actualDescriptor = descriptors.get(groupname); tryToSaveActualStubConfig(actualDescriptor, index, groupname); index++; } }  void saveAllStubConfigurations(final Map<String, StubDescriptor> descriptors);  }
@Test public void testSaveAllStubConfigurations() throws TransformerException, JsonTransformationException { given(stubResourceHolder.getActualStubConfigJsonObject(TEST_KEY)).willReturn(jsonObject); underTest.saveAllStubConfigurations(descriptors); verify(stubResourceHolder).getActualStubConfigJsonObject(TEST_KEY); verify(documentTransformer).transformToFile(jsonObject, TEST_PATH + "/" + 1 + STUB_CONFIG_JSON_POSTFIX, true); }
@Test(expectedExceptions = JsonTransformationException.class) public void testSaveAllStubConfigurationsWhenOccurAnDocumentTransformationException() throws JsonTransformationException, TransformerException { doThrow(new TransformerException("Test")).when(documentTransformer).transformToFile(jsonObject, TEST_PATH + "/" + 1 + STUB_CONFIG_JSON_POSTFIX, true); given(stubResourceHolder.getActualStubConfigJsonObject(TEST_KEY)).willReturn(jsonObject); underTest.saveAllStubConfigurations(descriptors); verify(stubResourceHolder).getActualStubConfigJsonObject(TEST_KEY); }