@Test public void makeTcpCollector() throws Exception { Mockito.when(resolver.getKeys()).thenAnswer((invocation) -> ARGUMENTS.getRawMap().keySet().stream()); TcpBuilder builder = new TcpBuilder(); builder.setAsPath(BASE_PATH); builder.setTagSet(resolver); GroupGenerator tcpCollector = builder.build(er).getCreateGenerator().create(ARGUMENTS); assertThat(tcpCollector, instanceOf(TcpCollector.class)); assertThat(tcpCollector, hasProperty("dst", equalTo(new InetSocketAddress("localhost", 6000)))); assertThat(tcpCollector, hasProperty("groupName", equalTo(EXPECTED_GROUP))); Mockito.verify(resolver, Mockito.atMost(1)).getKeys(); Mockito.verifyNoMoreInteractions(resolver); Mockito.verifyZeroInteractions(er); }
@Override public ResolverGroupGenerator build(BiConsumer<String, HttpServlet> er) throws Exception { final Set<Any2<Integer, String>> keySet = tagSet.getKeys().collect(Collectors.toSet()); if (!keySet.containsAll(Arrays.asList(Any2.right("host"), Any2.right("port")))) throw new IllegalArgumentException("'host' and 'port' arguments must be supplied"); return new ResolverGroupGenerator(tagSet, new Constructor(getAsPath())); }
TcpBuilder implements CollectorBuilder, MainNone, AcceptAsPath, AcceptTagSet { @Override public ResolverGroupGenerator build(BiConsumer<String, HttpServlet> er) throws Exception { final Set<Any2<Integer, String>> keySet = tagSet.getKeys().collect(Collectors.toSet()); if (!keySet.containsAll(Arrays.asList(Any2.right("host"), Any2.right("port")))) throw new IllegalArgumentException("'host' and 'port' arguments must be supplied"); return new ResolverGroupGenerator(tagSet, new Constructor(getAsPath())); } }
TcpBuilder implements CollectorBuilder, MainNone, AcceptAsPath, AcceptTagSet { @Override public ResolverGroupGenerator build(BiConsumer<String, HttpServlet> er) throws Exception { final Set<Any2<Integer, String>> keySet = tagSet.getKeys().collect(Collectors.toSet()); if (!keySet.containsAll(Arrays.asList(Any2.right("host"), Any2.right("port")))) throw new IllegalArgumentException("'host' and 'port' arguments must be supplied"); return new ResolverGroupGenerator(tagSet, new Constructor(getAsPath())); }  }
TcpBuilder implements CollectorBuilder, MainNone, AcceptAsPath, AcceptTagSet { @Override public ResolverGroupGenerator build(BiConsumer<String, HttpServlet> er) throws Exception { final Set<Any2<Integer, String>> keySet = tagSet.getKeys().collect(Collectors.toSet()); if (!keySet.containsAll(Arrays.asList(Any2.right("host"), Any2.right("port")))) throw new IllegalArgumentException("'host' and 'port' arguments must be supplied"); return new ResolverGroupGenerator(tagSet, new Constructor(getAsPath())); }  @Override ResolverGroupGenerator build(BiConsumer<String, HttpServlet> er); }
TcpBuilder implements CollectorBuilder, MainNone, AcceptAsPath, AcceptTagSet { @Override public ResolverGroupGenerator build(BiConsumer<String, HttpServlet> er) throws Exception { final Set<Any2<Integer, String>> keySet = tagSet.getKeys().collect(Collectors.toSet()); if (!keySet.containsAll(Arrays.asList(Any2.right("host"), Any2.right("port")))) throw new IllegalArgumentException("'host' and 'port' arguments must be supplied"); return new ResolverGroupGenerator(tagSet, new Constructor(getAsPath())); }  @Override ResolverGroupGenerator build(BiConsumer<String, HttpServlet> er);  }