OfframpConsole implements Callable<Void> { @SuppressWarnings("unchecked") private OfframpOptions<JsonNode> getOptions() { OfframpOptions<JsonNode> options = null; try { TLSConfig.Factory tlsFactory = tlsTrustAll ? TLSConfig.trustAllFactory() : null; OfframpOptions.Builder optionsBuilder = OfframpOptions .builder(JsonNode.class) .host(host.toString()) .roadName(roadName) .streamName(streamName) .defaultOffset(defaultOffset) .requestBuffer(initialRequestAmount, replenishingRequestAmount) .tlsConfigFactory(tlsFactory); if (username != null) { optionsBuilder.username(username); } if (password != null) { optionsBuilder.password(password); } options = optionsBuilder.build(); } catch (Exception e) { cliout.println("Error creating OfframpOptions: "); e.printStackTrace(); System.exit(Error.OFFRAMP_OPTIONS_CONFIGURATION.code); } return options; }  static void main(String[] args); @Override Void call();  }
@Test @SuppressWarnings("unchecked") public void testGetOptions() throws Exception { String[] args = { "--host=localhost", "--roadName=route66", "--streamName=left" }; final OfframpOptions<JsonNode> ref = OfframpOptions .builder(JsonNode.class) .host("localhost") .roadName("route66") .streamName("left") .defaultOffset(DefaultOffset.LATEST) .requestBuffer(200, 120) .tlsConfigFactory(null) .build(); doNothing().when(offrampConsoleSpied).runClient(offrampOptionsCaptor.capture()); CommandLine.call(offrampConsoleSpied, args); final OfframpOptions<JsonNode> out = offrampOptionsCaptor.getValue(); assertThat(out, is(notNullValue())); assertEquals(out, ref); }