//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldResolveAndReturnAllConfiguredAddresses() public virtual void ShouldResolveAndReturnAllConfiguredAddresses() { // given AdvertisedSocketAddress input1 = new AdvertisedSocketAddress("foo.bar", 123); AdvertisedSocketAddress input2 = new AdvertisedSocketAddress("baz.bar", 432); AdvertisedSocketAddress input3 = new AdvertisedSocketAddress("quux.bar", 789); AdvertisedSocketAddress output1 = new AdvertisedSocketAddress("a.b", 3); AdvertisedSocketAddress output2 = new AdvertisedSocketAddress("b.b", 34); AdvertisedSocketAddress output3 = new AdvertisedSocketAddress("c.b", 7); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: string configString = Stream.of(input1, input2, input3).map(AdvertisedSocketAddress::toString).collect(Collectors.joining(",")); Config config = Config.builder().withSetting(initial_discovery_members, configString).build(); when(_hostnameResolver.resolve(input1)).thenReturn(asList(output1, output2)); when(_hostnameResolver.resolve(input2)).thenReturn(emptyList()); when(_hostnameResolver.resolve(input3)).thenReturn(singletonList(output3)); InitialDiscoveryMembersResolver hostnameResolvingInitialDiscoveryMembersResolver = new InitialDiscoveryMembersResolver(_hostnameResolver, config); // when ICollection <AdvertisedSocketAddress> result = hostnameResolvingInitialDiscoveryMembersResolver.Resolve(identity()); // then assertThat(result, containsInAnyOrder(output1, output2, output3)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnEmptyCollectionIfEmptyInitialMembers() public virtual void ShouldReturnEmptyCollectionIfEmptyInitialMembers() { // given Config config = Config.builder().withSetting(initial_discovery_members, "").build(); InitialDiscoveryMembersResolver hostnameResolvingInitialDiscoveryMembersResolver = new InitialDiscoveryMembersResolver(_hostnameResolver, config); // when ICollection <AdvertisedSocketAddress> result = hostnameResolvingInitialDiscoveryMembersResolver.Resolve(identity()); // then assertThat(result, empty()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldApplyTransform() public virtual void ShouldApplyTransform() { // given AdvertisedSocketAddress input1 = new AdvertisedSocketAddress("foo.bar", 123); AdvertisedSocketAddress output1 = new AdvertisedSocketAddress("a.b", 3); Config config = Config.builder().withSetting(initial_discovery_members, input1.ToString()).build(); when(_hostnameResolver.resolve(input1)).thenReturn(singletonList(output1)); InitialDiscoveryMembersResolver hostnameResolvingInitialDiscoveryMembersResolver = new InitialDiscoveryMembersResolver(_hostnameResolver, config); // when ICollection <string> result = hostnameResolvingInitialDiscoveryMembersResolver.Resolve(address => address.ToString().ToUpper()); // then assertThat(result, containsInAnyOrder(output1.ToString().ToUpper())); }