### Question:
MongoClientBuilder { public MongoClient build(Environment environment) { if (configuration == null) { throw new IllegalArgumentException("configuration is required"); } try { LOGGER.info("Connecting to MongoDB at '{}'", configuration.getHosts()); final MongoClient mongoClient = createMongoClient(); environment.lifecycle().manage(onShutdown(mongoClient::close)); LOGGER.info("Connected to MongoDB at '{}'", configuration.getHosts()); return mongoClient; } catch (Exception e) { throw new MongoException("Could not configure MongoDB client.", e); } } MongoClientBuilder(MongoConfiguration configuration);   MongoClientBuilder(
      MongoConfiguration configuration, MongoClientOptions.Builder mongoClientOptionsBuilder); MongoClientBuilder withTracer(Tracer tracer); MongoClient build(Environment environment);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void failOnMissingConfiguration() { MongoClientBuilder client = new MongoClientBuilder(null); client.build(environmentMock); }
@Test public void createSslContext() { MongoClientOptions.Builder clientOptionsBuilderMock = spy(MongoClientOptions.Builder.class); MongoConfiguration mongoConfiguration = createValidConfiguration().setUseSsl(true).setCaCertificate("DUMMY"); MongoClientBuilder mongoClientBuilder = new MongoClientBuilder(mongoConfiguration, clientOptionsBuilderMock); mongoClientBuilder.build(environmentMock); verify(clientOptionsBuilderMock).sslEnabled(true); verify(clientOptionsBuilderMock).sslContext(any(SSLContext.class)); }
@Test public void skipSslContext() { MongoClientOptions.Builder clientOptionsBuilderMock = spy(MongoClientOptions.Builder.class); MongoConfiguration mongoConfiguration = createValidConfiguration(); MongoClientBuilder mongoClientBuilder = new MongoClientBuilder(mongoConfiguration, clientOptionsBuilderMock); mongoClientBuilder.build(environmentMock); verify(clientOptionsBuilderMock, never()).sslEnabled(true); verify(clientOptionsBuilderMock, never()).sslContext(any(SSLContext.class)); }