Search in sources :

Example 1 with ContentVersionId

use of com.enonic.xp.content.ContentVersionId in project xp by enonic.

the class GetContentHandlerTest method getByPathAndVersionId_NotFound.

@Test
public void getByPathAndVersionId_NotFound() {
    final ContentPath path = ContentPath.from("/a/b/mycontent");
    final ContentVersionId versionId = ContentVersionId.from("versionId");
    Mockito.when(this.contentService.getByPathAndVersionId(path, versionId)).thenThrow(new ContentNotFoundException(path, versionId, ContextAccessor.current().getBranch()));
    runFunction("/test/GetContentHandlerTest.js", "getByPathAndVersionId_notFound");
}
Also used : ContentNotFoundException(com.enonic.xp.content.ContentNotFoundException) ContentPath(com.enonic.xp.content.ContentPath) ContentVersionId(com.enonic.xp.content.ContentVersionId) Test(org.junit.jupiter.api.Test)

Example 2 with ContentVersionId

use of com.enonic.xp.content.ContentVersionId in project xp by enonic.

the class GetContentHandlerTest method getByPathAndVersionId.

@Test
public void getByPathAndVersionId() {
    final Content content = TestDataFixtures.newExampleContent();
    final ContentPath path = ContentPath.from("/a/b/mycontent");
    final ContentVersionId versionId = ContentVersionId.from("versionId");
    Mockito.when(this.contentService.getByPathAndVersionId(path, versionId)).thenReturn(content);
    runFunction("/test/GetContentHandlerTest.js", "getByPathAndVersionId");
}
Also used : Content(com.enonic.xp.content.Content) ContentPath(com.enonic.xp.content.ContentPath) ContentVersionId(com.enonic.xp.content.ContentVersionId) Test(org.junit.jupiter.api.Test)

Example 3 with ContentVersionId

use of com.enonic.xp.content.ContentVersionId in project xp by enonic.

the class GetContentHandlerTest method getByIdAndVersionId_NotFound.

@Test
public void getByIdAndVersionId_NotFound() {
    final ContentId contentId = ContentId.from("mycontentId");
    final ContentVersionId versionId = ContentVersionId.from("versionId");
    Mockito.when(this.contentService.getByIdAndVersionId(contentId, versionId)).thenThrow(new ContentNotFoundException(contentId, versionId, ContextAccessor.current().getBranch()));
    runFunction("/test/GetContentHandlerTest.js", "getByIdAndVersionId_notFound");
}
Also used : ContentNotFoundException(com.enonic.xp.content.ContentNotFoundException) ContentId(com.enonic.xp.content.ContentId) ContentVersionId(com.enonic.xp.content.ContentVersionId) Test(org.junit.jupiter.api.Test)

Example 4 with ContentVersionId

use of com.enonic.xp.content.ContentVersionId in project xp by enonic.

the class GetContentHandlerTest method getByIdAndVersionId.

@Test
public void getByIdAndVersionId() {
    final Content content = TestDataFixtures.newExampleContent();
    final ContentId contentId = ContentId.from("mycontentId");
    final ContentVersionId versionId = ContentVersionId.from("versionId");
    Mockito.when(this.contentService.getByIdAndVersionId(contentId, versionId)).thenReturn(content);
    runFunction("/test/GetContentHandlerTest.js", "getByIdAndVersionId");
}
Also used : Content(com.enonic.xp.content.Content) ContentId(com.enonic.xp.content.ContentId) ContentVersionId(com.enonic.xp.content.ContentVersionId) Test(org.junit.jupiter.api.Test)

Aggregations

ContentVersionId (com.enonic.xp.content.ContentVersionId)4 Test (org.junit.jupiter.api.Test)4 Content (com.enonic.xp.content.Content)2 ContentId (com.enonic.xp.content.ContentId)2 ContentNotFoundException (com.enonic.xp.content.ContentNotFoundException)2 ContentPath (com.enonic.xp.content.ContentPath)2