类com.mongodb.MongoQueryException源码实例Demo

下面列出了怎么用com.mongodb.MongoQueryException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: morphia   文件: TestGeoQueries.java
@Test(expected = MongoQueryException.class)
public void testNearNoIndex() {
    final Place place1 = new Place("place1", new double[]{1, 1});
    getDs().save(place1);
    Place found = getDs().find(Place.class)
                         .filter(near("loc", new Point(new Position(0, 0)))).iterator(new FindOptions().limit(1))
                         .tryNext();
    Assert.assertNull(found);
}
 
源代码2 项目: brave   文件: ITMongoDBTracing.java
@Test public void setsError() {
  assertThatThrownBy(() -> executeFind(INVALID_COLLECTION_NAME))
      .isInstanceOf(MongoQueryException.class);

  // the error the interceptor receives is a MongoCommandException!
  testSpanHandler.takeRemoteSpanWithErrorMessage(CLIENT, ".*InvalidNamespace.*");
}
 
 类所在包
 类方法
 同包方法