#145 - Migrate unit tests to JUnit 5 and AssertJ.
This commit is contained in:
@@ -18,7 +18,7 @@ package org.springframework.data.microbenchmark.r2dbc;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Value;
|
||||
import lombok.experimental.Wither;
|
||||
import lombok.With;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
@@ -30,12 +30,12 @@ import org.springframework.data.annotation.PersistenceConstructor;
|
||||
@RequiredArgsConstructor(access = AccessLevel.PACKAGE, onConstructor = @__(@PersistenceConstructor))
|
||||
class Book {
|
||||
|
||||
@Wither(AccessLevel.PACKAGE) @Id Long id;
|
||||
@With(AccessLevel.PACKAGE) @Id Long id;
|
||||
String title;
|
||||
int pages;
|
||||
|
||||
|
||||
public Book(String title, int pages) {
|
||||
|
||||
|
||||
this.id = null;
|
||||
this.title = title;
|
||||
this.pages = pages;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-release-cli</artifactId>
|
||||
@@ -96,7 +96,7 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit</artifactId>
|
||||
<version>5.7.0.202003110725-r</version>
|
||||
<version>5.6.0.201912101111-r</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -120,7 +120,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.tomakehurst</groupId>
|
||||
<artifactId>wiremock</artifactId>
|
||||
<version>1.58</version>
|
||||
<version>2.26.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -119,10 +119,9 @@ class GitCommands extends TimedCommand {
|
||||
public void backportChangelogs(@CliOption(key = "", mandatory = true) TrainIteration iteration, //
|
||||
@CliOption(key = "target") String trains) {
|
||||
|
||||
List<Train> targets = trains == null ? Collections.emptyList()
|
||||
: Stream.of(trains.split(",")).//
|
||||
map(it -> ReleaseTrains.getTrainByName(it)).//
|
||||
collect(Collectors.toList());
|
||||
List<Train> targets = trains == null ? Collections.emptyList() : Stream.of(trains.split(",")).//
|
||||
map(it -> ReleaseTrains.getTrainByName(it)).//
|
||||
collect(Collectors.toList());
|
||||
|
||||
git.backportChangelogs(iteration, targets);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Tickets implements Streamable<Ticket> {
|
||||
public Ticket getReleaseTicket(ModuleIteration moduleIteration) {
|
||||
|
||||
return findReleaseTicket(moduleIteration).orElseThrow(
|
||||
() -> new IllegalStateException(String.format("Did not find a release ticket for %s!", moduleIteration)));
|
||||
() -> new IllegalArgumentException(String.format("Did not find a release ticket for %s!", moduleIteration)));
|
||||
}
|
||||
|
||||
public Tickets getIssueTickets(ModuleIteration moduleIteration) {
|
||||
|
||||
@@ -530,7 +530,7 @@ class GitHub implements IssueTracker {
|
||||
Optional<Milestone> milestone = findMilestone(moduleIteration, repositoryName);
|
||||
|
||||
return milestone
|
||||
.orElseThrow(() -> new IllegalStateException(String.format("No milestone for %s found containing %s!", //
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format("No milestone for %s found containing %s!", //
|
||||
moduleIteration.getProject().getFullName(), //
|
||||
moduleIteration.getShortVersionString())));
|
||||
}
|
||||
|
||||
@@ -15,15 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.release;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@ActiveProfiles({ "local", "test" })
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = Application.class)
|
||||
public abstract class AbstractIntegrationTests {}
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package org.springframework.data.release;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ApplicationTests extends AbstractIntegrationTests {
|
||||
class ApplicationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void bootstrapsApplication() {}
|
||||
void bootstrapsApplication() {}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.release;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.build.MavenArtifact;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
@@ -28,15 +28,15 @@ import org.springframework.data.release.model.ReleaseTrains;
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ArtifactUnitTests {
|
||||
class ArtifactUnitTests {
|
||||
|
||||
@Test
|
||||
public void testname() {
|
||||
void testname() {
|
||||
|
||||
MavenArtifact artifact = new MavenArtifact(ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.JPA, Iteration.M1));
|
||||
|
||||
assertThat(artifact.getArtifactId(), is("spring-data-jpa"));
|
||||
assertThat(artifact.getVersion(), is(ArtifactVersion.of("1.6.0.M1")));
|
||||
assertThat(artifact.getNextDevelopmentVersion(), is(ArtifactVersion.of("1.6.0.BUILD-SNAPSHOT")));
|
||||
assertThat(artifact.getArtifactId()).isEqualTo("spring-data-jpa");
|
||||
assertThat(artifact.getVersion()).isEqualTo(ArtifactVersion.of("1.6.0.M1"));
|
||||
assertThat(artifact.getNextDevelopmentVersion()).isEqualTo(ArtifactVersion.of("1.6.0.BUILD-SNAPSHOT"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2020 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.release;
|
||||
|
||||
import org.junit.jupiter.api.extension.AfterEachCallback;
|
||||
import org.junit.jupiter.api.extension.BeforeEachCallback;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
|
||||
import com.github.tomakehurst.wiremock.WireMockServer;
|
||||
import com.github.tomakehurst.wiremock.client.WireMock;
|
||||
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class WireMockExtension extends WireMockServer implements BeforeEachCallback, AfterEachCallback {
|
||||
|
||||
private final WireMockConfiguration configuration;
|
||||
|
||||
public WireMockExtension(WireMockConfiguration configuration) {
|
||||
super(configuration);
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeEach(ExtensionContext context) {
|
||||
WireMock.configureFor(configuration.portNumber());
|
||||
this.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterEach(ExtensionContext context) {
|
||||
this.stop();
|
||||
this.resetAll();
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.release.build;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.build.CommandLine.Argument;
|
||||
import org.springframework.data.release.model.Password;
|
||||
|
||||
@@ -26,34 +26,35 @@ import org.springframework.data.release.model.Password;
|
||||
* Unit tests for {@link Argument}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class ArgumentUnitTest {
|
||||
class ArgumentUnitTest {
|
||||
|
||||
@Test
|
||||
public void masksMaskedForToString() {
|
||||
void masksMaskedForToString() {
|
||||
|
||||
Argument argument = Argument.of("password").withValue(Password.of("password"));
|
||||
|
||||
assertThat(argument.toCommandLineArgument(), is("password=password"));
|
||||
assertThat(argument.toString(), startsWith("password=********"));
|
||||
assertThat(argument.toCommandLineArgument()).isEqualTo("password=password");
|
||||
assertThat(argument.toString()).startsWith("password=********");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quotesValue() {
|
||||
void quotesValue() {
|
||||
|
||||
Argument argument = Argument.of("quoted").withQuotedValue("value");
|
||||
|
||||
assertThat(argument.toCommandLineArgument(), is("quoted=\"value\""));
|
||||
assertThat(argument.toCommandLineArgument()).isEqualTo("quoted=\"value\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void argCreatesJvmArgument() {
|
||||
assertThat(Argument.arg("foo").toCommandLineArgument(), is("-Dfoo"));
|
||||
void argCreatesJvmArgument() {
|
||||
assertThat(Argument.arg("foo").toCommandLineArgument()).isEqualTo("-Dfoo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void profileCreatesMavenProfile() {
|
||||
assertThat(Argument.profile("foo").toCommandLineArgument(), is("-Pfoo"));
|
||||
assertThat(Argument.profile("foo", "bar").toCommandLineArgument(), is("-Pfoo,bar"));
|
||||
void profileCreatesMavenProfile() {
|
||||
assertThat(Argument.profile("foo").toCommandLineArgument()).isEqualTo("-Pfoo");
|
||||
assertThat(Argument.profile("foo", "bar").toCommandLineArgument()).isEqualTo("-Pfoo,bar");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,9 @@ import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
@@ -32,6 +33,7 @@ import org.springframework.data.release.git.GitOperations;
|
||||
import org.springframework.data.release.io.Workspace;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
|
||||
import org.xmlbeam.ProjectionFactory;
|
||||
import org.xmlbeam.evaluation.XPathEvaluator;
|
||||
import org.xmlbeam.io.XBFileIO;
|
||||
@@ -40,15 +42,15 @@ import org.xmlbeam.io.XBFileIO;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired Workspace workspace;
|
||||
@Autowired ProjectionFactory projection;
|
||||
@Autowired MavenBuildSystem maven;
|
||||
@Autowired GitOperations git;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
@BeforeAll
|
||||
static void beforeClass() {
|
||||
|
||||
try {
|
||||
URL url = new URL("https://github.com");
|
||||
@@ -61,7 +63,7 @@ public class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void modifiesParentPomCorrectly() throws IOException {
|
||||
void modifiesParentPomCorrectly() throws IOException {
|
||||
|
||||
XBFileIO io = projection.io().file(new ClassPathResource("parent-pom.xml").getFile());
|
||||
|
||||
@@ -77,7 +79,7 @@ public class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updatesRepositoriesCorrectly() throws Exception {
|
||||
void updatesRepositoriesCorrectly() throws Exception {
|
||||
|
||||
XBFileIO io = projection.io().file(new ClassPathResource("sample-pom.xml").getFile());
|
||||
|
||||
@@ -90,7 +92,7 @@ public class MavenIntegrationTests extends AbstractIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findsSnapshotDependencies() throws Exception {
|
||||
void findsSnapshotDependencies() throws Exception {
|
||||
|
||||
Pom pom = projection.io().file(workspace.getFile("bom/pom.xml", Projects.BUILD)).read(Pom.class);
|
||||
|
||||
|
||||
@@ -15,25 +15,24 @@
|
||||
*/
|
||||
package org.springframework.data.release.build;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link MavenProperties}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class MavenPropertiesUnitTests {
|
||||
class MavenPropertiesUnitTests {
|
||||
|
||||
MavenProperties properties;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
this.properties = new MavenProperties();
|
||||
this.properties.setPlugins(Collections.singletonMap("versions", "org.codehaus.mojo:versions-maven-plugin:2.2"));
|
||||
@@ -43,25 +42,25 @@ public class MavenPropertiesUnitTests {
|
||||
* @see #8
|
||||
*/
|
||||
@Test
|
||||
public void expandsGoalsCorrectly() {
|
||||
void expandsGoalsCorrectly() {
|
||||
|
||||
assertThat(properties.getFullyQualifiedPlugin("versions:set"),
|
||||
is("org.codehaus.mojo:versions-maven-plugin:2.2:set"));
|
||||
assertThat(properties.getFullyQualifiedPlugin("versions:set"))
|
||||
.isEqualTo("org.codehaus.mojo:versions-maven-plugin:2.2:set");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #8
|
||||
*/
|
||||
@Test
|
||||
public void doesNotExpandGoalStartingWithDash() {
|
||||
assertThat(properties.getFullyQualifiedPlugin("-versions:set"), is("-versions:set"));
|
||||
void doesNotExpandGoalStartingWithDash() {
|
||||
assertThat(properties.getFullyQualifiedPlugin("-versions:set")).isEqualTo("-versions:set");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #8
|
||||
*/
|
||||
@Test
|
||||
public void doesNotExpandGoalWithoutColon() {
|
||||
assertThat(properties.getFullyQualifiedPlugin("versions-set"), is("versions-set"));
|
||||
void doesNotExpandGoalWithoutColon() {
|
||||
assertThat(properties.getFullyQualifiedPlugin("versions-set")).isEqualTo("versions-set");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
*/
|
||||
package org.springframework.data.release.build;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.Phase;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
@@ -31,57 +32,59 @@ import org.springframework.data.release.model.TrainIteration;
|
||||
* Unit tests for {@link UpdateInformation}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class UpdateInformationUnitTests {
|
||||
class UpdateInformationUnitTests {
|
||||
|
||||
TrainIteration hopperM1 = new TrainIteration(ReleaseTrains.HOPPER, Iteration.M1);
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsNullTrainIteration() {
|
||||
UpdateInformation.of(null, Phase.CLEANUP);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsNullPhase() {
|
||||
UpdateInformation.of(hopperM1, null);
|
||||
@Test
|
||||
void rejectsNullTrainIteration() {
|
||||
Assertions.assertThatIllegalArgumentException().isThrownBy(() -> UpdateInformation.of(null, Phase.CLEANUP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exposesMilestoneRepositoryForMilestone() {
|
||||
assertThat(UpdateInformation.of(hopperM1, Phase.PREPARE).getRepository().getId(), is("spring-libs-milestone"));
|
||||
void rejectsNullPhase() {
|
||||
Assertions.assertThatIllegalArgumentException().isThrownBy(() -> UpdateInformation.of(hopperM1, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exposesReleaseRepositoryForGA() {
|
||||
void exposesMilestoneRepositoryForMilestone() {
|
||||
assertThat(UpdateInformation.of(hopperM1, Phase.PREPARE).getRepository().getId())
|
||||
.isEqualTo("spring-libs-milestone");
|
||||
}
|
||||
|
||||
@Test
|
||||
void exposesReleaseRepositoryForGA() {
|
||||
|
||||
Arrays.asList(Iteration.GA, Iteration.SR1).forEach(iteration -> {
|
||||
TrainIteration trainIteration = new TrainIteration(ReleaseTrains.HOPPER, iteration);
|
||||
assertThat(UpdateInformation.of(trainIteration, Phase.PREPARE).getRepository().getId(),
|
||||
is("spring-libs-release"));
|
||||
assertThat(UpdateInformation.of(trainIteration, Phase.PREPARE).getRepository().getId())
|
||||
.isEqualTo("spring-libs-release");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void calculatesProjectVersionToSetCorrectly() {
|
||||
void calculatesProjectVersionToSetCorrectly() {
|
||||
|
||||
UpdateInformation updateInformation = UpdateInformation.of(hopperM1, Phase.PREPARE);
|
||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString(), is("1.10.0.M1"));
|
||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString()).isEqualTo("1.10.0.M1");
|
||||
|
||||
updateInformation = UpdateInformation.of(hopperM1, Phase.CLEANUP);
|
||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString(), is("1.10.0.BUILD-SNAPSHOT"));
|
||||
assertThat(updateInformation.getProjectVersionToSet(Projects.JPA).toString()).isEqualTo("1.10.0.BUILD-SNAPSHOT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #22
|
||||
*/
|
||||
@Test
|
||||
public void returnsCorrectReleaseTrainVersions() {
|
||||
void returnsCorrectReleaseTrainVersions() {
|
||||
|
||||
TrainIteration hopperGa = new TrainIteration(ReleaseTrains.HOPPER, Iteration.GA);
|
||||
TrainIteration hopperSr1 = new TrainIteration(ReleaseTrains.HOPPER, Iteration.SR1);
|
||||
|
||||
assertThat(UpdateInformation.of(hopperGa, Phase.PREPARE).getReleaseTrainVersion(), is("Hopper-RELEASE"));
|
||||
assertThat(UpdateInformation.of(hopperM1, Phase.PREPARE).getReleaseTrainVersion(), is("Hopper-M1"));
|
||||
assertThat(UpdateInformation.of(hopperSr1, Phase.PREPARE).getReleaseTrainVersion(), is("Hopper-SR1"));
|
||||
assertThat(UpdateInformation.of(hopperGa, Phase.PREPARE).getReleaseTrainVersion()).isEqualTo("Hopper-RELEASE");
|
||||
assertThat(UpdateInformation.of(hopperM1, Phase.PREPARE).getReleaseTrainVersion()).isEqualTo("Hopper-M1");
|
||||
assertThat(UpdateInformation.of(hopperSr1, Phase.PREPARE).getReleaseTrainVersion()).isEqualTo("Hopper-SR1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,16 +15,17 @@
|
||||
*/
|
||||
package org.springframework.data.release.cli;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.git.GitOperations;
|
||||
@@ -33,13 +34,14 @@ import org.springframework.data.release.model.ReleaseTrains;
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ReleaseCommandsIntegrationTests extends AbstractIntegrationTests {
|
||||
@Disabled("Skip GitHub interaction")
|
||||
class ReleaseCommandsIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired ReleaseCommands releaseCommands;
|
||||
@Autowired GitOperations git;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
@BeforeAll
|
||||
static void beforeClass() {
|
||||
|
||||
try {
|
||||
URL url = new URL("https://github.com");
|
||||
@@ -52,10 +54,10 @@ public class ReleaseCommandsIntegrationTests extends AbstractIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void predictsReleaseTrainCorrectly() throws Exception {
|
||||
void predictsReleaseTrainCorrectly() throws Exception {
|
||||
|
||||
git.update(ReleaseTrains.MOORE);
|
||||
|
||||
assertThat(releaseCommands.predictTrainAndIteration(), is("Neumann"));
|
||||
assertThat(releaseCommands.predictTrainAndIteration()).isEqualTo("Neumann");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.release.deployment;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
@@ -32,20 +32,20 @@ import org.springframework.data.release.model.TrainIteration;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class DeploymentInformationIntegrationTests extends AbstractIntegrationTests {
|
||||
class DeploymentInformationIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired DeploymentProperties properties;
|
||||
|
||||
@Test
|
||||
public void createsDeploymentInformation() {
|
||||
void createsDeploymentInformation() {
|
||||
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.HOPPER, Iteration.M1);
|
||||
ModuleIteration buildModule = iteration.getModule(Projects.BUILD);
|
||||
|
||||
DeploymentInformation information = new DefaultDeploymentInformation(buildModule, properties);
|
||||
|
||||
assertThat(information.getDeploymentTargetUrl(), containsString(properties.getServer().getUri().toString()));
|
||||
assertThat(information.getBuildName(), is("Spring Data Build - Release"));
|
||||
assertThat(information.getTargetRepository(), is("test-libs-milestone-local"));
|
||||
assertThat(information.getDeploymentTargetUrl()).contains(properties.getServer().getUri().toString());
|
||||
assertThat(information.getBuildName()).isEqualTo("Spring Data Build - Release");
|
||||
assertThat(information.getTargetRepository()).isEqualTo("test-libs-milestone-local");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.release.deployment;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.build.BuildOperations;
|
||||
@@ -31,8 +32,8 @@ import org.springframework.data.release.model.Train;
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Ignore("I will deploy an artifact")
|
||||
public class DeploymentOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
@Disabled("I will deploy an artifact")
|
||||
class DeploymentOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired GitOperations git;
|
||||
@Autowired BuildOperations build;
|
||||
@@ -40,7 +41,7 @@ public class DeploymentOperationsIntegrationTests extends AbstractIntegrationTes
|
||||
@Autowired ArtifactoryClient client;
|
||||
|
||||
@Test
|
||||
public void testname() {
|
||||
void testname() {
|
||||
|
||||
Train train = ReleaseTrains.HOPPER;
|
||||
ModuleIteration buildModule = train.getModuleIteration(Projects.BUILD, Iteration.M1);
|
||||
|
||||
@@ -17,7 +17,7 @@ package org.springframework.data.release.deployment;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
@@ -29,10 +29,10 @@ import org.springframework.data.release.utils.Logger;
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class DeploymentOperationsUnitTests {
|
||||
class DeploymentOperationsUnitTests {
|
||||
|
||||
@Test // #113
|
||||
public void skipsPromotionForPublicArtifacts() {
|
||||
void skipsPromotionForPublicArtifacts() {
|
||||
|
||||
Logger logger = mock(Logger.class);
|
||||
ArtifactoryClient client = mock(ArtifactoryClient.class);
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.release.git;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
@@ -33,7 +33,7 @@ import org.springframework.data.release.model.TrainIteration;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class BackportTargetsUnitTests {
|
||||
class BackportTargetsUnitTests {
|
||||
|
||||
Branch goslingBranch = getBranch(ReleaseTrains.GOSLING);
|
||||
Branch fowlerBranch = getBranch(ReleaseTrains.FOWLER);
|
||||
@@ -42,30 +42,30 @@ public class BackportTargetsUnitTests {
|
||||
* @see #11
|
||||
*/
|
||||
@Test
|
||||
public void returnsModuleBranchesForTrains() {
|
||||
void returnsModuleBranchesForTrains() {
|
||||
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.HOPPER, Iteration.M1);
|
||||
ModuleIteration module = iteration.getModule(Projects.COMMONS);
|
||||
|
||||
BackportTargets targets = new BackportTargets(module, Arrays.asList(ReleaseTrains.GOSLING, ReleaseTrains.FOWLER));
|
||||
|
||||
assertThat(targets, is(iterableWithSize(2)));
|
||||
assertThat(targets, hasItems(goslingBranch, fowlerBranch));
|
||||
assertThat(targets).hasSize(2);
|
||||
assertThat(targets).contains(goslingBranch, fowlerBranch);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #11
|
||||
*/
|
||||
@Test
|
||||
public void includesMasterBranchForServiceReleaseSource() {
|
||||
void includesMasterBranchForServiceReleaseSource() {
|
||||
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.GOSLING, Iteration.SR2);
|
||||
ModuleIteration module = iteration.getModule(Projects.COMMONS);
|
||||
|
||||
BackportTargets targets = new BackportTargets(module, Arrays.asList(ReleaseTrains.FOWLER));
|
||||
|
||||
assertThat(targets, is(iterableWithSize(2)));
|
||||
assertThat(targets, hasItems(Branch.MASTER, fowlerBranch));
|
||||
assertThat(targets).hasSize(2);
|
||||
assertThat(targets).contains(Branch.MASTER, fowlerBranch);
|
||||
}
|
||||
|
||||
private static Branch getBranch(Train train) {
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.release.git;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.IterationVersion;
|
||||
import org.springframework.data.release.model.SimpleIterationVersion;
|
||||
@@ -28,31 +28,31 @@ import org.springframework.data.release.model.Version;
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class BranchUnitTests {
|
||||
class BranchUnitTests {
|
||||
|
||||
@Test
|
||||
public void testname() {
|
||||
void testname() {
|
||||
|
||||
IterationVersion iterationVersion = new SimpleIterationVersion(Version.of(1, 4), Iteration.RC1);
|
||||
assertThat(Branch.from(iterationVersion).toString(), is("master"));
|
||||
assertThat(Branch.from(iterationVersion).toString()).isEqualTo("master");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsBugfixBranchForServiceRelease() {
|
||||
void createsBugfixBranchForServiceRelease() {
|
||||
|
||||
IterationVersion iterationVersion = new SimpleIterationVersion(Version.of(1, 4), Iteration.SR1);
|
||||
assertThat(Branch.from(iterationVersion).toString(), is("1.4.x"));
|
||||
assertThat(Branch.from(iterationVersion).toString()).isEqualTo("1.4.x");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #2
|
||||
*/
|
||||
@Test
|
||||
public void detectsIssueBranches() {
|
||||
void detectsIssueBranches() {
|
||||
|
||||
Branch branch = Branch.from("issue/DATACMNS-4711");
|
||||
|
||||
assertThat(branch.isIssueBranch(Tracker.JIRA), is(true));
|
||||
assertThat(branch.isIssueBranch(Tracker.GITHUB), is(false));
|
||||
assertThat(branch.isIssueBranch(Tracker.JIRA)).isTrue();
|
||||
assertThat(branch.isIssueBranch(Tracker.GITHUB)).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
@@ -28,17 +28,17 @@ import org.springframework.data.release.issues.TicketStatus;
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class CommitUnitTests {
|
||||
class CommitUnitTests {
|
||||
|
||||
@Test
|
||||
public void shouldRenderCommitMessage() {
|
||||
void shouldRenderCommitMessage() {
|
||||
|
||||
assertThat(new Commit(new Ticket("1234", "Hello", Mockito.mock(TicketStatus.class)), "Summary", Optional.empty()))
|
||||
.hasToString("1234 - Summary.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldRenderCommitMessageWithDetail() {
|
||||
void shouldRenderCommitMessageWithDetail() {
|
||||
|
||||
assertThat(
|
||||
new Commit(new Ticket("1234", "Hello", Mockito.mock(TicketStatus.class)), "Summary", Optional.of("detail")))
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.release.git;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.junit.Assume.*;
|
||||
import static org.springframework.data.release.model.Projects.*;
|
||||
|
||||
@@ -24,8 +23,10 @@ import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
@@ -34,12 +35,13 @@ import org.springframework.data.release.model.TestReleaseTrains;
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class GitOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
@Disabled
|
||||
class GitOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired GitOperations gitOperations;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
@BeforeAll
|
||||
static void beforeClass() {
|
||||
|
||||
try {
|
||||
URL url = new URL("https://github.com");
|
||||
@@ -52,25 +54,25 @@ public class GitOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updatesGitRepositories() throws Exception {
|
||||
void updatesGitRepositories() throws Exception {
|
||||
gitOperations.update(ReleaseTrains.GOSLING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void showTags() throws Exception {
|
||||
void showTags() throws Exception {
|
||||
|
||||
gitOperations.update(TestReleaseTrains.SAMPLE);
|
||||
|
||||
assertThat(gitOperations.getTags(BUILD).asList(), is(not(emptyIterable())));
|
||||
assertThat(gitOperations.getTags(BUILD).asList()).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void foo() throws Exception {
|
||||
void foo() throws Exception {
|
||||
gitOperations.update(TestReleaseTrains.SAMPLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void obtainsVersionTagsForRepoThatAlsoHasOtherTags() {
|
||||
void obtainsVersionTagsForRepoThatAlsoHasOtherTags() {
|
||||
gitOperations.getTags(MONGO_DB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.release.git;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.model.Module;
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
@@ -30,10 +30,10 @@ import org.springframework.data.release.model.Train;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class GitProjectUnitTests {
|
||||
class GitProjectUnitTests {
|
||||
|
||||
@Test
|
||||
public void buildsGitHubRepositoryUriCorrectly() {
|
||||
void buildsGitHubRepositoryUriCorrectly() {
|
||||
|
||||
Train codd = ReleaseTrains.CODD;
|
||||
GitServer server = new GitServer();
|
||||
@@ -44,7 +44,7 @@ public class GitProjectUnitTests {
|
||||
|
||||
String projectUri = gitProject.getProjectUri();
|
||||
|
||||
assertThat(projectUri, startsWith(server.getUri()));
|
||||
assertThat(projectUri, endsWith("spring-data-commons"));
|
||||
assertThat(projectUri).startsWith(server.getUri());
|
||||
assertThat(projectUri).endsWith("spring-data-commons");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,23 +15,23 @@
|
||||
*/
|
||||
package org.springframework.data.release.git;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class GitPropertiesIntegrationTests extends AbstractIntegrationTests {
|
||||
class GitPropertiesIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired GitProperties gitProperties;
|
||||
|
||||
@Test
|
||||
public void hasBasicPropertiesConfigured() {
|
||||
assertThat(gitProperties.getAuthor(), is(notNullValue()));
|
||||
assertThat(gitProperties.getEmail(), is(notNullValue()));
|
||||
void hasBasicPropertiesConfigured() {
|
||||
assertThat(gitProperties.getAuthor()).isNotNull();
|
||||
assertThat(gitProperties.getEmail()).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,22 +15,22 @@
|
||||
*/
|
||||
package org.springframework.data.release.io;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class IoPropertiesIntegrationTests extends AbstractIntegrationTests {
|
||||
class IoPropertiesIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired IoProperties ioProperties;
|
||||
|
||||
@Test
|
||||
public void configuresWorkingDirectoryFromApplicationProperties() {
|
||||
assertThat(ioProperties.getWorkDir(), is(notNullValue()));
|
||||
void configuresWorkingDirectoryFromApplicationProperties() {
|
||||
assertThat(ioProperties.getWorkDir()).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,20 +17,19 @@ package org.springframework.data.release.issues.github;
|
||||
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.*;
|
||||
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.assertj.core.api.Assumptions.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.WireMockExtension;
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
@@ -43,34 +42,31 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
|
||||
import com.github.tomakehurst.wiremock.common.ClasspathFileSource;
|
||||
import com.github.tomakehurst.wiremock.junit.WireMockRule;
|
||||
|
||||
/**
|
||||
* Integration Tests for {@link GitHub} using a local {@link WireMockRule} server.
|
||||
* Integration Tests for {@link GitHub} using a local {@link WireMockExtension} server.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests {
|
||||
class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
public static final String ISSUES_URI = "/repos/spring-projects/spring-data-build/issues";
|
||||
public static final String RELEASE_TICKET_URI = "/repos/spring-projects/spring-data-build/issues/233";
|
||||
public static final String MILESTONES_URI = "/repos/spring-projects/spring-data-build/milestones";
|
||||
public static final ModuleIteration BUILD_HOPPER_RC1 = ReleaseTrains.HOPPER.getModuleIteration(Projects.BUILD,
|
||||
static final String ISSUES_URI = "/repos/spring-projects/spring-data-build/issues";
|
||||
static final String RELEASE_TICKET_URI = "/repos/spring-projects/spring-data-build/issues/233";
|
||||
static final String MILESTONES_URI = "/repos/spring-projects/spring-data-build/milestones";
|
||||
static final ModuleIteration BUILD_HOPPER_RC1 = ReleaseTrains.HOPPER.getModuleIteration(Projects.BUILD,
|
||||
Iteration.RC1);
|
||||
|
||||
@Rule public WireMockRule mockService = new WireMockRule(
|
||||
@RegisterExtension WireMockExtension mockService = new WireMockExtension(
|
||||
wireMockConfig().port(8888).fileSource(new ClasspathFileSource("integration/github")));
|
||||
|
||||
@Rule public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Autowired GitHub github;
|
||||
@Autowired GitHubProperties properties;
|
||||
|
||||
@Before
|
||||
public void before() throws Exception {
|
||||
@BeforeEach
|
||||
void before() {
|
||||
|
||||
UriComponents uriComponents = UriComponentsBuilder.fromUriString(properties.getApiUrl()).build();
|
||||
Assume.assumeThat(uriComponents.getHost(), is("localhost"));
|
||||
assumeThat(uriComponents.getHost()).isEqualTo("localhost");
|
||||
|
||||
github.reset();
|
||||
}
|
||||
@@ -79,83 +75,79 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void findTicketsByTicketIds() throws Exception {
|
||||
void findTicketsByTicketIds() {
|
||||
|
||||
mockGetIssueWith("issue.json", 233);
|
||||
|
||||
Collection<Ticket> tickets = github.findTickets(Projects.BUILD, Arrays.asList("233"));
|
||||
assertThat(tickets, hasSize(1));
|
||||
Collection<Ticket> tickets = github.findTickets(Projects.BUILD, Collections.singletonList("233"));
|
||||
assertThat(tickets).hasSize(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void ignoresUnknownTicketsByTicketId() throws Exception {
|
||||
void ignoresUnknownTicketsByTicketId() {
|
||||
|
||||
Collection<Ticket> tickets = github.findTickets(Projects.BUILD, Arrays.asList("123"));
|
||||
assertThat(tickets, hasSize(0));
|
||||
Collection<Ticket> tickets = github.findTickets(Projects.BUILD, Collections.singletonList("123"));
|
||||
assertThat(tickets).hasSize(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void emptyResultWithEmptyTicketIds() throws Exception {
|
||||
void emptyResultWithEmptyTicketIds() {
|
||||
|
||||
Collection<Ticket> tickets = github.findTickets(Projects.COMMONS, Arrays.asList());
|
||||
assertThat(tickets, hasSize(0));
|
||||
Collection<Ticket> tickets = github.findTickets(Projects.COMMONS, Collections.emptyList());
|
||||
assertThat(tickets).hasSize(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void getReleaseTicketForReturnsTheReleaseTicket() throws Exception {
|
||||
void getReleaseTicketForReturnsTheReleaseTicket() {
|
||||
|
||||
mockGetMilestonesWith("milestones.json");
|
||||
mockGetIssuesWith("issues.json");
|
||||
|
||||
Ticket releaseTicket = github.getReleaseTicketFor(BUILD_HOPPER_RC1);
|
||||
assertThat(releaseTicket.getId(), is(Matchers.equalTo("#233")));
|
||||
assertThat(releaseTicket.getId()).isEqualTo("#233");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void noReleaseTicketFound() throws Exception {
|
||||
|
||||
expectedException.expect(IllegalStateException.class);
|
||||
expectedException.expectMessage("No milestone for Spring Data Build found containing 1.8 RC1!");
|
||||
void noReleaseTicketFound() {
|
||||
|
||||
mockGetMilestonesWith("emptyMilestones.json");
|
||||
|
||||
github.getReleaseTicketFor(BUILD_HOPPER_RC1);
|
||||
|
||||
fail("Missing IllegalStateException");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> github.getReleaseTicketFor(BUILD_HOPPER_RC1))
|
||||
.withMessageContaining("No milestone for Spring Data Build found containing 1.8 RC1!");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseVersionShouldCreateAVersion() throws Exception {
|
||||
void createReleaseVersionShouldCreateAVersion() {
|
||||
|
||||
mockGetMilestonesWith("emptyMilestones.json");
|
||||
mockCreateMilestoneWith("milestone.json");
|
||||
|
||||
github.createReleaseVersion(BUILD_HOPPER_RC1);
|
||||
|
||||
verify(postRequestedFor(urlPathMatching(MILESTONES_URI)).withRequestBody(
|
||||
equalToJson("{\"title\":\"1.8 RC1 (Hopper)\", \"description\":\"Hopper RC1\"}")));
|
||||
verify(postRequestedFor(urlPathMatching(MILESTONES_URI))
|
||||
.withRequestBody(equalToJson("{\"title\":\"1.8 RC1 (Hopper)\", \"description\":\"Hopper RC1\"}")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseVersionShouldFindExistingReleaseVersion() throws Exception {
|
||||
void createReleaseVersionShouldFindExistingReleaseVersion() {
|
||||
|
||||
mockGetMilestonesWith("milestones.json");
|
||||
|
||||
@@ -168,7 +160,7 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseTicketShouldCreateReleaseTicket() throws Exception {
|
||||
void createReleaseTicketShouldCreateReleaseTicket() {
|
||||
|
||||
mockGetMilestonesWith("milestones.json");
|
||||
mockGetIssuesWith("emptyIssues.json");
|
||||
@@ -184,26 +176,22 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseTicketShouldFailWithNoReleaseVersion() throws Exception {
|
||||
|
||||
expectedException.expect(IllegalStateException.class);
|
||||
expectedException.expectMessage("No milestone for Spring Data Build found containing 1.8 RC1!");
|
||||
void createReleaseTicketShouldFailWithNoReleaseVersion() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.BUILD, Iteration.RC1);
|
||||
|
||||
mockGetIssuesWith("emptyIssues.json");
|
||||
mockGetMilestonesWith("emptyMilestones.json");
|
||||
|
||||
github.createReleaseTicket(moduleIteration);
|
||||
|
||||
fail("Missing IllegalStateException");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> github.createReleaseTicket(moduleIteration))
|
||||
.withMessageContaining("No milestone for Spring Data Build found containing 1.8 RC1!");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseTicketShouldFindExistingTicket() throws Exception {
|
||||
void createReleaseTicketShouldFindExistingTicket() {
|
||||
|
||||
mockGetMilestonesWith("milestones.json");
|
||||
mockGetIssuesWith("issues.json");
|
||||
@@ -217,7 +205,7 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
* @see #55
|
||||
*/
|
||||
@Test
|
||||
public void assignTicketToMe() {
|
||||
void assignTicketToMe() {
|
||||
|
||||
mockGetMilestonesWith("milestones.json");
|
||||
mockGetIssuesWith("issues.json");
|
||||
@@ -235,7 +223,7 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
* @see #94
|
||||
*/
|
||||
@Test
|
||||
public void closeIterationShouldResolveReleaseTicket() {
|
||||
void closeIterationShouldResolveReleaseTicket() {
|
||||
|
||||
mockGetMilestonesWith("milestones.json");
|
||||
mockGetIssuesWith("issues.json");
|
||||
|
||||
@@ -19,27 +19,28 @@ import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.json.JsonTest;
|
||||
import org.springframework.boot.test.json.JacksonTester;
|
||||
import org.springframework.data.release.issues.github.GitHubIssue.Milestone;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GitHubIssue}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@JsonTest
|
||||
public class GitHubIssueUnitTests {
|
||||
@ExtendWith(SpringExtension.class)
|
||||
class GitHubIssueUnitTests {
|
||||
|
||||
@Autowired private JacksonTester<Milestone> json;
|
||||
|
||||
@Test
|
||||
public void shouldNotRenderOpenProperty() throws IOException {
|
||||
void shouldNotRenderOpenProperty() throws IOException {
|
||||
|
||||
Milestone milestone = Milestone.of("my-title", "my-description");
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.release.issues.github;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
@@ -29,10 +29,10 @@ import org.springframework.data.release.model.ReleaseTrains;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class GithubMilestoneUnitTests {
|
||||
class GithubMilestoneUnitTests {
|
||||
|
||||
@Test
|
||||
public void rendersGithubGaVersionCorrectly() {
|
||||
void rendersGithubGaVersionCorrectly() {
|
||||
|
||||
assertIterationVersion(Iteration.M1, "1.8 M1 (Dijkstra)");
|
||||
assertIterationVersion(Iteration.RC1, "1.8 RC1 (Dijkstra)");
|
||||
@@ -45,30 +45,30 @@ public class GithubMilestoneUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void usesCustomModuleIterationStartVersion() {
|
||||
void usesCustomModuleIterationStartVersion() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||
|
||||
GithubMilestone version = new GithubMilestone(module);
|
||||
assertThat(version.toString(), is("1.0 M1 (Dijkstra)"));
|
||||
assertThat(version.toString()).isEqualTo("1.0 M1 (Dijkstra)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesNotUseCustomIterationOnNonFirstiterations() {
|
||||
void doesNotUseCustomIterationOnNonFirstiterations() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.RC1);
|
||||
|
||||
GithubMilestone version = new GithubMilestone(module);
|
||||
assertThat(version.toString(), is("1.0 RC1 (Dijkstra)"));
|
||||
assertThat(version.toString()).isEqualTo("1.0 RC1 (Dijkstra)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersDescriptionCorrectly() {
|
||||
void rendersDescriptionCorrectly() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||
|
||||
GithubMilestone version = new GithubMilestone(module);
|
||||
assertThat(version.getDescription(), is("Dijkstra M2"));
|
||||
assertThat(version.getDescription()).isEqualTo("Dijkstra M2");
|
||||
}
|
||||
|
||||
private void assertIterationVersion(Iteration iteration, String expected) {
|
||||
@@ -76,6 +76,6 @@ public class GithubMilestoneUnitTests {
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
||||
|
||||
GithubMilestone version = new GithubMilestone(module);
|
||||
assertThat(version.toString(), is(expected));
|
||||
assertThat(version.toString()).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,55 +13,50 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.release.issues.jira;
|
||||
|
||||
import static org.hamcrest.core.Is.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link JiraComponents}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class JiraComponentsUnitTests {
|
||||
class JiraComponentsUnitTests {
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void returnsComponentByName() throws Exception {
|
||||
void returnsComponentByName() {
|
||||
|
||||
JiraComponent fooComponent = new JiraComponent("123", "foo");
|
||||
JiraComponents jiraComponents = JiraComponents.of(Collections.singleton(fooComponent));
|
||||
|
||||
assertThat(jiraComponents.findComponent("foo").isPresent(), is(true));
|
||||
assertThat(jiraComponents.findComponent("foo").isPresent()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void returnsEmptyIfComponentMissing() throws Exception {
|
||||
void returnsEmptyIfComponentMissing() {
|
||||
|
||||
JiraComponent fooComponent = new JiraComponent("123", "foo");
|
||||
JiraComponents jiraComponents = JiraComponents.of(Collections.singleton(fooComponent));
|
||||
|
||||
assertThat(jiraComponents.findComponent("baz").isPresent(), is(false));
|
||||
assertThat(jiraComponents.findComponent("baz").isPresent()).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void failsOnNullArgumentConstruction() throws Exception {
|
||||
|
||||
JiraComponents.of(null);
|
||||
|
||||
fail("Missing IllegalArgumentException");
|
||||
@Test
|
||||
void failsOnNullArgumentConstruction() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> JiraComponents.of(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,21 +17,20 @@ package org.springframework.data.release.issues.jira;
|
||||
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.*;
|
||||
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.assertj.core.api.Assumptions.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.WireMockExtension;
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
@@ -45,14 +44,13 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
|
||||
import com.github.tomakehurst.wiremock.common.ClasspathFileSource;
|
||||
import com.github.tomakehurst.wiremock.junit.WireMockRule;
|
||||
|
||||
/**
|
||||
* Integration Tests for {@link Jira} using a local {@link WireMockRule} server.
|
||||
* Integration Tests for {@link Jira} using a local {@link WireMockExtension} server.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
static final String CREATE_ISSUE_URI = "/rest/api/2/issue";
|
||||
static final String CREATE_VERSION_URI = "/rest/api/2/version";
|
||||
@@ -62,19 +60,17 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
static final String PROJECT_COMPONENTS_URI = "/rest/api/2/project/%s/components";
|
||||
static final ModuleIteration REST_HOPPER_RC1 = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
@Rule public WireMockRule mockService = new WireMockRule(
|
||||
@RegisterExtension WireMockExtension mockService = new WireMockExtension(
|
||||
wireMockConfig().port(8888).fileSource(new ClasspathFileSource("integration/jira")));
|
||||
|
||||
@Rule public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Autowired JiraConnector jira;
|
||||
@Autowired JiraProperties properties;
|
||||
|
||||
@Before
|
||||
public void before() throws Exception {
|
||||
@BeforeEach
|
||||
void before() {
|
||||
|
||||
UriComponents uriComponents = UriComponentsBuilder.fromUriString(properties.getApiUrl()).build();
|
||||
Assume.assumeThat(uriComponents.getHost(), is("localhost"));
|
||||
assumeThat(uriComponents.getHost()).isEqualTo("localhost");
|
||||
|
||||
properties.setUsername("dummy");
|
||||
jira.reset();
|
||||
@@ -84,83 +80,79 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void findResolvedTicketsByTicketIds() throws Exception {
|
||||
void findResolvedTicketsByTicketIds() {
|
||||
|
||||
mockSearchWith("DATAREDIS-1andDATAJPA-1.json");
|
||||
|
||||
Collection<Ticket> tickets = jira.findTickets(Projects.COMMONS, Arrays.asList("DATAREDIS-1", "DATAJPA-1"));
|
||||
assertThat(tickets, hasSize(2));
|
||||
assertThat(tickets).hasSize(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void ignoresUnknownTicketsByTicketId() throws Exception {
|
||||
void ignoresUnknownTicketsByTicketId() {
|
||||
|
||||
mockSearchWith("emptyTickets.json");
|
||||
|
||||
Collection<Ticket> tickets = jira.findTickets(Projects.COMMONS, Arrays.asList("XYZ-1", "UNKOWN-1"));
|
||||
assertThat(tickets, hasSize(0));
|
||||
assertThat(tickets).hasSize(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void emptyResultWithEmptyTicketIds() throws Exception {
|
||||
void emptyResultWithEmptyTicketIds() {
|
||||
|
||||
Collection<Ticket> tickets = jira.findTickets(Projects.COMMONS, Arrays.asList());
|
||||
assertThat(tickets, hasSize(0));
|
||||
assertThat(tickets).hasSize(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void getReleaseTicketForReturnsTheReleaseTicket() throws Exception {
|
||||
void getReleaseTicketForReturnsTheReleaseTicket() {
|
||||
|
||||
mockSearchWith("releaseTickets.json");
|
||||
|
||||
Ticket releaseTicket = jira.getReleaseTicketFor(REST_HOPPER_RC1);
|
||||
assertThat(releaseTicket.getId(), is(Matchers.equalTo("DATAREST-782")));
|
||||
assertThat(releaseTicket.getId()).isEqualTo("DATAREST-782");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void noReleaseTicketFound() throws Exception {
|
||||
|
||||
expectedException.expect(IllegalArgumentException.class);
|
||||
expectedException.expectMessage("Did not find a release ticket for Spring Data REST 2.5 RC1");
|
||||
void noReleaseTicketFound() {
|
||||
|
||||
mockSearchWith("emptyTickets.json");
|
||||
|
||||
jira.getReleaseTicketFor(REST_HOPPER_RC1);
|
||||
|
||||
fail("Missing IllegalStateException");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> jira.getReleaseTicketFor(REST_HOPPER_RC1))
|
||||
.withMessageContaining("Did not find a release ticket for Spring Data REST 2.5 RC1");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void getReleaseVersion() throws Exception {
|
||||
void getReleaseVersion() {
|
||||
|
||||
mockGetProjectVersionsWith("releaseVersions.json", REST_HOPPER_RC1.getProjectKey());
|
||||
|
||||
Optional<JiraReleaseVersion> optional = jira.findJiraReleaseVersion(REST_HOPPER_RC1);
|
||||
|
||||
assertThat(optional.isPresent(), is(true));
|
||||
assertThat(optional.get().getName(), is(Matchers.equalTo("2.5 RC1 (Hopper)")));
|
||||
assertThat(optional.isPresent()).isTrue();
|
||||
assertThat(optional.get().getName()).isEqualTo("2.5 RC1 (Hopper)");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseVersionShouldCreateAVersion() throws Exception {
|
||||
void createReleaseVersionShouldCreateAVersion() {
|
||||
|
||||
mockGetProjectVersionsWith("emptyReleaseVersions.json", REST_HOPPER_RC1.getProjectKey());
|
||||
mockCreateVersionWith("versionCreated.json");
|
||||
@@ -175,7 +167,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseVersionShouldFindExistingReleaseVersion() throws Exception {
|
||||
void createReleaseVersionShouldFindExistingReleaseVersion() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
@@ -190,7 +182,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #56
|
||||
*/
|
||||
@Test
|
||||
public void archiveReleaseVersionShouldArchiveReleaseVersion() throws Exception {
|
||||
void archiveReleaseVersionShouldArchiveReleaseVersion() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
@@ -209,7 +201,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseTicketShouldCreateReleaseTicket() throws Exception {
|
||||
void createReleaseTicketShouldCreateReleaseTicket() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
@@ -231,7 +223,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseTicketShouldCreateReleaseTicketWithoutComponent() throws Exception {
|
||||
void createReleaseTicketShouldCreateReleaseTicketWithoutComponent() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
@@ -252,26 +244,22 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseTicketShouldFailWithNoReleaseVersion() throws Exception {
|
||||
|
||||
expectedException.expect(IllegalStateException.class);
|
||||
expectedException.expectMessage("Did not find a release version for Spring Data REST 2.5 RC1");
|
||||
void createReleaseTicketShouldFailWithNoReleaseVersion() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
mockSearchWith("emptyTickets.json");
|
||||
mockGetProjectVersionsWith("emptyReleaseVersions.json", moduleIteration.getProjectKey());
|
||||
|
||||
jira.createReleaseTicket(moduleIteration);
|
||||
|
||||
fail("Missing IllegalStateException");
|
||||
assertThatIllegalStateException().isThrownBy(() -> jira.createReleaseTicket(moduleIteration))
|
||||
.withMessageContaining("Did not find a release version for Spring Data REST 2.5 RC1");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #5
|
||||
*/
|
||||
@Test
|
||||
public void createReleaseTicketShouldFindExistingTicket() throws Exception {
|
||||
void createReleaseTicketShouldFindExistingTicket() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
@@ -288,7 +276,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #5, #54
|
||||
*/
|
||||
@Test
|
||||
public void assignTicketToMe() {
|
||||
void assignTicketToMe() {
|
||||
|
||||
mockService.stubFor(get(urlPathMatching("/rest/api/2/issue/DATAREDIS-302")).//
|
||||
willReturn(json("existingTicket.json")));
|
||||
@@ -306,7 +294,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #5, #53
|
||||
*/
|
||||
@Test
|
||||
public void skipTicketAssignmentIfAssigned() {
|
||||
void skipTicketAssignmentIfAssigned() {
|
||||
|
||||
properties.setUsername("mp911de");
|
||||
|
||||
@@ -325,7 +313,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
* @see #94
|
||||
*/
|
||||
@Test
|
||||
public void closeIterationShouldResolveReleaseTicket() {
|
||||
void closeIterationShouldResolveReleaseTicket() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
@@ -337,9 +325,12 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
mockService.stubFor(get(urlPathMatching("/rest/api/2/issue/DATAREST-782")).//
|
||||
willReturn(json("releaseTicket.json")));
|
||||
|
||||
mockService.stubFor(post(urlPathMatching("/rest/api/2/issue/DATAREST-782/transitions")) //
|
||||
.willReturn(ResponseDefinitionBuilder.responseDefinition().withStatus(200)));
|
||||
|
||||
jira.closeIteration(moduleIteration);
|
||||
|
||||
verify(postRequestedFor(urlPathMatching("/rest/api/2/issue/DATAREST-782")).withRequestBody(
|
||||
verify(postRequestedFor(urlPathMatching("/rest/api/2/issue/DATAREST-782/transitions")).withRequestBody(
|
||||
equalToJson("{\"update\":{},\"transition\":{\"id\":5},\"fields\":{\"resolution\":{\"name\":\"Complete\"}}}")));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.release.issues.jira;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
@@ -29,10 +29,10 @@ import org.springframework.data.release.model.ReleaseTrains;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class JiraVersionUnitTests {
|
||||
class JiraVersionUnitTests {
|
||||
|
||||
@Test
|
||||
public void rendersJiraGaVersionCorrectly() {
|
||||
void rendersJiraGaVersionCorrectly() {
|
||||
|
||||
assertIterationVersion(Iteration.M1, "1.8 M1 (Dijkstra)");
|
||||
assertIterationVersion(Iteration.RC1, "1.8 RC1 (Dijkstra)");
|
||||
@@ -45,30 +45,30 @@ public class JiraVersionUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void usesCustomModuleIterationStartVersion() {
|
||||
void usesCustomModuleIterationStartVersion() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||
|
||||
JiraVersion version = new JiraVersion(module);
|
||||
assertThat(version.toString(), is("1.0 M1 (Dijkstra)"));
|
||||
assertThat(version.toString()).isEqualTo("1.0 M1 (Dijkstra)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesNotUseCustomIterationOnNonFirstiterations() {
|
||||
void doesNotUseCustomIterationOnNonFirstiterations() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.RC1);
|
||||
|
||||
JiraVersion version = new JiraVersion(module);
|
||||
assertThat(version.toString(), is("1.0 RC1 (Dijkstra)"));
|
||||
assertThat(version.toString()).isEqualTo("1.0 RC1 (Dijkstra)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersDescriptionCorrectly() {
|
||||
void rendersDescriptionCorrectly() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||
|
||||
JiraVersion version = new JiraVersion(module);
|
||||
assertThat(version.getDescription(), is("Dijkstra M2"));
|
||||
assertThat(version.getDescription()).isEqualTo("Dijkstra M2");
|
||||
}
|
||||
|
||||
private void assertIterationVersion(Iteration iteration, String expected) {
|
||||
@@ -76,6 +76,6 @@ public class JiraVersionUnitTests {
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
||||
|
||||
JiraVersion version = new JiraVersion(module);
|
||||
assertThat(version.toString(), is(expected));
|
||||
assertThat(version.toString()).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.release.issues.jira;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.test.util.AssertionErrors.fail;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
import org.springframework.data.release.issues.Tickets;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
@@ -34,68 +32,68 @@ import org.springframework.data.release.model.ReleaseTrains;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class TicketsUnitTests {
|
||||
class TicketsUnitTests {
|
||||
|
||||
@Test
|
||||
public void hasReleaseTicketShouldReturnTrue() throws Exception {
|
||||
void hasReleaseTicketShouldReturnTrue() {
|
||||
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
assertThat(result, is(true));
|
||||
assertThat(result).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasReleaseTickeForTicketWithoutTrainNameShouldReturnFalse() throws Exception {
|
||||
void hasReleaseTickeForTicketWithoutTrainNameShouldReturnFalse() {
|
||||
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
assertThat(result, is(false));
|
||||
assertThat(result).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getReleaseTicketReturnsReleaseTicket() throws Exception {
|
||||
void getReleaseTicketReturnsReleaseTicket() {
|
||||
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
Ticket releaseTicket = tickets
|
||||
.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
assertThat(releaseTicket, is(ticket));
|
||||
assertThat(releaseTicket).isEqualTo(ticket);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void getReleaseTicketThrowsExceptionWithoutAReleaseTicket() throws Exception {
|
||||
@Test
|
||||
void getReleaseTicketThrowsExceptionWithoutAReleaseTicket() {
|
||||
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
tickets.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
fail("Missing IllegalStateException");
|
||||
assertThatIllegalArgumentException().isThrownBy(
|
||||
() -> tickets.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getResolvedReleaseTicket() throws Exception {
|
||||
void getResolvedReleaseTicket() {
|
||||
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(true, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
Ticket releaseTicket = tickets
|
||||
.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
assertThat(releaseTicket, is(ticket));
|
||||
assertThat(releaseTicket).isEqualTo(ticket);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getReleaseTicketsReturnsReleaseTickets() throws Exception {
|
||||
void getReleaseTicketsReturnsReleaseTickets() {
|
||||
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
Tickets result = tickets
|
||||
.getReleaseTickets(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA).getTrainIteration());
|
||||
assertThat(result.getTickets().contains(ticket), is(true));
|
||||
assertThat(result.getTickets().contains(ticket)).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,113 +15,114 @@
|
||||
*/
|
||||
package org.springframework.data.release.model;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ArtifactVersionUnitTests {
|
||||
class ArtifactVersionUnitTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsInvalidVersionSuffix() {
|
||||
ArtifactVersion.of("1.4.5.GA");
|
||||
@Test
|
||||
void rejectsInvalidVersionSuffix() {
|
||||
Assertions.assertThatIllegalArgumentException().isThrownBy(() -> ArtifactVersion.of("1.4.5.GA"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parsesReleaseVersionCorrectly() {
|
||||
void parsesReleaseVersionCorrectly() {
|
||||
|
||||
ArtifactVersion version = ArtifactVersion.of("1.4.5.RELEASE");
|
||||
|
||||
assertThat(version.isReleaseVersion(), is(true));
|
||||
assertThat(version.getNextDevelopmentVersion(), is(ArtifactVersion.of("1.4.6.BUILD-SNAPSHOT")));
|
||||
assertThat(version.isReleaseVersion()).isTrue();
|
||||
assertThat(version.getNextDevelopmentVersion()).isEqualTo(ArtifactVersion.of("1.4.6.BUILD-SNAPSHOT"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsMilestoneVersionCorrectly() {
|
||||
void createsMilestoneVersionCorrectly() {
|
||||
|
||||
ArtifactVersion version = ArtifactVersion.of("1.4.5.M1");
|
||||
|
||||
assertThat(version.isReleaseVersion(), is(false));
|
||||
assertThat(version.isMilestoneVersion(), is(true));
|
||||
assertThat(version.isReleaseVersion()).isFalse();
|
||||
assertThat(version.isMilestoneVersion()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsReleaseVersionByDefault() {
|
||||
void createsReleaseVersionByDefault() {
|
||||
|
||||
ArtifactVersion version = ArtifactVersion.of(Version.of(1, 4, 5));
|
||||
|
||||
assertThat(version.isReleaseVersion(), is(true));
|
||||
assertThat(version.toString(), is("1.4.5.RELEASE"));
|
||||
assertThat(version.isReleaseVersion()).isTrue();
|
||||
assertThat(version.toString()).isEqualTo("1.4.5.RELEASE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsMilestoneVersionFromIteration() {
|
||||
void createsMilestoneVersionFromIteration() {
|
||||
|
||||
IterationVersion oneFourMilestoneOne = new SimpleIterationVersion(Version.of(1, 4), Iteration.M1);
|
||||
ArtifactVersion version = ArtifactVersion.of(oneFourMilestoneOne);
|
||||
|
||||
assertThat(version.isMilestoneVersion(), is(true));
|
||||
assertThat(version.toString(), is("1.4.0.M1"));
|
||||
assertThat(version.isMilestoneVersion()).isTrue();
|
||||
assertThat(version.toString()).isEqualTo("1.4.0.M1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsReleaseVersionFromIteration() {
|
||||
void createsReleaseVersionFromIteration() {
|
||||
|
||||
IterationVersion oneFourGA = new SimpleIterationVersion(Version.of(1, 4), Iteration.GA);
|
||||
ArtifactVersion version = ArtifactVersion.of(oneFourGA);
|
||||
|
||||
assertThat(version.isReleaseVersion(), is(true));
|
||||
assertThat(version.toString(), is("1.4.0.RELEASE"));
|
||||
assertThat(version.isReleaseVersion()).isTrue();
|
||||
assertThat(version.toString()).isEqualTo("1.4.0.RELEASE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsServiceReleaseVersionFromIteration() {
|
||||
void createsServiceReleaseVersionFromIteration() {
|
||||
|
||||
IterationVersion oneFourServiceReleaseTwo = new SimpleIterationVersion(Version.of(1, 4), Iteration.SR2);
|
||||
ArtifactVersion version = ArtifactVersion.of(oneFourServiceReleaseTwo);
|
||||
|
||||
assertThat(version.isReleaseVersion(), is(true));
|
||||
assertThat(version.toString(), is("1.4.2.RELEASE"));
|
||||
assertThat(version.isReleaseVersion()).isTrue();
|
||||
assertThat(version.toString()).isEqualTo("1.4.2.RELEASE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsNextMinorSnapshotVersionForGARelease() {
|
||||
void returnsNextMinorSnapshotVersionForGARelease() {
|
||||
|
||||
ArtifactVersion version = ArtifactVersion.of("1.5.0.RELEASE").getNextDevelopmentVersion();
|
||||
|
||||
assertThat(version.isMilestoneVersion(), is(false));
|
||||
assertThat(version.isReleaseVersion(), is(false));
|
||||
assertThat(version, is(ArtifactVersion.of("1.6.0.BUILD-SNAPSHOT")));
|
||||
assertThat(version.isMilestoneVersion()).isFalse();
|
||||
assertThat(version.isReleaseVersion()).isFalse();
|
||||
assertThat(version).isEqualTo(ArtifactVersion.of("1.6.0.BUILD-SNAPSHOT"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ordersCorrectly() {
|
||||
void ordersCorrectly() {
|
||||
|
||||
ArtifactVersion oneNine = ArtifactVersion.of("1.9.0.RELEASE");
|
||||
ArtifactVersion oneTen = ArtifactVersion.of("1.10.0.RELEASE");
|
||||
|
||||
assertThat(oneNine.compareTo(oneTen), is(lessThan(0)));
|
||||
assertThat(oneNine.compareTo(oneTen)).isLessThan(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ordersSnapshotsOfSameVersionSmaller() {
|
||||
void ordersSnapshotsOfSameVersionSmaller() {
|
||||
|
||||
ArtifactVersion oneTenRelease = ArtifactVersion.of("1.10.0.RELEASE");
|
||||
ArtifactVersion oneTenSnapshot = ArtifactVersion.of("1.10.0.BUILD-SNAPSHOT");
|
||||
|
||||
assertThat(oneTenRelease.compareTo(oneTenSnapshot), is(greaterThan(0)));
|
||||
assertThat(oneTenRelease.compareTo(oneTenSnapshot)).isGreaterThan(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsCorrectBugfixVersions() {
|
||||
void returnsCorrectBugfixVersions() {
|
||||
|
||||
assertThat(ArtifactVersion.of("1.0.0.RELEASE").getNextBugfixVersion(),
|
||||
is(ArtifactVersion.of("1.0.1.BUILD-SNAPSHOT")));
|
||||
assertThat(ArtifactVersion.of("1.0.0.M1").getNextBugfixVersion(), is(ArtifactVersion.of("1.0.0.BUILD-SNAPSHOT")));
|
||||
assertThat(ArtifactVersion.of("1.0.1.RELEASE").getNextBugfixVersion(),
|
||||
is(ArtifactVersion.of("1.0.2.BUILD-SNAPSHOT")));
|
||||
assertThat(ArtifactVersion.of("1.0.0.RELEASE").getNextBugfixVersion())
|
||||
.isEqualTo(ArtifactVersion.of("1.0.1.BUILD-SNAPSHOT"));
|
||||
assertThat(ArtifactVersion.of("1.0.0.M1").getNextBugfixVersion())
|
||||
.isEqualTo(ArtifactVersion.of("1.0.0.BUILD-SNAPSHOT"));
|
||||
assertThat(ArtifactVersion.of("1.0.1.RELEASE").getNextBugfixVersion())
|
||||
.isEqualTo(ArtifactVersion.of("1.0.2.BUILD-SNAPSHOT"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,17 @@ package org.springframework.data.release.model;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link Calver}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class CalverVersionUnitTests {
|
||||
class CalverVersionUnitTests {
|
||||
|
||||
@Test
|
||||
public void shouldParseRelease() {
|
||||
void shouldParseRelease() {
|
||||
|
||||
Calver version = Calver.parse("2020.0.1");
|
||||
|
||||
@@ -37,7 +37,7 @@ public class CalverVersionUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldParseM1Release() {
|
||||
void shouldParseM1Release() {
|
||||
|
||||
Calver version = Calver.parse("2020.0.1-M1");
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CalverVersionUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCompareReleasesCorrectly() {
|
||||
void shouldCompareReleasesCorrectly() {
|
||||
|
||||
Calver version = Calver.parse("2020.0.1-RC2");
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CalverVersionUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldParseSnapshot() {
|
||||
void shouldParseSnapshot() {
|
||||
|
||||
Calver version = Calver.parse("2020.0.1-SNAPSHOT");
|
||||
|
||||
|
||||
@@ -17,17 +17,17 @@ package org.springframework.data.release.model;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link Iteration}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class IterationUnitTests {
|
||||
class IterationUnitTests {
|
||||
|
||||
@Test
|
||||
public void shouldCompareMilestoneIterationsCorrectly() {
|
||||
void shouldCompareMilestoneIterationsCorrectly() {
|
||||
|
||||
assertThat(Iteration.M1).isEqualByComparingTo(Iteration.M1);
|
||||
assertThat(Iteration.M1).isLessThan(Iteration.RC1);
|
||||
@@ -39,7 +39,7 @@ public class IterationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCompareReleaseCandidateIterationsCorrectly() {
|
||||
void shouldCompareReleaseCandidateIterationsCorrectly() {
|
||||
|
||||
assertThat(Iteration.RC1).isGreaterThan(Iteration.M1);
|
||||
assertThat(Iteration.RC1).isEqualByComparingTo(Iteration.RC1);
|
||||
@@ -51,7 +51,7 @@ public class IterationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCompareGAIterationsCorrectly() {
|
||||
void shouldCompareGAIterationsCorrectly() {
|
||||
|
||||
assertThat(Iteration.GA).isGreaterThan(Iteration.M1);
|
||||
assertThat(Iteration.GA).isGreaterThan(Iteration.RC1);
|
||||
@@ -60,7 +60,7 @@ public class IterationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCompareServiceReleaseIterationsCorrectly() {
|
||||
void shouldCompareServiceReleaseIterationsCorrectly() {
|
||||
|
||||
assertThat(Iteration.SR1).isGreaterThan(Iteration.M1);
|
||||
assertThat(Iteration.SR1).isGreaterThan(Iteration.RC1);
|
||||
|
||||
@@ -15,35 +15,34 @@
|
||||
*/
|
||||
package org.springframework.data.release.model;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ModuleIterationUnitTests {
|
||||
class ModuleIterationUnitTests {
|
||||
|
||||
@Test
|
||||
public void abbreviatesTrailingZerosForNonServiceReleases() {
|
||||
void abbreviatesTrailingZerosForNonServiceReleases() {
|
||||
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.DIJKSTRA, Iteration.M1);
|
||||
ModuleIteration module = iteration.getModule(Projects.JPA);
|
||||
|
||||
assertThat(module.getShortVersionString(), is("1.6 M1"));
|
||||
assertThat(module.getMediumVersionString(), is("1.6 M1 (Dijkstra)"));
|
||||
assertThat(module.getFullVersionString(), is("1.6.0.M1 (Dijkstra M1)"));
|
||||
assertThat(module.getShortVersionString()).isEqualTo("1.6 M1");
|
||||
assertThat(module.getMediumVersionString()).isEqualTo("1.6 M1 (Dijkstra)");
|
||||
assertThat(module.getFullVersionString()).isEqualTo("1.6.0.M1 (Dijkstra M1)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesNotListIterationSuffixForServiceReleases() {
|
||||
void doesNotListIterationSuffixForServiceReleases() {
|
||||
|
||||
TrainIteration iteration = new TrainIteration(ReleaseTrains.DIJKSTRA, Iteration.SR1);
|
||||
ModuleIteration module = iteration.getModule(Projects.JPA);
|
||||
|
||||
assertThat(module.getShortVersionString(), is("1.6.1"));
|
||||
assertThat(module.getMediumVersionString(), is("1.6.1 (Dijkstra SR1)"));
|
||||
assertThat(module.getFullVersionString(), is("1.6.1.RELEASE (Dijkstra SR1)"));
|
||||
assertThat(module.getShortVersionString()).isEqualTo("1.6.1");
|
||||
assertThat(module.getMediumVersionString()).isEqualTo("1.6.1 (Dijkstra SR1)");
|
||||
assertThat(module.getFullVersionString()).isEqualTo("1.6.1.RELEASE (Dijkstra SR1)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,22 +15,20 @@
|
||||
*/
|
||||
package org.springframework.data.release.model;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ProjectUnitTests {
|
||||
class ProjectUnitTests {
|
||||
|
||||
@Test
|
||||
public void testname() {
|
||||
void testname() {
|
||||
|
||||
List<Project> projects = new ArrayList<>(Projects.PROJECTS);
|
||||
// Collections.reverse(projects);
|
||||
@@ -38,27 +36,27 @@ public class ProjectUnitTests {
|
||||
|
||||
projects.stream().map(Project::getName).forEach(System.out::println);
|
||||
|
||||
assertThat(projects.get(0), is(Projects.BUILD));
|
||||
assertThat(projects.get(1), is(Projects.COMMONS));
|
||||
assertThat(projects.get(0)).isEqualTo(Projects.BUILD);
|
||||
assertThat(projects.get(1)).isEqualTo(Projects.COMMONS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #28
|
||||
*/
|
||||
@Test
|
||||
public void findsProjectByKey() {
|
||||
assertThat(Projects.requiredByName("DATACMNS"), is(Projects.COMMONS));
|
||||
void findsProjectByKey() {
|
||||
assertThat(Projects.requiredByName("DATACMNS")).isEqualTo(Projects.COMMONS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsCustomFullNameIfSet() {
|
||||
void returnsCustomFullNameIfSet() {
|
||||
|
||||
assertThat(Projects.BUILD.getFullName(), is("Spring Data Build"));
|
||||
assertThat(Projects.CASSANDRA.getFullName(), is("Spring Data for Apache Cassandra"));
|
||||
assertThat(Projects.BUILD.getFullName()).isEqualTo("Spring Data Build");
|
||||
assertThat(Projects.CASSANDRA.getFullName()).isEqualTo("Spring Data for Apache Cassandra");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsAllDependencies() {
|
||||
void returnsAllDependencies() {
|
||||
|
||||
assertThat(Projects.REDIS.getDependencies())//
|
||||
.contains(Projects.COMMONS, Projects.KEY_VALUE, Projects.BUILD);
|
||||
|
||||
@@ -16,47 +16,45 @@
|
||||
|
||||
package org.springframework.data.release.model;
|
||||
|
||||
import static org.hamcrest.core.Is.*;
|
||||
import static org.hamcrest.core.IsEqual.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class TrackerTest {
|
||||
class TrackerTest {
|
||||
|
||||
@Test
|
||||
public void testMatchesTicketNumber() throws Exception {
|
||||
void testMatchesTicketNumber() throws Exception {
|
||||
|
||||
Pattern pattern = Pattern.compile(Tracker.JIRA.getTicketPattern());
|
||||
Matcher matcher = pattern.matcher("DATAREDIS-1");
|
||||
matcher.find();
|
||||
|
||||
assertThat(matcher.group(1), is(equalTo("DATAREDIS-1")));
|
||||
assertThat(matcher.group(1)).isEqualTo("DATAREDIS-1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMatchesBranchNamedLikeTicket() throws Exception {
|
||||
void testMatchesBranchNamedLikeTicket() throws Exception {
|
||||
|
||||
Pattern pattern = Pattern.compile(Tracker.JIRA.getTicketPattern());
|
||||
Matcher matcher = pattern.matcher("issues/DATAREDIS-1-dummy");
|
||||
matcher.find();
|
||||
|
||||
assertThat(matcher.group(1), is(equalTo("DATAREDIS-1")));
|
||||
assertThat(matcher.group(1)).isEqualTo("DATAREDIS-1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVersionBranch() throws Exception {
|
||||
void testVersionBranch() throws Exception {
|
||||
|
||||
Pattern pattern = Pattern.compile(Tracker.GITHUB.getTicketPattern());
|
||||
Matcher matcher = pattern.matcher("1.2.x");
|
||||
matcher.find();
|
||||
|
||||
assertThat(matcher.group(1), is(equalTo("1")));
|
||||
assertThat(matcher.group(1)).isEqualTo("1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,28 +15,27 @@
|
||||
*/
|
||||
package org.springframework.data.release.model;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for release {@link Train}s.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class TrainsUnitTest {
|
||||
class TrainsUnitTest {
|
||||
|
||||
@Test
|
||||
public void prefersNewVersionOfAdditionalModule() {
|
||||
void prefersNewVersionOfAdditionalModule() {
|
||||
|
||||
Module module = ReleaseTrains.HOPPER.getModule(Projects.NEO4J);
|
||||
|
||||
assertThat(module.getVersion(), is(Version.parse("4.1")));
|
||||
assertThat(module.getVersion()).isEqualTo(Version.parse("4.1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addsNewlyAddedModule() {
|
||||
assertThat(ReleaseTrains.HOPPER.getModule(Projects.ENVERS), is(notNullValue()));
|
||||
void addsNewlyAddedModule() {
|
||||
assertThat(ReleaseTrains.HOPPER.getModule(Projects.ENVERS)).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ package org.springframework.data.release.sagan;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
@@ -27,10 +27,10 @@ import org.springframework.data.release.model.ReleaseTrains;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class MaintainedVersionUnitTests {
|
||||
class MaintainedVersionUnitTests {
|
||||
|
||||
@Test
|
||||
public void newerVersionIsOrderedFirst() {
|
||||
void newerVersionIsOrderedFirst() {
|
||||
|
||||
MaintainedVersion ingalls = MaintainedVersion.of(Projects.COMMONS, ArtifactVersion.of("1.13.0.RELEASE"),
|
||||
ReleaseTrains.INGALLS);
|
||||
|
||||
@@ -17,7 +17,7 @@ package org.springframework.data.release.sagan;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
@@ -27,10 +27,10 @@ import org.springframework.data.release.model.ReleaseTrains;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class MaintainedVersionsUnitTests {
|
||||
class MaintainedVersionsUnitTests {
|
||||
|
||||
@Test
|
||||
public void considersMostRecentReleaseVersionTheMainOne() {
|
||||
void considersMostRecentReleaseVersionTheMainOne() {
|
||||
|
||||
MaintainedVersion ingalls = MaintainedVersion.of(Projects.COMMONS, ArtifactVersion.of("1.13.0.RELEASE"),
|
||||
ReleaseTrains.INGALLS);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.release.sagan;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
@@ -28,10 +28,10 @@ import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ProjectMetadataSerializationTests {
|
||||
class ProjectMetadataSerializationTests {
|
||||
|
||||
@Test
|
||||
public void serializesMaintainedVersionsIntoProjectMetadata() throws Exception {
|
||||
void serializesMaintainedVersionsIntoProjectMetadata() throws Exception {
|
||||
|
||||
ObjectWriter mapper = new ObjectMapper().writerWithDefaultPrettyPrinter();
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.release.sagan;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.release.AbstractIntegrationTests;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
@@ -27,14 +28,14 @@ import org.springframework.data.release.model.ReleaseTrains;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Ignore("I will write to production systems")
|
||||
public class SaganOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
@Disabled("I will write to production systems")
|
||||
class SaganOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
@Autowired SaganOperations sagan;
|
||||
@Autowired SaganClient client;
|
||||
|
||||
@Test
|
||||
public void detectVersionsToUpdate() {
|
||||
void detectVersionsToUpdate() {
|
||||
|
||||
sagan.findVersions(ReleaseTrains.LOVELACE, ReleaseTrains.KAY, ReleaseTrains.INGALLS, ReleaseTrains.HOPPER)
|
||||
.forEach((project, versions) -> {
|
||||
@@ -53,12 +54,12 @@ public class SaganOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateVersions() {
|
||||
void updateVersions() {
|
||||
sagan.updateProjectMetadata(ReleaseTrains.KAY, ReleaseTrains.INGALLS, ReleaseTrains.HOPPER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateJpa() {
|
||||
void updateJpa() {
|
||||
|
||||
MaintainedVersions versions = sagan.findVersions(ReleaseTrains.KAY, ReleaseTrains.INGALLS, ReleaseTrains.HOPPER)
|
||||
.get(Projects.JPA);
|
||||
@@ -69,12 +70,12 @@ public class SaganOperationsIntegrationTests extends AbstractIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getJpa() {
|
||||
void getJpa() {
|
||||
System.out.println(client.getProjectMetadata(Projects.JPA));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateBuild() {
|
||||
void updateBuild() {
|
||||
|
||||
MaintainedVersions versions = sagan.findVersions(ReleaseTrains.KAY, ReleaseTrains.INGALLS, ReleaseTrains.HOPPER)
|
||||
.get(Projects.BUILD);
|
||||
|
||||
Reference in New Issue
Block a user