Merge branch '2.7.x' into 3.0.x

This commit is contained in:
Phillip Webb
2023-02-21 23:15:40 -08:00
1890 changed files with 27173 additions and 21952 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 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.
@@ -83,14 +83,15 @@ class CommandTests {
void runWithUnknownOptionThrowsException() {
TestCommand command = new TestCommand("test", VERBOSE_FLAG, LOG_LEVEL_OPTION);
assertThatExceptionOfType(UnknownOptionException.class).isThrownBy(() -> run(command, "--invalid"))
.withMessage("--invalid");
.withMessage("--invalid");
}
@Test
void runWithOptionMissingRequiredValueThrowsException() {
TestCommand command = new TestCommand("test", VERBOSE_FLAG, LOG_LEVEL_OPTION);
assertThatExceptionOfType(MissingValueException.class)
.isThrownBy(() -> run(command, "--verbose", "--log-level")).withMessage("--log-level");
.isThrownBy(() -> run(command, "--verbose", "--log-level"))
.withMessage("--log-level");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -39,7 +39,7 @@ class ContextTests {
@Test
void createWhenSourceIsNullThrowsException() {
assertThatIllegalStateException().isThrownBy(() -> new Context(null, this.temp))
.withMessage("Unable to find source archive");
.withMessage("Unable to find source archive");
}
@Test
@@ -47,7 +47,7 @@ class ContextTests {
File directory = new File(this.temp, "test");
directory.mkdir();
assertThatIllegalStateException().isThrownBy(() -> new Context(directory, this.temp))
.withMessage("Unable to find source archive");
.withMessage("Unable to find source archive");
}
@Test
@@ -55,7 +55,7 @@ class ContextTests {
File zip = new File(this.temp, "test.zip");
Files.createFile(zip.toPath());
assertThatIllegalStateException().isThrownBy(() -> new Context(zip, this.temp))
.withMessageContaining("test.zip must end with .jar or .war");
.withMessageContaining("test.zip must end with .jar or .war");
}
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@@ -103,16 +103,16 @@ class ExtractCommandTests {
private void timeAttributes(File file) {
try {
BasicFileAttributes basicAttributes = Files
.getFileAttributeView(file.toPath(), BasicFileAttributeView.class, new LinkOption[0])
.readAttributes();
.getFileAttributeView(file.toPath(), BasicFileAttributeView.class, new LinkOption[0])
.readAttributes();
assertThat(basicAttributes.lastModifiedTime().to(TimeUnit.SECONDS))
.isEqualTo(LAST_MODIFIED_TIME.to(TimeUnit.SECONDS));
.isEqualTo(LAST_MODIFIED_TIME.to(TimeUnit.SECONDS));
assertThat(basicAttributes.creationTime().to(TimeUnit.SECONDS)).satisfiesAnyOf(
(creationTime) -> assertThat(creationTime).isEqualTo(CREATION_TIME.to(TimeUnit.SECONDS)),
// On macOS (at least) the creation time is the last modified time
(creationTime) -> assertThat(creationTime).isEqualTo(LAST_MODIFIED_TIME.to(TimeUnit.SECONDS)));
assertThat(basicAttributes.lastAccessTime().to(TimeUnit.SECONDS))
.isEqualTo(LAST_ACCESS_TIME.to(TimeUnit.SECONDS));
.isEqualTo(LAST_ACCESS_TIME.to(TimeUnit.SECONDS));
}
catch (IOException ex) {
throw new RuntimeException(ex);
@@ -151,8 +151,8 @@ class ExtractCommandTests {
given(this.context.getArchiveFile()).willReturn(file);
given(this.context.getWorkingDir()).willReturn(this.extract);
assertThatIllegalStateException()
.isThrownBy(() -> this.command.run(Collections.emptyMap(), Collections.emptyList()))
.withMessageContaining("not compatible with layertools");
.isThrownBy(() -> this.command.run(Collections.emptyMap(), Collections.emptyList()))
.withMessageContaining("not compatible with layertools");
}
@Test
@@ -168,8 +168,8 @@ class ExtractCommandTests {
});
given(this.context.getArchiveFile()).willReturn(this.jarFile);
assertThatIllegalStateException()
.isThrownBy(() -> this.command.run(Collections.emptyMap(), Collections.emptyList()))
.withMessageContaining("Entry 'e/../../e.jar' would be written");
.isThrownBy(() -> this.command.run(Collections.emptyMap(), Collections.emptyList()))
.withMessageContaining("Entry 'e/../../e.jar' would be written");
}
private File createJarFile(String name) throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2023 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.
@@ -47,13 +47,13 @@ class IndexedLayersTests {
@Test
void createWhenIndexFileIsEmptyThrowsException() {
assertThatIllegalStateException().isThrownBy(() -> new IndexedLayers(" \n "))
.withMessage("Empty layer index file loaded");
.withMessage("Empty layer index file loaded");
}
@Test
void createWhenIndexFileIsMalformedThrowsException() {
assertThatIllegalStateException().isThrownBy(() -> new IndexedLayers("test"))
.withMessage("Layer index file is malformed");
.withMessage("Layer index file is malformed");
}
@Test
@@ -73,7 +73,7 @@ class IndexedLayersTests {
void getLayerWhenMatchesNameForMissingLayerThrowsException() throws Exception {
IndexedLayers layers = new IndexedLayers(getIndex());
assertThatIllegalStateException().isThrownBy(() -> layers.getLayer(mockEntry("file.jar")))
.withMessage("No layer defined in index for file " + "'file.jar'");
.withMessage("No layer defined in index for file " + "'file.jar'");
}
@Test