Skip to content

Commit

Permalink
Revert "remove duplicate class name"
Browse files Browse the repository at this point in the history
This reverts commit 62a9c4d.
  • Loading branch information
evanchooly committed Aug 19, 2024
1 parent 85a7061 commit 096f88d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/src/test/java/dev/morphia/test/TestDiscriminatorLookup.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.morphia.test;

import dev.morphia.annotations.Entity;
import dev.morphia.test.models.Shape;
import dev.morphia.test.models.Square;
import dev.morphia.test.models.TestEntity;

import org.testng.annotations.Test;
Expand All @@ -16,14 +14,14 @@ public class TestDiscriminatorLookup extends TestBase {
public void testLookup() {
withConfig(buildConfig(SomeEntity.class), () -> {
final SomeEntity entity = new SomeEntity();
entity.setShape(new Square());
entity.setShape(new Shape.Square());

getDs().save(entity);
});

final SomeEntity entity = getDs().find(SomeEntity.class).first();
assertNotNull(entity);
assertTrue(Square.class.isInstance(entity.getShape()));
assertTrue(Shape.Square.class.isInstance(entity.getShape()));
}

@Entity
Expand All @@ -38,4 +36,11 @@ public void setShape(Shape shape) {
this.shape = shape;
}
}

@Entity
public static abstract class Shape {
public static class Square extends Shape {
public double side;
}
}
}

0 comments on commit 096f88d

Please sign in to comment.