@Test public void testComputeTargetsMultipleEndpointsFromConfig() throws Exception { final String[] args = { SUBCOMMAND, SERVICE }; final File configDir = temporaryFolder.newFolder(CliConfig.getConfigDirName()); final File configFile = new File(configDir.getAbsolutePath() + File.separator + CliConfig.getConfigFileName()); try (final FileOutputStream outFile = new FileOutputStream(configFile)) { final ByteBuffer byteBuffer = Charsets.UTF_8.encode( "{\"masterEndpoints\":[\"" + ENDPOINTS[0] + "\", \"" + ENDPOINTS[1] + "\", \"" + ENDPOINTS[2] + "\"], \"domains\":[\"" + DOMAINS[0] + "\"]}"); outFile.write(byteBuffer.array(), 0, byteBuffer.remaining()); System.setProperty("user.home", temporaryFolder.getRoot().getAbsolutePath()); final CliParser cliParser = new CliParser(args); final List<Target> targets = cliParser.getTargets(); final List<Target> expectedTargets = ImmutableList.of( Target.from(URI.create(ENDPOINTS[0])), Target.from(URI.create(ENDPOINTS[1])), Target.from(URI.create(ENDPOINTS[2])) ); assertEquals(expectedTargets, targets); } }
public List<Target> getTargets() { return targets; }
CliParser { public List<Target> getTargets() { return targets; } }
CliParser { public List<Target> getTargets() { return targets; } CliParser(final String... args); }
CliParser { public List<Target> getTargets() { return targets; } CliParser(final String... args); List<Target> getTargets(); String getUsername(); boolean getJson(); Namespace getNamespace(); CliCommand getCommand(); LoggingConfig getLoggingConfig(); }
CliParser { public List<Target> getTargets() { return targets; } CliParser(final String... args); List<Target> getTargets(); String getUsername(); boolean getJson(); Namespace getNamespace(); CliCommand getCommand(); LoggingConfig getLoggingConfig();  }