use of org.springframework.beans.factory.config.ConstructorArgumentValues in project spring-data-mongodb by spring-projects.
the class MongoDbFactoryParserIntegrationTests method setsUpMongoDbFactoryUsingAMongoUriWithoutCredentials.
// DATAMONGO-306
@Test
public void setsUpMongoDbFactoryUsingAMongoUriWithoutCredentials() {
reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-uri-no-credentials.xml"));
BeanDefinition definition = factory.getBeanDefinition("mongoDbFactory");
ConstructorArgumentValues constructorArguments = definition.getConstructorArgumentValues();
assertThat(constructorArguments.getArgumentCount(), is(1));
ValueHolder argument = constructorArguments.getArgumentValue(0, MongoURI.class);
assertThat(argument, is(notNullValue()));
MongoDbFactory dbFactory = factory.getBean("mongoDbFactory", MongoDbFactory.class);
MongoDatabase db = dbFactory.getDb();
assertThat(db.getName(), is("database"));
}
Aggregations