@Test public void extractMatchingTransitionsFromMessageWithOneTransition() throws Exception { String message = "test: close #TEST-15289"; final Map<String, String> matchingTransitions = jiraService.extractMatchingTransitionsFromMessage(message); assertThat(matchingTransitions) .hasSize(1); assertThat(matchingTransitions) .containsOnly(MapEntry.entry("TEST-15289", "Close")); }
public Map<String, String> extractMatchingTransitionsFromMessage(String message) { Map<String, String> matchingTransition = Maps.newHashMap(); List<String> issues = extractIssuesFromMessage(message); issues.forEach(issue -> { Optional<String> optionalTransition = extractMatchingTransitionsFromMessage(message, issue); if(optionalTransition.isPresent()) { matchingTransition.put(issue, optionalTransition.get()); } }); return matchingTransition; }
JiraService { public Map<String, String> extractMatchingTransitionsFromMessage(String message) { Map<String, String> matchingTransition = Maps.newHashMap(); List<String> issues = extractIssuesFromMessage(message); issues.forEach(issue -> { Optional<String> optionalTransition = extractMatchingTransitionsFromMessage(message, issue); if(optionalTransition.isPresent()) { matchingTransition.put(issue, optionalTransition.get()); } }); return matchingTransition; } }
JiraService { public Map<String, String> extractMatchingTransitionsFromMessage(String message) { Map<String, String> matchingTransition = Maps.newHashMap(); List<String> issues = extractIssuesFromMessage(message); issues.forEach(issue -> { Optional<String> optionalTransition = extractMatchingTransitionsFromMessage(message, issue); if(optionalTransition.isPresent()) { matchingTransition.put(issue, optionalTransition.get()); } }); return matchingTransition; } @Inject  JiraService(@NonNull JiraConfiguration jiraConfiguration); }
JiraService { public Map<String, String> extractMatchingTransitionsFromMessage(String message) { Map<String, String> matchingTransition = Maps.newHashMap(); List<String> issues = extractIssuesFromMessage(message); issues.forEach(issue -> { Optional<String> optionalTransition = extractMatchingTransitionsFromMessage(message, issue); if(optionalTransition.isPresent()) { matchingTransition.put(issue, optionalTransition.get()); } }); return matchingTransition; } @Inject  JiraService(@NonNull JiraConfiguration jiraConfiguration); Response<Object> getIssue(String issue); Response<CommentResponse> getCommentsOfIssue(String issue); Response<Comment> commentIssue(String issue, Comment comment); TransitionResponse getTransitionsOfIssue(String issue); boolean transitionOnIssue(String issue, TransitionInput transitionInput); Response<Map<String, Object>> serverInfo(); List<String> extractIssuesFromMessage(String message); Map<String, String> extractMatchingTransitionsFromMessage(String message); Optional<String> extractMatchingTransitionsFromMessage(String message, String issue); boolean performTransition(String message, String issue, String comment); boolean isExistingIssue(String issue); Optional<Transition> getTransition(String issue, String name); boolean isExistingTransition(String issue, String name); boolean isIssueAlreadyCommented(String issue, String commitId); }
JiraService { public Map<String, String> extractMatchingTransitionsFromMessage(String message) { Map<String, String> matchingTransition = Maps.newHashMap(); List<String> issues = extractIssuesFromMessage(message); issues.forEach(issue -> { Optional<String> optionalTransition = extractMatchingTransitionsFromMessage(message, issue); if(optionalTransition.isPresent()) { matchingTransition.put(issue, optionalTransition.get()); } }); return matchingTransition; } @Inject  JiraService(@NonNull JiraConfiguration jiraConfiguration); Response<Object> getIssue(String issue); Response<CommentResponse> getCommentsOfIssue(String issue); Response<Comment> commentIssue(String issue, Comment comment); TransitionResponse getTransitionsOfIssue(String issue); boolean transitionOnIssue(String issue, TransitionInput transitionInput); Response<Map<String, Object>> serverInfo(); List<String> extractIssuesFromMessage(String message); Map<String, String> extractMatchingTransitionsFromMessage(String message); Optional<String> extractMatchingTransitionsFromMessage(String message, String issue); boolean performTransition(String message, String issue, String comment); boolean isExistingIssue(String issue); Optional<Transition> getTransition(String issue, String name); boolean isExistingTransition(String issue, String name); boolean isIssueAlreadyCommented(String issue, String commitId); static final String TRANSITION_HOLDER; static final Pattern ISSUE_PATTERN; }