### Question:
CloudConfigResourceService implements EnvironmentAware { public String getLocalPath(String path) { String contents = retrieveFromConfigServer(path); return ConfigFileUtils.writeToTempFile(contents, getResourceName(path)); } CloudConfigResourceService();  CloudConfigResourceService(
      ResourceRepository resourceRepository, EnvironmentRepository environmentRepository); String getLocalPath(String path); @Override void setEnvironment(org.springframework.core.env.Environment environment); static boolean isCloudConfigResource(String path);  }### Answer:
@Test void getLocalPathWhenFileInConfigServer() { expectFileInConfigServer(); String fileName = resourceService.getLocalPath(CLOUD_TEST_FILE_NAME); assertThat(fileName).isEqualTo(TEST_FILE_PATH); }
@Test void getLocalPathWhenFileNotInConfigServer() { expectFileNotInConfigServer(); RuntimeException exception = assertThrows( RuntimeException.class, () -> resourceService.getLocalPath(CLOUD_TEST_FILE_NAME)); assertThat(exception.getMessage()).contains(CLOUD_TEST_FILE_NAME); }
@Test void getLocalPathWhenConfigServerNotConfigured() { resourceService = new CloudConfigResourceService(); RuntimeException exception = assertThrows( RuntimeException.class, () -> resourceService.getLocalPath(CLOUD_TEST_FILE_NAME)); assertThat(exception.getMessage()).contains(CLOUD_TEST_FILE_NAME); }