MongoConfig extends Config { public void uri(String uri) { if (this.uri != null) throw new Error(format("mongo uri is already configured, name={}, uri={}, previous={}", name, uri, this.uri)); var connectionString = new ConnectionString(uri); if (connectionString.getDatabase() == null) throw new Error("uri must have database, uri=" + uri); mongo.uri = connectionString(connectionString); this.uri = uri; }  void uri(String uri); void poolSize(int minSize, int maxSize); void slowOperationThreshold(Duration threshold); void tooManyRowsReturnedThreshold(int threshold); void timeout(Duration timeout); void collection(Class<T> entityClass); void view(Class<T> viewClass);  }
@Test void uri() { assertThatThrownBy(() -> config.uri("mongodb: .hasMessageContaining("uri must have database"); }