@Bean
public MongoTemplate method1() throws Exception {
return new MongoTemplate(mongoDbConnection(), databaseName);
}` @Bean
public MongoClient method2() throws Exception {
uri = uri + "Example String";
ConnectionString connectionString = new ConnectionString(uri);
return MongoClients.create(connectionString);
}`如何编写上述方法的测试用例
1条答案
按热度按时间oyt4ldly1#
如果它是一个知道预期值的对象创建类,则不需要执行测试。如果必须进行测试,则只需验证对象是否已正确创建和初始化。