mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,71 +1,71 @@
|
||||
package org.alfresco.repo.workflow.activiti.properties;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.workflow.WorkflowPropertyHandler;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ActivitiPriorityPropertyHandlerTest
|
||||
{
|
||||
private static ActivitiPriorityPropertyHandler handler;
|
||||
private @Mock
|
||||
Task task;
|
||||
private TypeDefinition type = null;
|
||||
private QName key = null;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp()
|
||||
{
|
||||
handler = new ActivitiPriorityPropertyHandler();
|
||||
MessageService messageService = mock(MessageService.class);
|
||||
handler.setMessageService(messageService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleTaskPropertySetsValidIntPriority()
|
||||
{
|
||||
for (int priority = 1; priority <= 3; priority++)
|
||||
{
|
||||
Object result = handler.handleTaskProperty(task, type, key, priority);
|
||||
assertEquals(WorkflowPropertyHandler.DO_NOT_ADD, result);
|
||||
verify(task).setPriority(priority);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleTaskPropertySetsValidStringPriority()
|
||||
{
|
||||
for (int priority = 1; priority <= 3; priority++)
|
||||
{
|
||||
Object result = handler.handleTaskProperty(task, type, key, "" + priority);
|
||||
assertEquals(WorkflowPropertyHandler.DO_NOT_ADD, result);
|
||||
verify(task).setPriority(priority);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = org.alfresco.service.cmr.workflow.WorkflowException.class)
|
||||
public void handleTaskPropertyDoesNotSetInvalidStringPriority()
|
||||
{
|
||||
String priority = "Not an integer";
|
||||
handler.handleTaskProperty(task, type, key, priority);
|
||||
fail("The method should throw an exception and not reach here.");
|
||||
}
|
||||
|
||||
@Test(expected = org.alfresco.service.cmr.workflow.WorkflowException.class)
|
||||
public void handleTaskPropertyDoesNotSetInvalidClassPriority()
|
||||
{
|
||||
Long priority = 2l;
|
||||
handler.handleTaskProperty(task, type, key, priority);
|
||||
fail("The method should throw an exception and not reach here.");
|
||||
}
|
||||
}
|
||||
package org.alfresco.repo.workflow.activiti.properties;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.workflow.WorkflowPropertyHandler;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ActivitiPriorityPropertyHandlerTest
|
||||
{
|
||||
private static ActivitiPriorityPropertyHandler handler;
|
||||
private @Mock
|
||||
Task task;
|
||||
private TypeDefinition type = null;
|
||||
private QName key = null;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp()
|
||||
{
|
||||
handler = new ActivitiPriorityPropertyHandler();
|
||||
MessageService messageService = mock(MessageService.class);
|
||||
handler.setMessageService(messageService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleTaskPropertySetsValidIntPriority()
|
||||
{
|
||||
for (int priority = 1; priority <= 3; priority++)
|
||||
{
|
||||
Object result = handler.handleTaskProperty(task, type, key, priority);
|
||||
assertEquals(WorkflowPropertyHandler.DO_NOT_ADD, result);
|
||||
verify(task).setPriority(priority);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleTaskPropertySetsValidStringPriority()
|
||||
{
|
||||
for (int priority = 1; priority <= 3; priority++)
|
||||
{
|
||||
Object result = handler.handleTaskProperty(task, type, key, "" + priority);
|
||||
assertEquals(WorkflowPropertyHandler.DO_NOT_ADD, result);
|
||||
verify(task).setPriority(priority);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = org.alfresco.service.cmr.workflow.WorkflowException.class)
|
||||
public void handleTaskPropertyDoesNotSetInvalidStringPriority()
|
||||
{
|
||||
String priority = "Not an integer";
|
||||
handler.handleTaskProperty(task, type, key, priority);
|
||||
fail("The method should throw an exception and not reach here.");
|
||||
}
|
||||
|
||||
@Test(expected = org.alfresco.service.cmr.workflow.WorkflowException.class)
|
||||
public void handleTaskPropertyDoesNotSetInvalidClassPriority()
|
||||
{
|
||||
Long priority = 2l;
|
||||
handler.handleTaskProperty(task, type, key, priority);
|
||||
fail("The method should throw an exception and not reach here.");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user