    @Test
    public void testGetAllTemplatesForUser() {     

        MockResourceResponse response = new MockResourceResponse();
        MockResourceRequest request = new MockResourceRequest();
        
        List <Long> organizationIds = new LinkedList<Long>();
        organizationIds.add((long) 1);
        organizationIds.add((long) 2);
        
        when(mockUser.getLastName()).thenReturn("Bartonicek");
        when(mockLiferayService.getUser(request, response)).thenReturn(mockUser);  
        when(mockLiferayService.getOrganizationIds(mockUser)).thenReturn(organizationIds);  
            
        try{
            mainController.getTemplates(request, response, 1, 1);
            JsonNode rootNode = objectMapper.readValue(response.getContentAsString(), JsonNode.class);
            
            int templatesExpected = 1;
            int rowsFound = 0;        
            for (@SuppressWarnings("unused") JsonNode node : rootNode.path("rows")) {
                ++rowsFound;
            }
            assertEquals(templatesExpected, rowsFound); 
        }
        catch (Exception e){
            ExceptionUtil.throwSystemException(e);   
        }
    }