com.mongodb.MongoQueryException Java Examples
The following examples show how to use
com.mongodb.MongoQueryException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestGeoQueries.java From morphia with Apache License 2.0 | 5 votes |
@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); }
Example #2
Source File: ITMongoDBTracing.java From brave with Apache License 2.0 | 5 votes |
@Test public void setsError() { assertThatThrownBy(() -> executeFind(INVALID_COLLECTION_NAME)) .isInstanceOf(MongoQueryException.class); // the error the interceptor receives is a MongoCommandException! testSpanHandler.takeRemoteSpanWithErrorMessage(CLIENT, ".*InvalidNamespace.*"); }