Search in sources :

Example 1 with Document

use of io.crnk.core.mock.models.Document in project crnk-framework by crnk-project.

the class RegistryEntryTest method onValidParentShouldReturnTrue.

@Test
public void onValidParentShouldReturnTrue() throws Exception {
    // GIVEN
    RegistryEntry thing = new RegistryEntry(newResourceEntry(Thing.class, "things"));
    RegistryEntry document = new RegistryEntry(newResourceEntry(Document.class, "documents"));
    document.setParentRegistryEntry(thing);
    RegistryEntry memorandum = new RegistryEntry(newResourceEntry(Memorandum.class, "memorandum"));
    memorandum.setParentRegistryEntry(document);
    // WHEN
    boolean result = memorandum.isParent(thing);
    // THEN
    assertThat(result).isTrue();
}
Also used : Memorandum(io.crnk.core.mock.models.Memorandum) Document(io.crnk.core.mock.models.Document) RegistryEntry(io.crnk.core.engine.registry.RegistryEntry) Thing(io.crnk.core.mock.models.Thing) Test(org.junit.Test)

Example 2 with Document

use of io.crnk.core.mock.models.Document in project crnk-framework by crnk-project.

the class RegistryEntryTest method onInvalidParentShouldReturnFalse.

@Test
public void onInvalidParentShouldReturnFalse() throws Exception {
    // GIVEN
    RegistryEntry document = new RegistryEntry(newResourceEntry(Document.class, "documents"));
    RegistryEntry task = new RegistryEntry(newResourceEntry(Task.class, "tasks"));
    // WHEN
    boolean result = document.isParent(task);
    // THEN
    assertThat(result).isFalse();
}
Also used : Task(io.crnk.core.mock.models.Task) Document(io.crnk.core.mock.models.Document) RegistryEntry(io.crnk.core.engine.registry.RegistryEntry) Test(org.junit.Test)

Aggregations

RegistryEntry (io.crnk.core.engine.registry.RegistryEntry)2 Document (io.crnk.core.mock.models.Document)2 Test (org.junit.Test)2 Memorandum (io.crnk.core.mock.models.Memorandum)1 Task (io.crnk.core.mock.models.Task)1 Thing (io.crnk.core.mock.models.Thing)1