Search in sources :

Example 26 with GetContentTypeParams

use of com.enonic.xp.schema.content.GetContentTypeParams in project xp by enonic.

the class CreateContentHandlerTest method createContentAlreadyExists.

@Test
public void createContentAlreadyExists() throws Exception {
    final Exception alreadyExistException = new ContentAlreadyExistsException(ContentPath.from("/a/b/mycontent"), RepositoryId.from("some.repo"), Branch.from("draft"));
    when(this.contentService.create(any(CreateContentParams.class))).thenThrow(alreadyExistException);
    final ContentType contentType = ContentType.create().name("test:myContentType").superType(ContentTypeName.structured()).build();
    GetContentTypeParams getContentType = GetContentTypeParams.from(ContentTypeName.from("test:myContentType"));
    when(this.contentTypeService.getByName(Mockito.eq(getContentType))).thenReturn(contentType);
    runFunction("/test/CreateContentHandlerTest.js", "createContentNameAlreadyExists");
}
Also used : GetContentTypeParams(com.enonic.xp.schema.content.GetContentTypeParams) ContentType(com.enonic.xp.schema.content.ContentType) CreateContentParams(com.enonic.xp.content.CreateContentParams) ContentAlreadyExistsException(com.enonic.xp.content.ContentAlreadyExistsException) ContentAlreadyExistsException(com.enonic.xp.content.ContentAlreadyExistsException) Test(org.junit.jupiter.api.Test)

Aggregations

GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)26 ContentType (com.enonic.xp.schema.content.ContentType)18 Test (org.junit.jupiter.api.Test)17 CreateContentParams (com.enonic.xp.content.CreateContentParams)12 PropertyTree (com.enonic.xp.data.PropertyTree)8 Content (com.enonic.xp.content.Content)4 Form (com.enonic.xp.form.Form)4 AbstractSchemaTest (com.enonic.xp.core.impl.schema.AbstractSchemaTest)3 ContentTypes (com.enonic.xp.schema.content.ContentTypes)3 ContentAlreadyExistsException (com.enonic.xp.content.ContentAlreadyExistsException)2 FormItemSet (com.enonic.xp.form.FormItemSet)2 Node (com.enonic.xp.node.Node)2 NodePath (com.enonic.xp.node.NodePath)2 XData (com.enonic.xp.schema.xdata.XData)2 ContentAccessException (com.enonic.xp.content.ContentAccessException)1 ContentValidator (com.enonic.xp.content.ContentValidator)1 ContentValidatorParams (com.enonic.xp.content.ContentValidatorParams)1 CreateContentTranslatorParams (com.enonic.xp.content.CreateContentTranslatorParams)1 EditableContent (com.enonic.xp.content.EditableContent)1 MoveContentParams (com.enonic.xp.content.MoveContentParams)1