}
}
- public void setEffortToFix(DefaultIssue issue, @Nullable Double d, IssueChangeContext context) {
- if (!Objects.equal(d, issue.closeDate())) {
+ public boolean setEffortToFix(DefaultIssue issue, @Nullable Double d, IssueChangeContext context) {
+ if (!Objects.equal(d, issue.effortToFix())) {
issue.setEffortToFix(d);
issue.setUpdateDate(context.date());
issue.setChanged(true);
+ return true;
}
+ return false;
}
public boolean setAttribute(DefaultIssue issue, String key, @Nullable String value, IssueChangeContext context) {
assertThat(diff.oldValue()).isNull();
assertThat(diff.newValue()).isEqualTo("ABCD");
}
+
+ @Test
+ public void should_set_effort_to_fix() throws Exception {
+ boolean updated = updater.setEffortToFix(issue, 3.14, context);
+ assertThat(updated).isTrue();
+ assertThat(issue.isChanged()).isTrue();
+ assertThat(issue.effortToFix()).isEqualTo(3.14);
+ }
+
+ @Test
+ public void should_not_set_effort_to_fix_if_unchanged() throws Exception {
+ issue.setEffortToFix(3.14);
+ boolean updated = updater.setEffortToFix(issue, 3.14, context);
+ assertThat(updated).isFalse();
+ assertThat(issue.isChanged()).isFalse();
+ assertThat(issue.effortToFix()).isEqualTo(3.14);
+ }
}