Skip to content

Commit

Permalink
clean up some name clashing
Browse files Browse the repository at this point in the history
  • Loading branch information
evanchooly committed Sep 19, 2023
1 parent 0bef350 commit 793ec5e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions core/src/test/java/dev/morphia/test/query/TestQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import com.mongodb.BasicDBObject;
import com.mongodb.CursorType;
import com.mongodb.MongoNamespace;
import com.mongodb.client.MongoCollection;
Expand Down Expand Up @@ -46,6 +47,7 @@
import dev.morphia.test.models.Keys;
import dev.morphia.test.models.Rectangle;
import dev.morphia.test.models.Student;
import dev.morphia.test.models.User;
import dev.morphia.test.models.UsesCustomIdObject;

import org.awaitility.Awaitility;
Expand Down Expand Up @@ -97,12 +99,14 @@ public TestQuery() {

@Test
public void testNativeQuery() {
dev.morphia.test.models.User user = getDs().save(new dev.morphia.test.models.User("Malcolm 'Mal' Reynolds", now()));
User user = getDs().save(new User("Malcolm 'Mal' Reynolds", now()));
assertEquals(getDs().find(User.class, new Document("_id", user.getId())).first(), user);
assertEquals(getDs().find(User.class, new Document()).filter(eq("id", user.getId())).first(), user);

assertEquals(getDs().find(dev.morphia.test.models.User.class, new Document("_id", user.getId())).first(),
assertEquals(getDs().find(User.class, new Document("_id", user.getId())).first(),
user);

assertEquals(getDs().find(dev.morphia.test.models.User.class, new Document()).filter(eq("id", user.getId())).first(),
assertEquals(getDs().find(User.class, new Document()).filter(eq("id", user.getId())).first(),
user);
}

Expand Down Expand Up @@ -512,7 +516,7 @@ public void testCompoundSort() {
@Test
public void testCriteriaContainers() {
assertThrows(UnsupportedOperationException.class, () -> {
check(new DefaultQueryFactory().createQuery(getDs(), User.class).disableValidation());
check(new DefaultQueryFactory().createQuery(getDs(), UserInterface.class).disableValidation());
});
}

Expand Down Expand Up @@ -843,7 +847,7 @@ public void testMultipleConstraintsOnOneField() {

@Test
public void testMultipleFilters() {
var newQ = getDs().find(User.class).disableValidation();
var newQ = getDs().find(UserInterface.class).disableValidation();
newQ.filter(
or(
exists("status").not(),
Expand Down Expand Up @@ -1315,7 +1319,7 @@ private <T> void assertListEquals(List<T> list, MongoCursor<T> cursor) {
}

@SuppressWarnings("removal")
private void check(Query<User> query) {
private void check(Query<UserInterface> query) {
query.field("version").equal("latest")
.and(
query.or(
Expand Down Expand Up @@ -1381,7 +1385,7 @@ private void turnOnProfiling() {
}

@Entity
public interface User {
public interface UserInterface {
}

@Entity(value = "capped_pic", cap = @CappedAt(count = 1000))
Expand Down Expand Up @@ -1830,7 +1834,7 @@ private static class ReferenceKeyValue {
private ObjectId value;
}

static class UserImpl implements User {
static class UserImpl implements UserInterface {
@Id
@SuppressWarnings("unused")
private ObjectId id;
Expand Down

0 comments on commit 793ec5e

Please sign in to comment.