### Question:
CloudJobConfigurationService { public Optional<CloudJobConfiguration> load(final String jobName) { return Optional.fromNullable(CloudJobConfigurationGsonFactory.fromJson(regCenter.get(CloudJobConfigurationNode.getRootNodePath(jobName)))); }  void add(final CloudJobConfiguration jobConfig); void update(final CloudJobConfiguration jobConfig); Collection<CloudJobConfiguration> loadAll(); Optional<CloudJobConfiguration> load(final String jobName); void remove(final String jobName);  }### Answer:
@Test public void assertLoadWithoutConfig() { Optional<CloudJobConfiguration> actual = configService.load("test_job"); Assert.assertFalse(actual.isPresent()); }
@Test public void assertLoadWithConfig() { Mockito.when(regCenter.get("/config/job/test_job")).thenReturn(CloudJsonConstants.getJobJson()); Optional<CloudJobConfiguration> actual = configService.load("test_job"); Assert.assertTrue(actual.isPresent()); Assert.assertThat(actual.get().getJobName(), Is.is("test_job")); }
@Test public void assertLoadWithSpringConfig() { Mockito.when(regCenter.get("/config/job/test_spring_job")).thenReturn(CloudJsonConstants.getSpringJobJson()); Optional<CloudJobConfiguration> actual = configService.load("test_spring_job"); Assert.assertTrue(actual.isPresent()); Assert.assertThat(actual.get().getBeanName(), Is.is("springSimpleJob")); Assert.assertThat(actual.get().getApplicationContext(), Is.is("applicationContext.xml")); }