Source:
<code>public void testNonDefaultsWriterFactory() throws ValidationException { final ImmutableList<String> typenames = ImmutableList.of(); final Map<String, Object> settings = new HashMap<>(); final GelfWriterFactory gelfWriterFactory = new GelfWriterFactory( typenames, true, true, settings, "test", 12202, ImmutableMap.of("test", (Object) "test"), "udp", 10, 10, 10, true, 10, true, "/somefile", true, true, 10 ); assertThat( gelfWriterFactory.getGelfConfiguration() ).is( <START> new Condition<GelfConfiguration>() { <END> @Override public boolean matches(final GelfConfiguration gelfConfiguration) { if (gelfConfiguration.getQueueSize() != 10) { return false; } if (gelfConfiguration.getConnectTimeout() != 10) { return false; } if (gelfConfiguration.getReconnectDelay() != 10) { return false; } if (!gelfConfiguration.isTcpNoDelay()) { return false; } if (gelfConfiguration.getSendBufferSize() != 10) { return false; } if (!gelfConfiguration.isTlsEnabled()) { return false; } if (!gelfConfiguration.getTlsTrustCertChainFile() .getPath() .equals("/somefile")) { return false; } if (!gelfConfiguration.isTlsCertVerificationEnabled()) { return false; } if (!gelfConfiguration.isTcpKeepAlive()) { return false; } if (gelfConfiguration.getMaxInflightSends() != 10) { return false; } return true; } } ) .as("Custom configuration not used"); final GelfWriter gelfWriter = gelfWriterFactory.create(); assertThat(gelfWriter).isNotNull().as("Didn't get a writer back."); }</code><technical_language>a Condition is more readable testing individual fields. I for a series of: assertThat(gelfConfiguration.getQueueSize()).isEqualsTo(10) ..</technical_language>

Target:
public void testNonDefaultsWriterFactory() throws ValidationException { final ImmutableList<String> typenames = ImmutableList.of(); final Map<String, Object> settings = new HashMap<>(); final GelfWriterFactory gelfWriterFactory = new GelfWriterFactory( typenames, "test", 12202, ImmutableMap.of("type", (Object) "jmx"), "udp", 10, 10, 10, true, 10, true, "/somefile", true, true, 10 ); assertThat( gelfWriterFactory.getGelfConfiguration().getQueueSize() ).isEqualTo(10) .as("Invalid queue size"); assertThat( gelfWriterFactory.getGelfConfiguration().getConnectTimeout() ).isEqualTo(10) .as("Invalid connection timeout"); assertThat( gelfWriterFactory.getGelfConfiguration().getReconnectDelay() ).isEqualTo(10) .as("Invalid reconnect delay"); assertThat( gelfWriterFactory.getGelfConfiguration().isTcpNoDelay() ).isTrue() .as("Invalid tcp no delay"); assertThat( gelfWriterFactory.getGelfConfiguration().getSendBufferSize() ).isEqualTo(10) .as("Invalid send buffer size"); assertThat( gelfWriterFactory.getGelfConfiguration().getTlsTrustCertChainFile() ).isInstanceOf(File.class) .as("Invalid tls trustcertchain file"); assertThat( gelfWriterFactory.getGelfConfiguration().getTlsTrustCertChainFile() .getPath() ).isEqualTo("/somefile") .as("Invalid tls trustcertchain file"); assertThat( gelfWriterFactory.getGelfConfiguration().isTlsCertVerificationEnabled() ).isTrue() .as("Invalid tls Cert verification enabled"); assertThat( gelfWriterFactory.getGelfConfiguration().isTcpKeepAlive() ).isTrue() .as("Invalid tcp keep alive"); assertThat( gelfWriterFactory.getGelfConfiguration().getMaxInflightSends() ).isEqualTo(10) .as("Invalid max inflight sends"); final GelfWriter gelfWriter = gelfWriterFactory.create(); assertThat(gelfWriter).isNotNull().as("Didn't get a writer back."); }