Use AssertJ in spring-boot-tools
See gh-5083
This commit is contained in:
@@ -36,8 +36,7 @@ import org.springframework.boot.loader.tools.Library;
|
||||
import org.springframework.boot.loader.tools.LibraryCallback;
|
||||
import org.springframework.boot.loader.tools.LibraryScope;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -80,9 +79,9 @@ public class ArtifactsLibrariesTests {
|
||||
this.libs.doWithLibraries(this.callback);
|
||||
verify(this.callback).library(this.libraryCaptor.capture());
|
||||
Library library = this.libraryCaptor.getValue();
|
||||
assertThat(library.getFile(), equalTo(this.file));
|
||||
assertThat(library.getScope(), equalTo(LibraryScope.COMPILE));
|
||||
assertThat(library.isUnpackRequired(), equalTo(false));
|
||||
assertThat(library.getFile()).isEqualTo(this.file);
|
||||
assertThat(library.getScope()).isEqualTo(LibraryScope.COMPILE);
|
||||
assertThat(library.isUnpackRequired()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,7 +97,7 @@ public class ArtifactsLibrariesTests {
|
||||
mock(Log.class));
|
||||
this.libs.doWithLibraries(this.callback);
|
||||
verify(this.callback).library(this.libraryCaptor.capture());
|
||||
assertThat(this.libraryCaptor.getValue().isUnpackRequired(), equalTo(true));
|
||||
assertThat(this.libraryCaptor.getValue().isUnpackRequired()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -117,8 +116,8 @@ public class ArtifactsLibrariesTests {
|
||||
this.libs = new ArtifactsLibraries(this.artifacts, null, mock(Log.class));
|
||||
this.libs.doWithLibraries(this.callback);
|
||||
verify(this.callback, times(2)).library(this.libraryCaptor.capture());
|
||||
assertThat(this.libraryCaptor.getAllValues().get(0).getName(), equalTo("g1-a"));
|
||||
assertThat(this.libraryCaptor.getAllValues().get(1).getName(), equalTo("g2-a"));
|
||||
assertThat(this.libraryCaptor.getAllValues().get(0).getName()).isEqualTo("g1-a");
|
||||
assertThat(this.libraryCaptor.getAllValues().get(1).getName()).isEqualTo("g2-a");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,7 @@ import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@@ -48,8 +47,8 @@ public class DependencyFilterMojoTests {
|
||||
Set<Artifact> artifacts = mojo.filterDependencies(
|
||||
createArtifact("com.foo", "one"), createArtifact("com.foo", "two"),
|
||||
createArtifact("com.bar", "exclude-id"), artifact);
|
||||
assertEquals("wrong filtering of artifacts", 1, artifacts.size());
|
||||
assertSame("Wrong filtered artifact", artifact, artifacts.iterator().next());
|
||||
assertThat(artifacts).hasSize(1);
|
||||
assertThat(artifacts.iterator().next()).isSameAs(artifact);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -61,8 +60,8 @@ public class DependencyFilterMojoTests {
|
||||
Set<Artifact> artifacts = mojo.filterDependencies(
|
||||
createArtifact("com.foo", "one"), createArtifact("com.foo", "two"),
|
||||
artifact);
|
||||
assertEquals("wrong filtering of artifacts", 1, artifacts.size());
|
||||
assertSame("Wrong filtered artifact", artifact, artifacts.iterator().next());
|
||||
assertThat(artifacts).hasSize(1);
|
||||
assertThat(artifacts.iterator().next()).isSameAs(artifact);
|
||||
}
|
||||
|
||||
private Artifact createArtifact(String groupId, String artifactId) {
|
||||
|
||||
@@ -25,8 +25,7 @@ import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@@ -36,7 +35,7 @@ import static org.mockito.Mockito.mock;
|
||||
* @author Stephane Nicoll
|
||||
* @author David Turanski
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class ExcludeFilterTests {
|
||||
|
||||
@Test
|
||||
@@ -45,7 +44,7 @@ public class ExcludeFilterTests {
|
||||
Arrays.asList(createExclude("com.foo", "bar")));
|
||||
Set result = filter
|
||||
.filter(Collections.singleton(createArtifact("com.foo", "bar")));
|
||||
assertEquals("Should have been filtered", 0, result.size());
|
||||
assertThat(result).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -54,8 +53,8 @@ public class ExcludeFilterTests {
|
||||
Arrays.asList(createExclude("com.foo", "bar")));
|
||||
Artifact artifact = createArtifact("com.baz", "bar");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should not have been filtered", 1, result.size());
|
||||
assertSame(artifact, result.iterator().next());
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.iterator().next()).isSameAs(artifact);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -64,8 +63,8 @@ public class ExcludeFilterTests {
|
||||
Arrays.asList(createExclude("com.foo", "bar")));
|
||||
Artifact artifact = createArtifact("com.foo", "biz");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should not have been filtered", 1, result.size());
|
||||
assertSame(artifact, result.iterator().next());
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.iterator().next()).isSameAs(artifact);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -74,7 +73,7 @@ public class ExcludeFilterTests {
|
||||
Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
|
||||
Set result = filter
|
||||
.filter(Collections.singleton(createArtifact("com.foo", "bar", "jdk5")));
|
||||
assertEquals("Should have been filtered", 0, result.size());
|
||||
assertThat(result).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -83,8 +82,8 @@ public class ExcludeFilterTests {
|
||||
Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
|
||||
Artifact artifact = createArtifact("com.foo", "bar");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should not have been filtered", 1, result.size());
|
||||
assertSame(artifact, result.iterator().next());
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.iterator().next()).isSameAs(artifact);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -93,8 +92,8 @@ public class ExcludeFilterTests {
|
||||
Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
|
||||
Artifact artifact = createArtifact("com.foo", "bar", "jdk6");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should not have been filtered", 1, result.size());
|
||||
assertSame(artifact, result.iterator().next());
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.iterator().next()).isSameAs(artifact);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -108,8 +107,8 @@ public class ExcludeFilterTests {
|
||||
Artifact anotherAcme = createArtifact("org.acme", "another-app");
|
||||
artifacts.add(anotherAcme);
|
||||
Set result = filter.filter(artifacts);
|
||||
assertEquals("Two dependencies should have been filtered", 1, result.size());
|
||||
assertSame(anotherAcme, result.iterator().next());
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.iterator().next()).isSameAs(anotherAcme);
|
||||
}
|
||||
|
||||
private Exclude createExclude(String groupId, String artifactId) {
|
||||
|
||||
@@ -25,8 +25,7 @@ import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@@ -35,7 +34,7 @@ import static org.mockito.Mockito.mock;
|
||||
*
|
||||
* @author David Turanski
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class IncludeFilterTests {
|
||||
|
||||
@Test
|
||||
@@ -44,8 +43,8 @@ public class IncludeFilterTests {
|
||||
Arrays.asList(createInclude("com.foo", "bar")));
|
||||
Artifact artifact = createArtifact("com.foo", "bar");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should not have been filtered", 1, result.size());
|
||||
assertSame(artifact, result.iterator().next());
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.iterator().next()).isSameAs(artifact);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -54,7 +53,7 @@ public class IncludeFilterTests {
|
||||
Arrays.asList(createInclude("com.foo", "bar")));
|
||||
Artifact artifact = createArtifact("com.baz", "bar");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should have been filtered", 0, result.size());
|
||||
assertThat(result).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,7 +62,7 @@ public class IncludeFilterTests {
|
||||
Arrays.asList(createInclude("com.foo", "bar")));
|
||||
Artifact artifact = createArtifact("com.foo", "biz");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should have been filtered", 0, result.size());
|
||||
assertThat(result).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -72,8 +71,8 @@ public class IncludeFilterTests {
|
||||
Arrays.asList(createInclude("com.foo", "bar", "jdk5")));
|
||||
Artifact artifact = createArtifact("com.foo", "bar", "jdk5");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should not have been filtered", 1, result.size());
|
||||
assertSame(artifact, result.iterator().next());
|
||||
assertThat(result).hasSize(1);
|
||||
assertThat(result.iterator().next()).isSameAs(artifact);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -82,7 +81,7 @@ public class IncludeFilterTests {
|
||||
Arrays.asList(createInclude("com.foo", "bar", "jdk5")));
|
||||
Artifact artifact = createArtifact("com.foo", "bar");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should have been filtered", 0, result.size());
|
||||
assertThat(result).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -91,7 +90,7 @@ public class IncludeFilterTests {
|
||||
Arrays.asList(createInclude("com.foo", "bar", "jdk5")));
|
||||
Artifact artifact = createArtifact("com.foo", "bar", "jdk6");
|
||||
Set result = filter.filter(Collections.singleton(artifact));
|
||||
assertEquals("Should have been filtered", 0, result.size());
|
||||
assertThat(result).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -105,7 +104,7 @@ public class IncludeFilterTests {
|
||||
Artifact anotherAcme = createArtifact("org.acme", "another-app");
|
||||
artifacts.add(anotherAcme);
|
||||
Set result = filter.filter(artifacts);
|
||||
assertEquals("One dependency should have been filtered", 2, result.size());
|
||||
assertThat(result).hasSize(2);
|
||||
}
|
||||
|
||||
private Include createInclude(String groupId, String artifactId) {
|
||||
|
||||
@@ -22,10 +22,7 @@ import java.util.jar.JarOutputStream;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link PropertiesMergingResourceTransformer}.
|
||||
@@ -38,10 +35,10 @@ public class PropertiesMergingResourceTransformerTests {
|
||||
|
||||
@Test
|
||||
public void testProcess() throws Exception {
|
||||
assertFalse(this.transformer.hasTransformedResource());
|
||||
assertThat(this.transformer.hasTransformedResource()).isFalse();
|
||||
this.transformer.processResource("foo",
|
||||
new ByteArrayInputStream("foo=bar".getBytes()), null);
|
||||
assertTrue(this.transformer.hasTransformedResource());
|
||||
assertThat(this.transformer.hasTransformedResource()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -50,7 +47,7 @@ public class PropertiesMergingResourceTransformerTests {
|
||||
new ByteArrayInputStream("foo=bar".getBytes()), null);
|
||||
this.transformer.processResource("bar",
|
||||
new ByteArrayInputStream("foo=spam".getBytes()), null);
|
||||
assertEquals("bar,spam", this.transformer.getData().getProperty("foo"));
|
||||
assertThat(this.transformer.getData().getProperty("foo")).isEqualTo("bar,spam");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,8 +60,8 @@ public class PropertiesMergingResourceTransformerTests {
|
||||
this.transformer.modifyOutputStream(os);
|
||||
os.flush();
|
||||
os.close();
|
||||
assertNotNull(out.toByteArray());
|
||||
assertTrue(out.toByteArray().length > 0);
|
||||
assertThat(out.toByteArray()).isNotNull();
|
||||
assertThat(out.toByteArray().length > 0).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ package org.springframework.boot.maven;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link RunArguments}.
|
||||
@@ -31,48 +30,48 @@ public class RunArgumentsTests {
|
||||
@Test
|
||||
public void parseNull() {
|
||||
String[] args = parseArgs(null);
|
||||
assertNotNull(args);
|
||||
assertEquals(0, args.length);
|
||||
assertThat(args).isNotNull();
|
||||
assertThat(args.length).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseEmpty() {
|
||||
String[] args = parseArgs(" ");
|
||||
assertNotNull(args);
|
||||
assertEquals(0, args.length);
|
||||
assertThat(args).isNotNull();
|
||||
assertThat(args.length).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseDebugFlags() {
|
||||
String[] args = parseArgs(
|
||||
"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
|
||||
assertEquals(2, args.length);
|
||||
assertEquals("-Xdebug", args[0]);
|
||||
assertEquals("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005",
|
||||
args[1]);
|
||||
assertThat(args.length).isEqualTo(2);
|
||||
assertThat(args[0]).isEqualTo("-Xdebug");
|
||||
assertThat(args[1]).isEqualTo(
|
||||
"-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseWithExtraSpaces() {
|
||||
String[] args = parseArgs(" -Dfoo=bar -Dfoo2=bar2 ");
|
||||
assertEquals(2, args.length);
|
||||
assertEquals("-Dfoo=bar", args[0]);
|
||||
assertEquals("-Dfoo2=bar2", args[1]);
|
||||
assertThat(args.length).isEqualTo(2);
|
||||
assertThat(args[0]).isEqualTo("-Dfoo=bar");
|
||||
assertThat(args[1]).isEqualTo("-Dfoo2=bar2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseWithNewLinesAndTabs() {
|
||||
String[] args = parseArgs(" -Dfoo=bar \n" + "\t\t -Dfoo2=bar2 ");
|
||||
assertEquals(2, args.length);
|
||||
assertEquals("-Dfoo=bar", args[0]);
|
||||
assertEquals("-Dfoo2=bar2", args[1]);
|
||||
assertThat(args.length).isEqualTo(2);
|
||||
assertThat(args[0]).isEqualTo("-Dfoo=bar");
|
||||
assertThat(args[1]).isEqualTo("-Dfoo2=bar2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quoteHandledProperly() {
|
||||
String[] args = parseArgs("-Dvalue=\"My Value\" ");
|
||||
assertEquals(1, args.length);
|
||||
assertEquals("-Dvalue=My Value", args[0]);
|
||||
assertThat(args.length).isEqualTo(1);
|
||||
assertThat(args[0]).isEqualTo("-Dvalue=My Value");
|
||||
}
|
||||
|
||||
private String[] parseArgs(String args) {
|
||||
|
||||
@@ -28,11 +28,7 @@ import java.util.zip.ZipFile;
|
||||
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Verification utility for use with maven-invoker-plugin verification scripts.
|
||||
@@ -107,13 +103,15 @@ public final class Verify {
|
||||
}
|
||||
|
||||
public void assertHasNonUnpackEntry(String entryName) {
|
||||
assertTrue("Entry starting with " + entryName + " was an UNPACK entry",
|
||||
hasNonUnpackEntry(entryName));
|
||||
assertThat(hasNonUnpackEntry(entryName))
|
||||
.as("Entry starting with " + entryName + " was an UNPACK entry")
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
public void assertHasUnpackEntry(String entryName) {
|
||||
assertTrue("Entry starting with " + entryName + " was not an UNPACK entry",
|
||||
hasUnpackEntry(entryName));
|
||||
assertThat(hasUnpackEntry(entryName))
|
||||
.as("Entry starting with " + entryName + " was not an UNPACK entry")
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
private boolean hasNonUnpackEntry(String entryName) {
|
||||
@@ -167,22 +165,21 @@ public final class Verify {
|
||||
|
||||
public void verify(boolean executable, String... scriptContents)
|
||||
throws Exception {
|
||||
assertTrue("Archive missing", this.file.exists());
|
||||
assertTrue("Archive not a file", this.file.isFile());
|
||||
assertThat(this.file).exists().isFile();
|
||||
|
||||
if (scriptContents.length > 0 && executable) {
|
||||
String contents = new String(FileCopyUtils.copyToByteArray(this.file));
|
||||
contents = contents.substring(0, contents
|
||||
.indexOf(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 })));
|
||||
for (String content : scriptContents) {
|
||||
assertThat(contents, containsString(content));
|
||||
assertThat(contents).contains(content);
|
||||
}
|
||||
}
|
||||
|
||||
if (!executable) {
|
||||
String contents = new String(FileCopyUtils.copyToByteArray(this.file));
|
||||
assertTrue("Is executable", contents
|
||||
.startsWith(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 })));
|
||||
assertThat(contents).as("Is executable")
|
||||
.startsWith(new String(new byte[] { 0x50, 0x4b, 0x03, 0x04 }));
|
||||
}
|
||||
|
||||
ZipFile zipFile = new ZipFile(this.file);
|
||||
@@ -224,18 +221,21 @@ public final class Verify {
|
||||
verifier.assertHasEntryNameStartingWith("lib/spring-context");
|
||||
verifier.assertHasEntryNameStartingWith("lib/spring-core");
|
||||
verifier.assertHasEntryNameStartingWith("lib/javax.servlet-api-3");
|
||||
assertTrue("Unpacked launcher classes", verifier
|
||||
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"));
|
||||
assertTrue("Own classes",
|
||||
verifier.hasEntry("org/" + "test/SampleApplication.class"));
|
||||
assertThat(verifier
|
||||
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"))
|
||||
.as("Unpacked launcher classes").isTrue();
|
||||
assertThat(verifier.hasEntry("org/" + "test/SampleApplication.class"))
|
||||
.as("Own classes").isTrue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verifyManifest(Manifest manifest) throws Exception {
|
||||
assertEquals("org.springframework.boot.loader.JarLauncher",
|
||||
manifest.getMainAttributes().getValue("Main-Class"));
|
||||
assertEquals(this.main, manifest.getMainAttributes().getValue("Start-Class"));
|
||||
assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used"));
|
||||
assertThat(manifest.getMainAttributes().getValue("Main-Class"))
|
||||
.isEqualTo("org.springframework.boot.loader.JarLauncher");
|
||||
assertThat(manifest.getMainAttributes().getValue("Start-Class"))
|
||||
.isEqualTo(this.main);
|
||||
assertThat(manifest.getMainAttributes().getValue("Not-Used"))
|
||||
.isEqualTo("Foo");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,20 +252,23 @@ public final class Verify {
|
||||
verifier.assertHasEntryNameStartingWith("WEB-INF/lib/spring-core");
|
||||
verifier.assertHasEntryNameStartingWith(
|
||||
"WEB-INF/lib-provided/javax.servlet-api-3");
|
||||
assertTrue("Unpacked launcher classes", verifier
|
||||
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"));
|
||||
assertTrue("Own classes", verifier
|
||||
.hasEntry("WEB-INF/classes/org/" + "test/SampleApplication.class"));
|
||||
assertTrue("Web content", verifier.hasEntry("index.html"));
|
||||
assertThat(verifier
|
||||
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"))
|
||||
.as("Unpacked launcher classes").isTrue();
|
||||
assertThat(verifier
|
||||
.hasEntry("WEB-INF/classes/org/" + "test/SampleApplication.class"))
|
||||
.as("Own classes").isTrue();
|
||||
assertThat(verifier.hasEntry("index.html")).as("Web content").isTrue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verifyManifest(Manifest manifest) throws Exception {
|
||||
assertEquals("org.springframework.boot.loader.WarLauncher",
|
||||
manifest.getMainAttributes().getValue("Main-Class"));
|
||||
assertEquals("org.test.SampleApplication",
|
||||
manifest.getMainAttributes().getValue("Start-Class"));
|
||||
assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used"));
|
||||
assertThat(manifest.getMainAttributes().getValue("Main-Class"))
|
||||
.isEqualTo("org.springframework.boot.loader.WarLauncher");
|
||||
assertThat(manifest.getMainAttributes().getValue("Start-Class"))
|
||||
.isEqualTo("org.test.SampleApplication");
|
||||
assertThat(manifest.getMainAttributes().getValue("Not-Used"))
|
||||
.isEqualTo("Foo");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,11 +280,12 @@ public final class Verify {
|
||||
|
||||
@Override
|
||||
protected void verifyManifest(Manifest manifest) throws Exception {
|
||||
assertEquals("org.springframework.boot.loader.PropertiesLauncher",
|
||||
manifest.getMainAttributes().getValue("Main-Class"));
|
||||
assertEquals("org.test.SampleApplication",
|
||||
manifest.getMainAttributes().getValue("Start-Class"));
|
||||
assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used"));
|
||||
assertThat(manifest.getMainAttributes().getValue("Main-Class"))
|
||||
.isEqualTo("org.springframework.boot.loader.PropertiesLauncher");
|
||||
assertThat(manifest.getMainAttributes().getValue("Start-Class"))
|
||||
.isEqualTo("org.test.SampleApplication");
|
||||
assertThat(manifest.getMainAttributes().getValue("Not-Used"))
|
||||
.isEqualTo("Foo");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,10 +301,11 @@ public final class Verify {
|
||||
verifier.assertHasEntryNameStartingWith("lib/spring-context");
|
||||
verifier.assertHasEntryNameStartingWith("lib/spring-core");
|
||||
verifier.assertHasNoEntryNameStartingWith("lib/javax.servlet-api-3");
|
||||
assertFalse("Unpacked launcher classes", verifier
|
||||
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"));
|
||||
assertTrue("Own classes",
|
||||
verifier.hasEntry("org/" + "test/SampleModule.class"));
|
||||
assertThat(verifier
|
||||
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"))
|
||||
.as("Unpacked launcher classes").isFalse();
|
||||
assertThat(verifier.hasEntry("org/" + "test/SampleModule.class"))
|
||||
.as("Own classes").isTrue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user