Adopt Spring Java Format
This commit is contained in:
50
pom.xml
50
pom.xml
@@ -60,30 +60,43 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.spring.javaformat</groupId>
|
||||
<artifactId>spring-javaformat-maven-plugin</artifactId>
|
||||
<version>0.0.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<inherited>true</inherited>
|
||||
<goals>
|
||||
<goal>validate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.16</version>
|
||||
<version>3.0.0</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>6.10.1</version>
|
||||
<version>8.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.spring.javaformat</groupId>
|
||||
<artifactId>spring-javaformat-checkstyle</artifactId>
|
||||
<version>0.0.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>checkstyle-validation</id>
|
||||
<phase>validate</phase>
|
||||
<inherited>true</inherited>
|
||||
<configuration>
|
||||
<skip>${disable.checks}</skip>
|
||||
<configLocation>config/checkstyle/checkstyle.xml</configLocation>
|
||||
<suppressionsLocation>config/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
|
||||
<headerLocation>config/checkstyle/checkstyle-header.txt</headerLocation>
|
||||
<propertyExpansion>checkstyle.build.directory=${project.build.directory}</propertyExpansion>
|
||||
<encoding>UTF-8</encoding>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<failsOnError>true</failsOnError>
|
||||
<configLocation>io/spring/javaformat/checkstyle/checkstyle.xml</configLocation>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
@@ -92,23 +105,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<configuration>
|
||||
<useProjectReferences>false</useProjectReferences>
|
||||
<additionalConfig>
|
||||
<file>
|
||||
<name>.settings/org.eclipse.jdt.ui.prefs</name>
|
||||
<location>${basedir}/config/eclipse/org.eclipse.jdt.ui.prefs</location>
|
||||
</file>
|
||||
<file>
|
||||
<name>.settings/org.eclipse.jdt.core.prefs</name>
|
||||
<location>${basedir}/config/eclipse/org.eclipse.jdt.core.prefs</location>
|
||||
</file>
|
||||
</additionalConfig>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<T> {
|
||||
|
||||
/**
|
||||
* Returns the next page, if any.
|
||||
*
|
||||
* @return The next page or {@code null}
|
||||
* @return the next page or {@code null}
|
||||
*/
|
||||
Page<T> next();
|
||||
|
||||
/**
|
||||
* Returns the contents of the page.
|
||||
*
|
||||
* @return the contents
|
||||
*/
|
||||
List<T> getContent();
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<T> implements Page<T> {
|
||||
* 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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<String> collaborators;
|
||||
|
||||
OpenedByCollaboratorTriageFilter(List<String> collaborators) {
|
||||
this.collaborators = collaborators == null ? Collections.emptyList()
|
||||
: collaborators;
|
||||
this.collaborators = (collaborators != null) ? collaborators
|
||||
: Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<Issue> 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<Issue> 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<Issue> pageOne = this.gitHub.getIssues("org", "repo");
|
||||
assertThat(pageOne.getContent().size(), is(15));
|
||||
assertThat(pageOne.getContent()).hasSize(15);
|
||||
Page<Issue> 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<Comment> 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<Comment> 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<Comment> 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<Comment> 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<Event> 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<Event> 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<Event> 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) {
|
||||
|
||||
@@ -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<String, String> links = this.linkParser.parse("<url>; 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<String, String> links = this.linkParser.parse("<url>; foo bar");
|
||||
assertThat(links.size(), is(0));
|
||||
assertThat(links).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleLinks() {
|
||||
Map<String, String> links = this.linkParser
|
||||
.parse("<url-one>; rel=\"foo\", <url-two>; 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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user