Search in sources :

Example 1 with RawResourceFieldAccessor

use of io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor in project crnk-framework by crnk-project.

the class RawResourceFieldAccessorTest method attribute.

@Test
public void attribute() {
    RawResourceFieldAccessor accessor = new RawResourceFieldAccessor("name", ResourceFieldType.ATTRIBUTE, String.class);
    Assert.assertEquals("Doe", accessor.getValue(resource));
}
Also used : RawResourceFieldAccessor(io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor) Test(org.junit.Test)

Example 2 with RawResourceFieldAccessor

use of io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor in project crnk-framework by crnk-project.

the class RawResourceFieldAccessorTest method links.

@Test
public void links() {
    RawResourceFieldAccessor accessor = new RawResourceFieldAccessor("links", ResourceFieldType.LINKS_INFORMATION, TestLinks.class);
    TestLinks value = (TestLinks) accessor.getValue(resource);
    Assert.assertEquals("someLink", value.name);
}
Also used : RawResourceFieldAccessor(io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor) Test(org.junit.Test)

Example 3 with RawResourceFieldAccessor

use of io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor in project crnk-framework by crnk-project.

the class RawResourceFieldAccessorTest method meta.

@Test
public void meta() {
    RawResourceFieldAccessor accessor = new RawResourceFieldAccessor("meta", ResourceFieldType.META_INFORMATION, TestMeta.class);
    TestMeta value = (TestMeta) accessor.getValue(resource);
    Assert.assertEquals("someMeta", value.name);
}
Also used : RawResourceFieldAccessor(io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor) Test(org.junit.Test)

Example 4 with RawResourceFieldAccessor

use of io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor in project crnk-framework by crnk-project.

the class RawResourceFieldAccessorTest method relationship.

@Test
public void relationship() {
    RawResourceFieldAccessor accessor = new RawResourceFieldAccessor("address", ResourceFieldType.RELATIONSHIP, ResourceIdentifier.class);
    ResourceIdentifier value = (ResourceIdentifier) accessor.getValue(resource);
    Assert.assertEquals("zurich", value.getId());
}
Also used : ResourceIdentifier(io.crnk.core.engine.document.ResourceIdentifier) RawResourceFieldAccessor(io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor) Test(org.junit.Test)

Example 5 with RawResourceFieldAccessor

use of io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor in project crnk-framework by crnk-project.

the class RawResourceFieldAccessorTest method id.

@Test
public void id() {
    RawResourceFieldAccessor accessor = new RawResourceFieldAccessor("id", ResourceFieldType.ID, String.class);
    Assert.assertEquals("someId", accessor.getValue(resource));
}
Also used : RawResourceFieldAccessor(io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor) Test(org.junit.Test)

Aggregations

RawResourceFieldAccessor (io.crnk.core.engine.internal.information.resource.RawResourceFieldAccessor)6 Test (org.junit.Test)6 ResourceIdentifier (io.crnk.core.engine.document.ResourceIdentifier)1