package xyz.its_me.alfresco;

import org.alfresco.service.cmr.repository.NodeService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;

public class NodeServiceTest {
    private static final String CONFIG_LOCATION = "classpath:alfresco/application-context.xml";
    private static final ApplicationContext context = new ClassPathXmlApplicationContext(CONFIG_LOCATION);
    private NodeService nodeService = context.getBean("nodeService", NodeService.class);

    @Test
    public void testContext() {
        assertThat(nodeService, notNullValue());
    }
}

@@ -70,23 +70,128 @@
 ory.Node
-Service
+Ref;%0Aimport org.alfresco.service.cmr.repository.NodeService;%0Aimport org.alfresco.service.cmr.repository.StoreRef
 ;%0Aimport
@@ -338,16 +338,84 @@
 ntext;%0A%0A
+import java.util.UUID;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0A
 import s
@@ -491,26 +491,17 @@
 .Assert.
-assertThat
+*
 ;%0A%0Apubli
@@ -856,16 +856,22 @@
 tContext
+Starts
 () %7B%0A   
@@ -921,11 +921,711 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testNodeExistsNullCheck() %7B%0A        try %7B%0A            nodeService.exists((NodeRef) null);%0A            fail(%22expected exception has not been thrown%22);%0A        %7D catch (IllegalArgumentException e) %7B%0A            assertThat(e.getMessage(), is(%22nodeRef is a mandatory parameter%22));%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testRandomNodeRefNotExists() throws Exception %7B%0A        final NodeRef nodeRef = new NodeRef(%22workspace://SpacesStore/%22 + UUID.randomUUID());%0A        assertFalse(nodeService.exists(nodeRef));%0A    %7D%0A%0A    @Test%0A    public void testStoreRootExists() throws Exception %7B%0A        assertTrue(nodeService.exists(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE));%0A    %7D
 %0A%7D%0A

add more useful tests