コード例 #1
0
  @Test
  public void shouldAddCustomFieldParamsOnDelete() throws Exception {
    final CustomField customField1 = createMock(CustomField.class);
    expect(customField1.getId()).andReturn("customfield_10000");
    expect(customField1.getValue(issue)).andReturn("Value1");
    final CustomField customField2 = createMock(CustomField.class);
    expect(customField2.getId()).andReturn("customfield_10001");
    expect(customField2.getValue(issue)).andReturn("Value2");
    replay(customField1, customField2);

    expect(customFieldManager.getCustomFieldObjects(issue))
        .andReturn(ImmutableList.of(customField1, customField2));
    IssueDeleteHelper tested = getIssueDeleteHelper();
    setUpEmptyWatchers();
    expect(mockSubTaskManager.isSubTask(issueGenericValue)).andReturn(false);
    replayMocks();

    tested.deleteIssue((User) null, issue, EventDispatchOption.ISSUE_DELETED, true);
    makeAssertions();
    verify(customField1, customField2);
    final Map<String, Object> expected =
        ImmutableMap.<String, Object>of(
            "customfield_10000", "Value1", "customfield_10001", "Value2");
    assertEquals(expected, capturedEventParams.get(IssueEvent.CUSTOM_FIELDS_PARAM_NAME));
    assertTrue(capturedSendMailFlag);
  }
 /* (non-Javadoc)
  * @see com.googlecode.jsu.workflow.AbstractWorkflowPluginFactory#getVelocityParamsForInput(java.util.Map)
  */
 protected void getVelocityParamsForInput(Map<String, Object> velocityParams) {
   velocityParams.put("val-fieldsList", customFieldManager.getCustomFieldObjects());
 }
コード例 #3
0
 private void setUpEmptyCustomFields() {
   expect(customFieldManager.getCustomFieldObjects(issue))
       .andReturn(Collections.<CustomField>emptyList());
 }