@Test
public void canCreateDbFactory() {
Settings settings = Settings.defaultInstance().withPort(1234).withHost("localhost").withDbFactory(FakeDbFactory.class).withReadPreference(ReadPreference.nearest());
FakeDbFactory dbFactory = (FakeDbFactory) settings.createDbFactory();
assertThat(dbFactory.addresses.size(), is(1));
ServerAddress serverAddress = dbFactory.addresses.get(0);
assertThat(serverAddress.getHost(), is("localhost"));
assertThat(serverAddress.getPort(), is(1234));
assertThat(settings.authenticationRequired(), is(false));
assertThat(dbFactory.getReadPreference(), is(ReadPreference.nearest()));
}