HoverflyExtensionUtils { static io.specto.hoverfly.junit.core.HoverflyConfig getHoverflyConfigs(HoverflyConfig config) { if (config != null) { io.specto.hoverfly.junit.core.HoverflyConfig configs; if (!config.remoteHost().isEmpty()) { configs = remoteConfigs().host(config.remoteHost()); } else { configs = localConfigs() .upstreamProxy(config.upstreamProxy()) .logLevel(config.logLevel()); if (StringUtils.isNotBlank(config.caCertPath()) || StringUtils.isNotBlank(config.caKeyPath())) { ((LocalHoverflyConfig) configs).overrideDefaultCaCert(config.caCertPath(), config.caKeyPath()); } if (StringUtils.isNotBlank(config.clientCertPath()) || StringUtils.isNotBlank(config.clientKeyPath())) { ((LocalHoverflyConfig) configs) .enableClientAuth(config.clientCertPath(), config.clientKeyPath(), config.clientAuthDestination()) .clientAuthCaCertPath(config.clientCaCertPath()); } if (StringUtils.isNotBlank(config.binaryLocation())) { ((LocalHoverflyConfig) configs).binaryLocation(config.binaryLocation()); } if (config.plainHttpTunneling()) { ((LocalHoverflyConfig) configs).plainHttpTunneling(); } if (config.disableTlsVerification()){ ((LocalHoverflyConfig) configs).disableTlsVerification(); } if (config.commands().length > 0) { ((LocalHoverflyConfig) configs).addCommands(config.commands()); } } fillHoverflyConfig(configs, config); return configs; } else { return localConfigs(); } } private  HoverflyExtensionUtils();   }
@Test void shouldBeAbleToCustomizeBinaryLocation() { HoverflyConfig mockHoverflyConfig = mock(HoverflyConfig.class); when(mockHoverflyConfig.remoteHost()).thenReturn(""); when(mockHoverflyConfig.captureHeaders()).thenReturn(new String[]{}); when(mockHoverflyConfig.commands()).thenReturn(new String[]{}); when(mockHoverflyConfig.destination()).thenReturn(new String[]{}); doReturn(UnsetSimulationPreprocessor.class).when(mockHoverflyConfig).simulationPreprocessor(); when(mockHoverflyConfig.binaryLocation()).thenReturn("/home/hoverfly"); HoverflyConfiguration actualConfigs = HoverflyExtensionUtils.getHoverflyConfigs(mockHoverflyConfig).build(); assertThat(actualConfigs.getBinaryLocation()).isEqualTo("/home/hoverfly"); }