ScmSourceProviderImpl implements ScmSourceProvider { @Override public Optional<Map<String, String>> apply(final EC2InstanceContext context) { return context.getSource().flatMap(cache::getUnchecked); } ScmSourceProviderImpl(final Function<String, PieroneOperations> pieroneOperationsProvider); @Override Optional<Map<String, String>> apply(final EC2InstanceContext context);  }
@Test public void testScmSourceNotFound() { when(ec2InstanceContextMock.getSource()).thenReturn(Optional.of("opensource.example.org/team/artifact:tag")); final Optional<Map<String, String>> result = scmSourceProvider.apply(ec2InstanceContextMock); assertThat(result).isEmpty(); verify(ec2InstanceContextMock).getSource(); }
@Test public void testScmSource() { when(ec2InstanceContextMock.getSource()).thenReturn(Optional.of("pierone.example.org/team/artifact:tag")); final Optional<Map<String, String>> result = scmSourceProvider.apply(ec2InstanceContextMock); assertThat(result).isPresent(); verify(ec2InstanceContextMock).getSource(); }