### Question:
RestfulEnclaveClientFactory implements EnclaveClientFactory<RestfulEnclaveClient> { @Override public RestfulEnclaveClient create(Config config) { LOGGER.debug("Creating RestfulEnclaveClient with {}",config); Optional<ServerConfig> enclaveServerConfig = config.getServerConfigs().stream() .filter(sc -> sc.getApp() == AppType.ENCLAVE) .filter(sc -> sc.getCommunicationType() == CommunicationType.REST) .findAny(); final ClientFactory clientFactory = new ClientFactory(); LOGGER.debug("Creating server context from config"); ServerConfig serverConfig = enclaveServerConfig.get(); LOGGER.debug("Created server context from config"); Client client = clientFactory.buildFrom(serverConfig); LOGGER.info("Creating remoted enclave for {}", serverConfig.getServerUri()); return new RestfulEnclaveClient(client, serverConfig.getServerUri()); }  @Override RestfulEnclaveClient create(Config config);  }### Answer:
@Test public void create() { final Config config = new Config(); final ServerConfig serverConfig = new ServerConfig(); serverConfig.setApp(AppType.ENCLAVE); serverConfig.setCommunicationType(CommunicationType.REST); serverConfig.setServerAddress("http: List<ServerConfig> serverConfigs = Arrays.asList(serverConfig); config.setServerConfigs(serverConfigs); EnclaveClient result = restfulEnclaveClientFactory.create(config); assertThat(result).isNotNull(); }
@Test(expected = java.util.NoSuchElementException.class) public void createWithNoCommunicationTypeDefined() { final Config config = new Config(); final ServerConfig serverConfig = new ServerConfig(); serverConfig.setApp(AppType.ENCLAVE); serverConfig.setServerAddress("http: List<ServerConfig> serverConfigs = Arrays.asList(serverConfig); config.setServerConfigs(serverConfigs); restfulEnclaveClientFactory.create(config); }
@Test(expected = java.util.NoSuchElementException.class) public void createWithNoAppTypeDefined() { final Config config = new Config(); final ServerConfig serverConfig = new ServerConfig(); serverConfig.setCommunicationType(CommunicationType.REST); serverConfig.setServerAddress("http: List<ServerConfig> serverConfigs = Arrays.asList(serverConfig); config.setServerConfigs(serverConfigs); restfulEnclaveClientFactory.create(config); }