diff --git a/pom.xml b/pom.xml index bfee571..f6b5b09 100644 --- a/pom.xml +++ b/pom.xml @@ -60,30 +60,43 @@ org.springframework.boot spring-boot-maven-plugin + + io.spring.javaformat + spring-javaformat-maven-plugin + 0.0.6 + + + validate + true + + validate + + + + org.apache.maven.plugins maven-checkstyle-plugin - 2.16 + 3.0.0 com.puppycrawl.tools checkstyle - 6.10.1 + 8.11 + + + io.spring.javaformat + spring-javaformat-checkstyle + 0.0.6 checkstyle-validation validate + true - ${disable.checks} - config/checkstyle/checkstyle.xml - config/checkstyle/checkstyle-suppressions.xml - config/checkstyle/checkstyle-header.txt - checkstyle.build.directory=${project.build.directory} - UTF-8 - true - true + io/spring/javaformat/checkstyle/checkstyle.xml true @@ -92,23 +105,6 @@ - - org.apache.maven.plugins - maven-eclipse-plugin - - false - - - .settings/org.eclipse.jdt.ui.prefs - ${basedir}/config/eclipse/org.eclipse.jdt.ui.prefs - - - .settings/org.eclipse.jdt.core.prefs - ${basedir}/config/eclipse/org.eclipse.jdt.core.prefs - - - - org.jacoco jacoco-maven-plugin diff --git a/src/main/java/io/spring/issuebot/GitHubProperties.java b/src/main/java/io/spring/issuebot/GitHubProperties.java index e84df57..4b5a99d 100644 --- a/src/main/java/io/spring/issuebot/GitHubProperties.java +++ b/src/main/java/io/spring/issuebot/GitHubProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import java.util.List; import lombok.Getter; import lombok.Setter; + import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; diff --git a/src/main/java/io/spring/issuebot/IssueBotApplication.java b/src/main/java/io/spring/issuebot/IssueBotApplication.java index b92cc13..f2524c7 100644 --- a/src/main/java/io/spring/issuebot/IssueBotApplication.java +++ b/src/main/java/io/spring/issuebot/IssueBotApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,16 @@ package io.spring.issuebot; import java.util.List; +import io.spring.issuebot.github.GitHubOperations; +import io.spring.issuebot.github.GitHubTemplate; +import io.spring.issuebot.github.RegexLinkParser; + import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; -import io.spring.issuebot.github.GitHubOperations; -import io.spring.issuebot.github.GitHubTemplate; -import io.spring.issuebot.github.RegexLinkParser; - /** * Main class for launching Issue Bot. * diff --git a/src/main/java/io/spring/issuebot/IssueListener.java b/src/main/java/io/spring/issuebot/IssueListener.java index 228535e..57fa7ab 100644 --- a/src/main/java/io/spring/issuebot/IssueListener.java +++ b/src/main/java/io/spring/issuebot/IssueListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ public interface IssueListener { /** * Notification that the given {@code issue} is open. - * * @param issue the open issue */ default void onOpenIssue(Issue issue) { @@ -36,7 +35,6 @@ public interface IssueListener { /** * Notification that the given {@code issue} is being closed. - * * @param issue the open issue */ default void onIssueClosure(Issue issue) { diff --git a/src/main/java/io/spring/issuebot/MonitoredRepository.java b/src/main/java/io/spring/issuebot/MonitoredRepository.java index be02ae4..c61bff8 100644 --- a/src/main/java/io/spring/issuebot/MonitoredRepository.java +++ b/src/main/java/io/spring/issuebot/MonitoredRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/io/spring/issuebot/RepositoryMonitor.java b/src/main/java/io/spring/issuebot/RepositoryMonitor.java index 4441d82..7760e78 100644 --- a/src/main/java/io/spring/issuebot/RepositoryMonitor.java +++ b/src/main/java/io/spring/issuebot/RepositoryMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,13 @@ package io.spring.issuebot; import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.scheduling.annotation.Scheduled; - import io.spring.issuebot.github.GitHubOperations; import io.spring.issuebot.github.Issue; import io.spring.issuebot.github.Page; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.scheduling.annotation.Scheduled; /** * Central class for monitoring the configured repository. diff --git a/src/main/java/io/spring/issuebot/feedback/FeedbackConfiguration.java b/src/main/java/io/spring/issuebot/feedback/FeedbackConfiguration.java index 938cfd7..314791c 100644 --- a/src/main/java/io/spring/issuebot/feedback/FeedbackConfiguration.java +++ b/src/main/java/io/spring/issuebot/feedback/FeedbackConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,14 @@ package io.spring.issuebot.feedback; import java.util.List; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - import io.spring.issuebot.GitHubProperties; import io.spring.issuebot.IssueListener; import io.spring.issuebot.github.GitHubOperations; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + /** * Central configuration for the beans involved in managing issues that are waiting for * feedback. diff --git a/src/main/java/io/spring/issuebot/feedback/FeedbackIssueListener.java b/src/main/java/io/spring/issuebot/feedback/FeedbackIssueListener.java index edec128..a8be59c 100644 --- a/src/main/java/io/spring/issuebot/feedback/FeedbackIssueListener.java +++ b/src/main/java/io/spring/issuebot/feedback/FeedbackIssueListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/io/spring/issuebot/feedback/FeedbackListener.java b/src/main/java/io/spring/issuebot/feedback/FeedbackListener.java index ea76f13..3713476 100644 --- a/src/main/java/io/spring/issuebot/feedback/FeedbackListener.java +++ b/src/main/java/io/spring/issuebot/feedback/FeedbackListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,6 @@ public interface FeedbackListener { /** * Notification that feedback has been provided for the given {@code issue}. - * * @param issue the issue */ void feedbackProvided(Issue issue); @@ -38,7 +37,6 @@ public interface FeedbackListener { /** * Notification that feedback is still required for the given {@code issue} having * been requested at the given {@code requestTime}. - * * @param issue the issue * @param requestTime the time when feedback was requested */ diff --git a/src/main/java/io/spring/issuebot/feedback/FeedbackProperties.java b/src/main/java/io/spring/issuebot/feedback/FeedbackProperties.java index ad65f6d..8fa33c6 100644 --- a/src/main/java/io/spring/issuebot/feedback/FeedbackProperties.java +++ b/src/main/java/io/spring/issuebot/feedback/FeedbackProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package io.spring.issuebot.feedback; import lombok.Getter; import lombok.Setter; + import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/src/main/java/io/spring/issuebot/feedback/StandardFeedbackListener.java b/src/main/java/io/spring/issuebot/feedback/StandardFeedbackListener.java index 1647731..dd047f1 100644 --- a/src/main/java/io/spring/issuebot/feedback/StandardFeedbackListener.java +++ b/src/main/java/io/spring/issuebot/feedback/StandardFeedbackListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/io/spring/issuebot/github/Comment.java b/src/main/java/io/spring/issuebot/github/Comment.java index d872b3a..229b0b6 100644 --- a/src/main/java/io/spring/issuebot/github/Comment.java +++ b/src/main/java/io/spring/issuebot/github/Comment.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,6 @@ public final class Comment { /** * Creates a new comment that was authored by the given {@code user} at the given * {@code creationTime}. - * * @param user the user * @param creationTime the creation time */ diff --git a/src/main/java/io/spring/issuebot/github/Event.java b/src/main/java/io/spring/issuebot/github/Event.java index 08efa30..b9e2e2e 100644 --- a/src/main/java/io/spring/issuebot/github/Event.java +++ b/src/main/java/io/spring/issuebot/github/Event.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,6 @@ public class Event { /** * Creates a new {@code Event}. - * * @param type the type of the event * @param creationTime the timestamp of when the event was created * @param label the label associated with the event @@ -76,7 +75,7 @@ public class Event { /** * The actor unsubscribed from receibing notifications for an issue. - */ + */ UNSUBSCRIBED("unsubscribed"), /** @@ -164,6 +163,7 @@ public class Event { throw new IllegalArgumentException( "'" + type + "' is not a valid event type"); } + } } diff --git a/src/main/java/io/spring/issuebot/github/GitHubOperations.java b/src/main/java/io/spring/issuebot/github/GitHubOperations.java index 10311fe..1878362 100644 --- a/src/main/java/io/spring/issuebot/github/GitHubOperations.java +++ b/src/main/java/io/spring/issuebot/github/GitHubOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ public interface GitHubOperations { /** * Returns the open issues in the {@code repository} owned by the given * {@code organization}. - * * @param organization the name of the organization * @param repository the name of the repository * @return the issues @@ -35,7 +34,6 @@ public interface GitHubOperations { /** * Returns the comments that have been made on the given {@code issue}. - * * @param issue the issue * @return the comments */ @@ -43,7 +41,6 @@ public interface GitHubOperations { /** * Adds the given {@code label} to the given {@code issue}. - * * @param issue the issue * @param label the label * @return the modified issue @@ -52,7 +49,6 @@ public interface GitHubOperations { /** * Removes the given {@code label} from the given {@code issue}. - * * @param issue the issue * @param label the label * @return the modified issue @@ -61,7 +57,6 @@ public interface GitHubOperations { /** * Adds the given {@code comment} to the given {@code issue}. - * * @param issue the issue * @param comment the comment * @return the added comment @@ -70,7 +65,6 @@ public interface GitHubOperations { /** * Closes the given {@code issue}. - * * @param issue the issue * @return the modified issue */ @@ -78,7 +72,6 @@ public interface GitHubOperations { /** * Returns the events that have occurred on the given {@code issue}. - * * @param issue the issue * @return the events */ diff --git a/src/main/java/io/spring/issuebot/github/GitHubTemplate.java b/src/main/java/io/spring/issuebot/github/GitHubTemplate.java index aa1e27f..291ac1a 100644 --- a/src/main/java/io/spring/issuebot/github/GitHubTemplate.java +++ b/src/main/java/io/spring/issuebot/github/GitHubTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpMethod; import org.springframework.http.HttpRequest; @@ -66,7 +67,6 @@ public class GitHubTemplate implements GitHubOperations { * Creates a new {@code GitHubTemplate} that will use the given {@code username} and * {@code password} to authenticate, and the given {@code linkParser} to parse links * from responses' {@code Link} header. - * * @param username the username * @param password the password * @param linkParser the link parser @@ -92,7 +92,7 @@ public class GitHubTemplate implements GitHubOperations { + new Date(Long .valueOf(response.getHeaders() .getFirst("X-RateLimit-Reset")) - * 1000)); + * 1000)); } } }); @@ -204,7 +204,7 @@ public class GitHubTemplate implements GitHubOperations { @Override public Object read(Type type, Class contextClass, HttpInputMessage inputMessage) - throws IOException, HttpMessageNotReadableException { + throws IOException, HttpMessageNotReadableException { try { return super.read(type, contextClass, inputMessage); } @@ -235,7 +235,7 @@ public class GitHubTemplate implements GitHubOperations { BasicAuthorizationInterceptor(String username, String password) { this.username = username; - this.password = (password == null ? "" : password); + this.password = (password != null) ? password : ""; } @Override diff --git a/src/main/java/io/spring/issuebot/github/Issue.java b/src/main/java/io/spring/issuebot/github/Issue.java index f9b63ac..0bff474 100644 --- a/src/main/java/io/spring/issuebot/github/Issue.java +++ b/src/main/java/io/spring/issuebot/github/Issue.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,6 @@ public class Issue { /** * Creates a new {@code Issue}. - * * @param url the url of the issue in the GitHub API * @param commentsUrl the url of the comments on the issue in the GitHub API * @param eventsUrl the url of the events on the issue in the GitHub API diff --git a/src/main/java/io/spring/issuebot/github/Label.java b/src/main/java/io/spring/issuebot/github/Label.java index 97ed045..d4aa02b 100644 --- a/src/main/java/io/spring/issuebot/github/Label.java +++ b/src/main/java/io/spring/issuebot/github/Label.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ public class Label { /** * Creates a new label with the given {@code name}. - * * @param name the name of the label */ @JsonCreator diff --git a/src/main/java/io/spring/issuebot/github/LinkParser.java b/src/main/java/io/spring/issuebot/github/LinkParser.java index c8c7978..eb11309 100644 --- a/src/main/java/io/spring/issuebot/github/LinkParser.java +++ b/src/main/java/io/spring/issuebot/github/LinkParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ interface LinkParser { /** * Parse the given {@code header} into a map of rel:url pairs. - * * @param header the header to parse * @return the map of links */ diff --git a/src/main/java/io/spring/issuebot/github/Milestone.java b/src/main/java/io/spring/issuebot/github/Milestone.java index 320ed81..571c468 100644 --- a/src/main/java/io/spring/issuebot/github/Milestone.java +++ b/src/main/java/io/spring/issuebot/github/Milestone.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ public class Milestone { /** * Creates a new {@code Milestone} with the given {@code title}. - * * @param title the title */ @JsonCreator diff --git a/src/main/java/io/spring/issuebot/github/Page.java b/src/main/java/io/spring/issuebot/github/Page.java index fca5a07..e04739c 100644 --- a/src/main/java/io/spring/issuebot/github/Page.java +++ b/src/main/java/io/spring/issuebot/github/Page.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,14 +28,12 @@ public interface Page { /** * Returns the next page, if any. - * - * @return The next page or {@code null} + * @return the next page or {@code null} */ Page next(); /** * Returns the contents of the page. - * * @return the contents */ List getContent(); diff --git a/src/main/java/io/spring/issuebot/github/PullRequest.java b/src/main/java/io/spring/issuebot/github/PullRequest.java index dbfb349..1822b15 100644 --- a/src/main/java/io/spring/issuebot/github/PullRequest.java +++ b/src/main/java/io/spring/issuebot/github/PullRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/io/spring/issuebot/github/RegexLinkParser.java b/src/main/java/io/spring/issuebot/github/RegexLinkParser.java index a987302..b4dab1a 100644 --- a/src/main/java/io/spring/issuebot/github/RegexLinkParser.java +++ b/src/main/java/io/spring/issuebot/github/RegexLinkParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/java/io/spring/issuebot/github/StandardPage.java b/src/main/java/io/spring/issuebot/github/StandardPage.java index 803f136..53df8fd 100644 --- a/src/main/java/io/spring/issuebot/github/StandardPage.java +++ b/src/main/java/io/spring/issuebot/github/StandardPage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,6 @@ public class StandardPage implements Page { * Creates a new {@code StandardPage} that has the given {@code content}. The given * {@code nextSupplier} will be used to obtain the next page {@link #next when * requested}. - * * @param content the content * @param nextSupplier the supplier of the next page */ diff --git a/src/main/java/io/spring/issuebot/github/User.java b/src/main/java/io/spring/issuebot/github/User.java index 7df3b76..df3da2a 100644 --- a/src/main/java/io/spring/issuebot/github/User.java +++ b/src/main/java/io/spring/issuebot/github/User.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ public class User { /** * Creates a new {@code User} with the given login. - * * @param login the login */ @JsonCreator diff --git a/src/main/java/io/spring/issuebot/triage/LabelApplyingTriageListener.java b/src/main/java/io/spring/issuebot/triage/LabelApplyingTriageListener.java index 64a79d6..203f565 100644 --- a/src/main/java/io/spring/issuebot/triage/LabelApplyingTriageListener.java +++ b/src/main/java/io/spring/issuebot/triage/LabelApplyingTriageListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,6 @@ final class LabelApplyingTriageListener implements TriageListener { * Creates a new {@code LabelApplyingTriageListener} that will use the given * {@code gitHubOperations} to apply the given {@code label} to any issues that * require triage. - * * @param gitHubOperations the GitHubOperations * @param label the label */ diff --git a/src/main/java/io/spring/issuebot/triage/LabelledTriageFilter.java b/src/main/java/io/spring/issuebot/triage/LabelledTriageFilter.java index f052736..ec922d6 100644 --- a/src/main/java/io/spring/issuebot/triage/LabelledTriageFilter.java +++ b/src/main/java/io/spring/issuebot/triage/LabelledTriageFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,10 @@ package io.spring.issuebot.triage; +import io.spring.issuebot.github.Issue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.spring.issuebot.github.Issue; - /** * A {@link TriageFilter} that considers an issue as having been triaged if any labels * have been applied to it. diff --git a/src/main/java/io/spring/issuebot/triage/MilestoneAppliedTriageFilter.java b/src/main/java/io/spring/issuebot/triage/MilestoneAppliedTriageFilter.java index 7694b99..cead235 100644 --- a/src/main/java/io/spring/issuebot/triage/MilestoneAppliedTriageFilter.java +++ b/src/main/java/io/spring/issuebot/triage/MilestoneAppliedTriageFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,10 @@ package io.spring.issuebot.triage; +import io.spring.issuebot.github.Issue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.spring.issuebot.github.Issue; - /** * A {@link TriageFilter} that considers an issue as having been triaged if a milestone * has been applied to it. diff --git a/src/main/java/io/spring/issuebot/triage/OpenedByCollaboratorTriageFilter.java b/src/main/java/io/spring/issuebot/triage/OpenedByCollaboratorTriageFilter.java index 66377f6..73780f8 100644 --- a/src/main/java/io/spring/issuebot/triage/OpenedByCollaboratorTriageFilter.java +++ b/src/main/java/io/spring/issuebot/triage/OpenedByCollaboratorTriageFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,10 @@ package io.spring.issuebot.triage; import java.util.Collections; import java.util.List; +import io.spring.issuebot.github.Issue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.spring.issuebot.github.Issue; - /** * A {@link TriageFilter} that considers an issue as having been triaged if it was opened * by a collaborator. @@ -38,8 +37,8 @@ final class OpenedByCollaboratorTriageFilter implements TriageFilter { private final List collaborators; OpenedByCollaboratorTriageFilter(List collaborators) { - this.collaborators = collaborators == null ? Collections.emptyList() - : collaborators; + this.collaborators = (collaborators != null) ? collaborators + : Collections.emptyList(); } @Override diff --git a/src/main/java/io/spring/issuebot/triage/TriageConfiguration.java b/src/main/java/io/spring/issuebot/triage/TriageConfiguration.java index ec92263..c9feb37 100644 --- a/src/main/java/io/spring/issuebot/triage/TriageConfiguration.java +++ b/src/main/java/io/spring/issuebot/triage/TriageConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,13 @@ package io.spring.issuebot.triage; import java.util.Arrays; +import io.spring.issuebot.GitHubProperties; +import io.spring.issuebot.github.GitHubOperations; + import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import io.spring.issuebot.GitHubProperties; -import io.spring.issuebot.github.GitHubOperations; - /** * Central configuration for the beans involved in identifying issues that require triage. * @@ -45,4 +45,5 @@ class TriageConfiguration { new LabelApplyingTriageListener(gitHubOperations, triageProperties.getLabel())); } + } diff --git a/src/main/java/io/spring/issuebot/triage/TriageFilter.java b/src/main/java/io/spring/issuebot/triage/TriageFilter.java index 4e04c0a..4be63da 100644 --- a/src/main/java/io/spring/issuebot/triage/TriageFilter.java +++ b/src/main/java/io/spring/issuebot/triage/TriageFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,6 @@ interface TriageFilter { /** * Returns {@code true} if the given issue has already been triaged, otherwise * {@code false}. - * * @param issue the issue * @return {@code true} if the issue has been triaged, {@code false} otherwise */ diff --git a/src/main/java/io/spring/issuebot/triage/TriageIssueListener.java b/src/main/java/io/spring/issuebot/triage/TriageIssueListener.java index e265a53..fed3cb3 100644 --- a/src/main/java/io/spring/issuebot/triage/TriageIssueListener.java +++ b/src/main/java/io/spring/issuebot/triage/TriageIssueListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,6 @@ final class TriageIssueListener implements IssueListener { * Creates a new {@code TriageIssueListener} that will use the given * {@code triageFilters} to identify issues that require triage and notify the given * {@code triageListener} of those that do. - * * @param triageFilters the triage filters * @param triageListener the triage listener */ diff --git a/src/main/java/io/spring/issuebot/triage/TriageListener.java b/src/main/java/io/spring/issuebot/triage/TriageListener.java index 4a31ba2..833aa1d 100644 --- a/src/main/java/io/spring/issuebot/triage/TriageListener.java +++ b/src/main/java/io/spring/issuebot/triage/TriageListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,14 +27,12 @@ interface TriageListener { /** * Notification that the given {@code issue} requires triage. - * * @param issue the issue */ void requiresTriage(Issue issue); /** * Notification that the given {@code issue} does not require triage. - * * @param issue the issue */ void doesNotRequireTriage(Issue issue); diff --git a/src/main/java/io/spring/issuebot/triage/TriageProperties.java b/src/main/java/io/spring/issuebot/triage/TriageProperties.java index 70cd61b..9d93f51 100644 --- a/src/main/java/io/spring/issuebot/triage/TriageProperties.java +++ b/src/main/java/io/spring/issuebot/triage/TriageProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package io.spring.issuebot.triage; import lombok.Getter; import lombok.Setter; + import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/src/test/java/io/spring/issuebot/IssueBotApplicationTests.java b/src/test/java/io/spring/issuebot/IssueBotApplicationTests.java index 904af98..696c0c0 100644 --- a/src/test/java/io/spring/issuebot/IssueBotApplicationTests.java +++ b/src/test/java/io/spring/issuebot/IssueBotApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package io.spring.issuebot; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/src/test/java/io/spring/issuebot/RepositoryMonitorTests.java b/src/test/java/io/spring/issuebot/RepositoryMonitorTests.java index d92ac7a..76f7771 100644 --- a/src/test/java/io/spring/issuebot/RepositoryMonitorTests.java +++ b/src/test/java/io/spring/issuebot/RepositoryMonitorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,11 +18,10 @@ package io.spring.issuebot; import java.util.Arrays; -import org.junit.Test; - import io.spring.issuebot.github.GitHubOperations; import io.spring.issuebot.github.Issue; import io.spring.issuebot.github.Page; +import org.junit.Test; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.willThrow; diff --git a/src/test/java/io/spring/issuebot/feedback/FeedbackIssueListenerTests.java b/src/test/java/io/spring/issuebot/feedback/FeedbackIssueListenerTests.java index 01a1b61..f62bd1f 100644 --- a/src/test/java/io/spring/issuebot/feedback/FeedbackIssueListenerTests.java +++ b/src/test/java/io/spring/issuebot/feedback/FeedbackIssueListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,6 @@ package io.spring.issuebot.feedback; import java.time.OffsetDateTime; import java.util.Arrays; -import org.junit.Test; - import io.spring.issuebot.IssueListener; import io.spring.issuebot.github.Comment; import io.spring.issuebot.github.Event; @@ -30,6 +28,7 @@ import io.spring.issuebot.github.Label; import io.spring.issuebot.github.PullRequest; import io.spring.issuebot.github.StandardPage; import io.spring.issuebot.github.User; +import org.junit.Test; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; diff --git a/src/test/java/io/spring/issuebot/feedback/StandardFeedbackListenerTests.java b/src/test/java/io/spring/issuebot/feedback/StandardFeedbackListenerTests.java index 8efeb59..09810e5 100644 --- a/src/test/java/io/spring/issuebot/feedback/StandardFeedbackListenerTests.java +++ b/src/test/java/io/spring/issuebot/feedback/StandardFeedbackListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,11 @@ import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.Arrays; -import org.junit.Test; - import io.spring.issuebot.IssueListener; import io.spring.issuebot.github.GitHubOperations; import io.spring.issuebot.github.Issue; import io.spring.issuebot.github.Label; +import org.junit.Test; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/src/test/java/io/spring/issuebot/github/GitHubTemplateTests.java b/src/test/java/io/spring/issuebot/github/GitHubTemplateTests.java index b599a37..f7d42cc 100644 --- a/src/test/java/io/spring/issuebot/github/GitHubTemplateTests.java +++ b/src/test/java/io/spring/issuebot/github/GitHubTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import java.util.Date; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; + import org.springframework.core.io.UrlResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -32,13 +33,8 @@ import org.springframework.test.web.client.response.DefaultResponseCreator; import org.springframework.util.Base64Utils; import org.springframework.web.client.RestTemplate; -import static org.hamcrest.Matchers.equalTo; +import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.equalToIgnoringCase; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; import static org.springframework.test.web.client.match.MockRestRequestMatchers.content; import static org.springframework.test.web.client.match.MockRestRequestMatchers.header; import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; @@ -70,8 +66,8 @@ public class GitHubTemplateTests { .andExpect(method(HttpMethod.GET)).andExpect(basicAuth()) .andRespond(withSuccess("[]", MediaType.APPLICATION_JSON)); Page issues = this.gitHub.getIssues("org", "repo"); - assertThat(issues.getContent().size(), is(0)); - assertThat(issues.next(), is(nullValue())); + assertThat(issues.getContent()).isEmpty(); + assertThat(issues.next()).isNull(); } @Test @@ -80,8 +76,8 @@ public class GitHubTemplateTests { .andExpect(method(HttpMethod.GET)).andExpect(basicAuth()) .andRespond(withResource("issues-page-one.json")); Page issues = this.gitHub.getIssues("org", "repo"); - assertThat(issues.getContent().size(), is(15)); - assertThat(issues.next(), is(nullValue())); + assertThat(issues.getContent()).hasSize(15); + assertThat(issues.next()).isNull(); } @Test @@ -95,10 +91,10 @@ public class GitHubTemplateTests { this.server.expect(requestTo("page-two")).andExpect(method(HttpMethod.GET)) .andExpect(basicAuth()).andRespond(withResource("issues-page-two.json")); Page pageOne = this.gitHub.getIssues("org", "repo"); - assertThat(pageOne.getContent().size(), is(15)); + assertThat(pageOne.getContent()).hasSize(15); Page pageTwo = pageOne.next(); - assertThat(pageTwo, is(not(nullValue()))); - assertThat(pageTwo.getContent().size(), is(15)); + assertThat(pageTwo).isNotNull(); + assertThat(pageTwo.getContent()).hasSize(15); } @Test @@ -123,8 +119,8 @@ public class GitHubTemplateTests { .andRespond(withSuccess("[]", MediaType.APPLICATION_JSON)); Page comments = this.gitHub.getComments( new Issue(null, "commentsUrl", null, null, null, null, null, null)); - assertThat(comments.getContent().size(), is(0)); - assertThat(comments.next(), is(nullValue())); + assertThat(comments.getContent()).isEmpty(); + assertThat(comments.next()).isNull(); } @Test @@ -134,8 +130,8 @@ public class GitHubTemplateTests { .andRespond(withResource("comments-page-one.json")); Page comments = this.gitHub.getComments( new Issue(null, "commentsUrl", null, null, null, null, null, null)); - assertThat(comments.getContent().size(), is(17)); - assertThat(comments.next(), is(nullValue())); + assertThat(comments.getContent()).hasSize(17); + assertThat(comments.next()).isNull(); } @Test @@ -150,10 +146,10 @@ public class GitHubTemplateTests { .andRespond(withResource("comments-page-two.json")); Page pageOne = this.gitHub.getComments( new Issue(null, "commentsUrl", null, null, null, null, null, null)); - assertThat(pageOne.getContent().size(), is(17)); + assertThat(pageOne.getContent()).hasSize(17); Page pageTwo = pageOne.next(); - assertThat(pageTwo, is(not(nullValue()))); - assertThat(pageTwo.getContent().size(), is(3)); + assertThat(pageTwo).isNotNull(); + assertThat(pageTwo.getContent()).hasSize(3); } @Test @@ -165,7 +161,7 @@ public class GitHubTemplateTests { Issue issue = new Issue("issueUrl", null, null, "labelsUrl{/name}", null, null, null, null); Issue modifiedIssue = this.gitHub.addLabel(issue, "test"); - assertThat(modifiedIssue.getLabels(), hasSize(1)); + assertThat(modifiedIssue.getLabels()).hasSize(1); } @Test @@ -176,18 +172,18 @@ public class GitHubTemplateTests { Issue issue = new Issue(null, null, null, "labels{/name}", null, null, null, null); Issue modifiedIssue = this.gitHub.removeLabel(issue, "test"); - assertThat(modifiedIssue.getLabels(), hasSize(0)); + assertThat(modifiedIssue.getLabels()).isEmpty(); } @Test public void removeLabelWithNameThatRequiresEncodingFromIssue() { - this.server.expect(requestTo("labels/status:%20foo")).andExpect(method(HttpMethod.DELETE)) - .andExpect(basicAuth()) + this.server.expect(requestTo("labels/status:%20foo")) + .andExpect(method(HttpMethod.DELETE)).andExpect(basicAuth()) .andRespond(withSuccess("[]", MediaType.APPLICATION_JSON)); Issue issue = new Issue(null, null, null, "labels{/name}", null, null, null, null); Issue modifiedIssue = this.gitHub.removeLabel(issue, "status: foo"); - assertThat(modifiedIssue.getLabels(), hasSize(0)); + assertThat(modifiedIssue.getLabels()).isEmpty(); } @Test @@ -198,7 +194,7 @@ public class GitHubTemplateTests { .andRespond(withResource("new-comment.json")); Issue issue = new Issue(null, "commentsUrl", null, null, null, null, null, null); Comment comment = this.gitHub.addComment(issue, "A test comment"); - assertThat(comment, is(not(nullValue()))); + assertThat(comment).isNotNull(); } @Test @@ -207,8 +203,8 @@ public class GitHubTemplateTests { .andExpect(basicAuth()).andRespond(withResource("events-page-one.json")); Page events = this.gitHub.getEvents( new Issue(null, null, "eventsUrl", null, null, null, null, null)); - assertThat(events.getContent().size(), is(12)); - assertThat(events.next(), is(nullValue())); + assertThat(events.getContent()).hasSize(12); + assertThat(events.next()).isNull(); } @Test @@ -222,10 +218,10 @@ public class GitHubTemplateTests { .andExpect(basicAuth()).andRespond(withResource("events-page-two.json")); Page pageOne = this.gitHub.getEvents( new Issue(null, null, "eventsUrl", null, null, null, null, null)); - assertThat(pageOne.getContent().size(), is(12)); + assertThat(pageOne.getContent()).hasSize(12); Page pageTwo = pageOne.next(); - assertThat(pageTwo, is(not(nullValue()))); - assertThat(pageTwo.getContent().size(), is(3)); + assertThat(pageTwo).isNotNull(); + assertThat(pageTwo.getContent()).hasSize(3); } @Test @@ -237,7 +233,7 @@ public class GitHubTemplateTests { MediaType.APPLICATION_JSON)); Issue closedIssue = this.gitHub .close(new Issue("issueUrl", null, null, null, null, null, null, null)); - assertThat(closedIssue.getUrl(), is(equalTo("updatedIssueUrl"))); + assertThat(closedIssue.getUrl()).isEqualTo("updatedIssueUrl"); } private DefaultResponseCreator withResource(String resource, String... headers) { diff --git a/src/test/java/io/spring/issuebot/github/RegexLinkParserTests.java b/src/test/java/io/spring/issuebot/github/RegexLinkParserTests.java index 2b941bd..a843211 100644 --- a/src/test/java/io/spring/issuebot/github/RegexLinkParserTests.java +++ b/src/test/java/io/spring/issuebot/github/RegexLinkParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,7 @@ import java.util.Map; import org.junit.Test; -import static org.hamcrest.Matchers.hasEntry; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * Tests for {@link RegexLinkParser}. @@ -35,34 +33,34 @@ public class RegexLinkParserTests { @Test public void emptyInput() { - assertThat(this.linkParser.parse("").size(), is(0)); + assertThat(this.linkParser.parse("")).isEmpty(); } @Test public void nullInput() { - assertThat(this.linkParser.parse(null).size(), is(0)); + assertThat(this.linkParser.parse(null)).isEmpty(); } @Test public void singleLink() { Map links = this.linkParser.parse("; rel=\"foo\""); - assertThat(links.size(), is(1)); - assertThat(links, hasEntry("foo", "url")); + assertThat(links).hasSize(1); + assertThat(links).containsEntry("foo", "url"); } @Test public void notALink() { Map links = this.linkParser.parse("; foo bar"); - assertThat(links.size(), is(0)); + assertThat(links).isEmpty(); } @Test public void multipleLinks() { Map links = this.linkParser .parse("; rel=\"foo\", ; rel=\"bar\""); - assertThat(links.size(), is(2)); - assertThat(links, hasEntry("foo", "url-one")); - assertThat(links, hasEntry("bar", "url-two")); + assertThat(links).hasSize(2); + assertThat(links).containsEntry("foo", "url-one"); + assertThat(links).containsEntry("bar", "url-two"); } } diff --git a/src/test/java/io/spring/issuebot/triage/LabelApplyingTriageListenerTests.java b/src/test/java/io/spring/issuebot/triage/LabelApplyingTriageListenerTests.java index 1ee0e07..7ac09f9 100644 --- a/src/test/java/io/spring/issuebot/triage/LabelApplyingTriageListenerTests.java +++ b/src/test/java/io/spring/issuebot/triage/LabelApplyingTriageListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,9 @@ package io.spring.issuebot.triage; -import org.junit.Test; - import io.spring.issuebot.github.GitHubOperations; import io.spring.issuebot.github.Issue; +import org.junit.Test; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/src/test/java/io/spring/issuebot/triage/LabelledTriageFilterTests.java b/src/test/java/io/spring/issuebot/triage/LabelledTriageFilterTests.java index a489e89..982aafb 100644 --- a/src/test/java/io/spring/issuebot/triage/LabelledTriageFilterTests.java +++ b/src/test/java/io/spring/issuebot/triage/LabelledTriageFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,11 @@ package io.spring.issuebot.triage; import java.util.Arrays; import java.util.Collections; -import org.junit.Test; - import io.spring.issuebot.github.Issue; import io.spring.issuebot.github.Label; +import org.junit.Test; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * Tests for {@link LabelledTriageFilter}. @@ -39,21 +37,20 @@ public class LabelledTriageFilterTests { @Test public void issueWithLabels() { assertThat(this.filter.triaged(new Issue(null, null, null, null, null, - Arrays.asList(new Label("test")), null, null)), is(true)); + Arrays.asList(new Label("test")), null, null))).isTrue(); } @Test public void issueWithNullLabels() { - assertThat( - this.filter.triaged( - new Issue(null, null, null, null, null, null, null, null)), - is(false)); + assertThat(this.filter + .triaged(new Issue(null, null, null, null, null, null, null, null))) + .isFalse(); } @Test public void issueWithNoLabels() { assertThat(this.filter.triaged(new Issue(null, null, null, null, null, - Collections.emptyList(), null, null)), is(false)); + Collections.emptyList(), null, null))).isFalse(); } } diff --git a/src/test/java/io/spring/issuebot/triage/MilestoneAppliedTriageFilterTests.java b/src/test/java/io/spring/issuebot/triage/MilestoneAppliedTriageFilterTests.java index 8f411c9..2e1ae58 100644 --- a/src/test/java/io/spring/issuebot/triage/MilestoneAppliedTriageFilterTests.java +++ b/src/test/java/io/spring/issuebot/triage/MilestoneAppliedTriageFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,11 @@ package io.spring.issuebot.triage; -import org.junit.Test; - import io.spring.issuebot.github.Issue; import io.spring.issuebot.github.Milestone; +import org.junit.Test; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * Tests for {@link MilestoneAppliedTriageFilter}. @@ -37,15 +35,14 @@ public class MilestoneAppliedTriageFilterTests { @Test public void issueWithMilestoneApplied() { assertThat(this.filter.triaged(new Issue(null, null, null, null, null, null, - new Milestone("test"), null)), is(true)); + new Milestone("test"), null))).isTrue(); } @Test public void issueWithNoMilestoneApplied() { - assertThat( - this.filter.triaged( - new Issue(null, null, null, null, null, null, null, null)), - is(false)); + assertThat(this.filter + .triaged(new Issue(null, null, null, null, null, null, null, null))) + .isFalse(); } } diff --git a/src/test/java/io/spring/issuebot/triage/OpenedByCollaboratorTriageFilterTests.java b/src/test/java/io/spring/issuebot/triage/OpenedByCollaboratorTriageFilterTests.java index 7056082..92d44c3 100644 --- a/src/test/java/io/spring/issuebot/triage/OpenedByCollaboratorTriageFilterTests.java +++ b/src/test/java/io/spring/issuebot/triage/OpenedByCollaboratorTriageFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,11 @@ package io.spring.issuebot.triage; import java.util.Arrays; -import org.junit.Test; - import io.spring.issuebot.github.Issue; import io.spring.issuebot.github.User; +import org.junit.Test; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; /** * Tests for {@link OpenedByCollaboratorTriageFilter}. @@ -39,15 +37,15 @@ public class OpenedByCollaboratorTriageFilterTests { @Test public void openedByCollaborator() { assertThat(this.filter.triaged( - new Issue(null, null, null, null, new User("Adam"), null, null, null)), - is(true)); + new Issue(null, null, null, null, new User("Adam"), null, null, null))) + .isTrue(); } @Test public void openedByAnotherUser() { assertThat(this.filter.triaged( - new Issue(null, null, null, null, new User("Debbie"), null, null, null)), - is(false)); + new Issue(null, null, null, null, new User("Debbie"), null, null, null))) + .isFalse(); } } diff --git a/src/test/java/io/spring/issuebot/triage/TriageIssueListenerTests.java b/src/test/java/io/spring/issuebot/triage/TriageIssueListenerTests.java index 533257b..1e60a93 100644 --- a/src/test/java/io/spring/issuebot/triage/TriageIssueListenerTests.java +++ b/src/test/java/io/spring/issuebot/triage/TriageIssueListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,9 @@ package io.spring.issuebot.triage; import java.util.Arrays; -import org.junit.Test; - import io.spring.issuebot.IssueListener; import io.spring.issuebot.github.Issue; +import org.junit.Test; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock;