use of com.enonic.xp.content.ContentPath in project xp by enonic.
the class ComponentHandlerTest method getContentNotFound.
@Test
public void getContentNotFound() {
this.request.setEndpointPath("/_/component/main-region/666");
final ContentPath path = ContentPath.from("/site/somepath/content");
Mockito.when(this.contentService.getByPath(path)).thenThrow(new ContentNotFoundException(path, Branch.from("draft")));
this.request.setContentPath(path);
final WebException e = assertThrows(WebException.class, () -> this.handler.handle(this.request, PortalResponse.create().build(), null));
assertEquals(HttpStatus.NOT_FOUND, e.getStatus());
assertEquals("Page [/site/somepath/content] not found", e.getMessage());
}
Aggregations