HttpClientStrategy { public CommandTransporterStrategy get() { CommandTransporterStrategy strategy; Layer defaultLayer = kermossProperties.getTransport().getDefaultLayer(); if (Layer.HTTP.equals(defaultLayer)) { strategy = new RestCommandTransporterStrategy(restTemplate, kermossProperties); } else { strategy = new FeignCommandTransporterStrategy(client, kermossProperties, FeignCommandTransporterStrategy::defaultClientFactory); } return strategy; } HttpClientStrategy(KermossProperties kermossProperties, RestTemplate restTemplate, Client client); CommandTransporterStrategy get();  }
@Test public void testGetMethodFactory() { Transport transport = new Transport(); transport.setDefaultLayer(Layer.HTTP); when(kermossProperties.getTransport()).thenReturn(transport); assertThat(httpClientStrategyUnderTest.get()).isInstanceOf(RestCommandTransporterStrategy.class); }
@Test public void testGetMethodFactoryShouldReturnFeign() { Transport transport = new Transport(); transport.setDefaultLayer(Layer.FEIGN); when(kermossProperties.getTransport()).thenReturn(transport); assertThat(httpClientStrategyUnderTest.get()).isInstanceOf(FeignCommandTransporterStrategy.class); }