src/test/java/com/sourcesense/confluence/cmis/macros/AbstractMacroBaseUnitTestCase.java
protected <T extends CmisObject> T createMockedCmisObject(Object[][] properties, Class<T> clazz)
    {
        T object = mock(clazz);
        List<Property<?>> documentProperties = new ArrayList<Property<?>>();
        for (Object[] mockProp : properties)
        {
            Property prop = createMockedProperty(mockProp[0], mockProp[1], mockProp[2]);
            documentProperties.add(prop);
            when(object.getProperty(mockProp[0].toString())).thenReturn(prop);

            if (PropertyIds.NAME.equals(mockProp[0]))
            {
                when(object.getName()).thenReturn(mockProp[2].toString());
            }
        }
        when(object.getProperties()).thenReturn(documentProperties);

        return object;
    }
/**
     * Create a mock CmisObject using Mockito that will contain the provided properties
     *
     * @param properties Array of arrays in the form of {{propertyId, displayName, propertyValue}}
     * @param clazz      Class object in the CmisObject hierarchy that has to be created
     * @return The mocked CmisObject
     */
Create a mock CmisObject using Mockito that will contain the provided properties
@param properties Array of arrays in the form of {{propertyId, displayName, propertyValue}}
@param clazz      Class object in the CmisObject hierarchy that has to be created
@return The mocked CmisObject
Create a mock CmisObject using Mockito that will contain the provided properties @param properties Array of arrays in the form of {{ propertyId displayName propertyValue }} @param clazz Class object in the CmisObject hierarchy that has to be created @return The mocked CmisObject
protected <T extends CmisObject> T createMockedCmisObject(Object[][] properties, Class<T> clazz)
    {
        T object = mock(clazz);
        List<Property<?>> documentProperties = new ArrayList<Property<?>>();
        for (Object[] mockProp : properties)
        {
            Property prop = createMockedProperty(mockProp[0], mockProp[1], mockProp[2]);
            documentProperties.add(prop);
            when(object.getProperty(mockProp[0].toString())).thenReturn(prop);
            if (PropertyIds.NAME.equals(mockProp[0]))
            {
                when(object.getName()).thenReturn(mockProp[2].toString());
            }
        }
        when(object.getProperties()).thenReturn(documentProperties);
        return object;
    }
protected < T extends CmisObject > T createMockedCmisObject ( Object [ ] [ ] properties , Class < T > clazz ) { T object = mock ( clazz ) ; List < Property < ? > > documentProperties = new ArrayList < Property < ? > > ( ) ; for ( Object [ ] mockProp : properties ) { Property prop = createMockedProperty ( mockProp [ 0 ] , mockProp [ 1 ] , mockProp [ 2 ] ) ; documentProperties . add ( prop ) ; when ( object . getProperty ( mockProp [ 0 ] . toString ( ) ) ) . thenReturn ( prop ) ; if ( PropertyIds . NAME . equals ( mockProp [ 0 ] ) ) { when ( object . getName ( ) ) . thenReturn ( mockProp [ 2 ] . toString ( ) ) ; } } when ( object . getProperties ( ) ) . thenReturn ( documentProperties ) ; return object ; }
Create a mock CmisObject using Mockito that will contain the provided properties
 @param properties Array of arrays in the form of {{propertyId, displayName, propertyValue}}
 @param clazz      Class object in the CmisObject hierarchy that has to be created
 @return The mocked CmisObject
Create a mock CmisObject using Mockito that will contain the provided properties @param properties Array of arrays in the form of {{ propertyId displayName propertyValue }} @param clazz Class object in the CmisObject hierarchy that has to be created @return The mocked CmisObject