Polish
This commit is contained in:
@@ -891,7 +891,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
||||
assertThat(metadata).doesNotHave(Metadata.withProperty(prefix + ".ignored"));
|
||||
}
|
||||
|
||||
private ConfigurationMetadata compile(Class<?>... types) throws IOException {
|
||||
private ConfigurationMetadata compile(Class<?>... types) {
|
||||
TestConfigurationMetadataAnnotationProcessor processor = new TestConfigurationMetadataAnnotationProcessor(
|
||||
this.compiler.getOutputLocation());
|
||||
this.compiler.getTask(types).call(processor);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class LayoutsTests {
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void jarFile() throws Exception {
|
||||
public void jarFile() {
|
||||
assertThat(Layouts.forFile(new File("test.jar"))).isInstanceOf(Layouts.Jar.class);
|
||||
assertThat(Layouts.forFile(new File("test.JAR"))).isInstanceOf(Layouts.Jar.class);
|
||||
assertThat(Layouts.forFile(new File("test.jAr"))).isInstanceOf(Layouts.Jar.class);
|
||||
@@ -45,7 +45,7 @@ public class LayoutsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void warFile() throws Exception {
|
||||
public void warFile() {
|
||||
assertThat(Layouts.forFile(new File("test.war"))).isInstanceOf(Layouts.War.class);
|
||||
assertThat(Layouts.forFile(new File("test.WAR"))).isInstanceOf(Layouts.War.class);
|
||||
assertThat(Layouts.forFile(new File("test.wAr"))).isInstanceOf(Layouts.War.class);
|
||||
@@ -54,14 +54,14 @@ public class LayoutsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unknownFile() throws Exception {
|
||||
public void unknownFile() {
|
||||
this.thrown.expect(IllegalStateException.class);
|
||||
this.thrown.expectMessage("Unable to deduce layout for 'test.txt'");
|
||||
Layouts.forFile(new File("test.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jarLayout() throws Exception {
|
||||
public void jarLayout() {
|
||||
Layout layout = new Layouts.Jar();
|
||||
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.COMPILE))
|
||||
.isEqualTo("BOOT-INF/lib/");
|
||||
@@ -74,7 +74,7 @@ public class LayoutsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void warLayout() throws Exception {
|
||||
public void warLayout() {
|
||||
Layout layout = new Layouts.War();
|
||||
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.COMPILE))
|
||||
.isEqualTo("WEB-INF/lib/");
|
||||
|
||||
@@ -86,19 +86,19 @@ public class RepackagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullSource() throws Exception {
|
||||
public void nullSource() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
new Repackager(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingSource() throws Exception {
|
||||
public void missingSource() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
new Repackager(new File("missing"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void directorySource() throws Exception {
|
||||
public void directorySource() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
new Repackager(this.temporaryFolder.getRoot());
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class PropertiesLauncherTests {
|
||||
private ClassLoader contextClassLoader;
|
||||
|
||||
@Before
|
||||
public void setup() throws IOException {
|
||||
public void setup() {
|
||||
this.contextClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
MockitoAnnotations.initMocks(this);
|
||||
System.setProperty("loader.home",
|
||||
@@ -102,7 +102,7 @@ public class PropertiesLauncherTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonExistentHome() throws Exception {
|
||||
public void testNonExistentHome() {
|
||||
System.setProperty("loader.home", "src/test/resources/nonexistent");
|
||||
this.expected.expectMessage("Invalid source folder");
|
||||
PropertiesLauncher launcher = new PropertiesLauncher();
|
||||
@@ -134,7 +134,7 @@ public class PropertiesLauncherTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUserSpecifiedDotPath() throws Exception {
|
||||
public void testUserSpecifiedDotPath() {
|
||||
System.setProperty("loader.path", ".");
|
||||
PropertiesLauncher launcher = new PropertiesLauncher();
|
||||
assertThat(ReflectionTestUtils.getField(launcher, "paths").toString())
|
||||
@@ -299,7 +299,7 @@ public class PropertiesLauncherTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSystemPropertiesSet() throws Exception {
|
||||
public void testSystemPropertiesSet() {
|
||||
System.setProperty("loader.system", "true");
|
||||
new PropertiesLauncher();
|
||||
assertThat(System.getProperty("loader.main")).isEqualTo("demo.Application");
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ExplodedArchiveTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEntries() throws Exception {
|
||||
public void getEntries() {
|
||||
Map<String, Archive.Entry> entries = getEntriesMap(this.archive);
|
||||
assertThat(entries.size()).isEqualTo(10);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class ExplodedArchiveTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getNonRecursiveEntriesForRoot() throws Exception {
|
||||
public void getNonRecursiveEntriesForRoot() {
|
||||
ExplodedArchive archive = new ExplodedArchive(new File("/"), false);
|
||||
Map<String, Archive.Entry> entries = getEntriesMap(archive);
|
||||
assertThat(entries.size()).isGreaterThan(1);
|
||||
|
||||
@@ -80,7 +80,7 @@ public class JarFileArchiveTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEntries() throws Exception {
|
||||
public void getEntries() {
|
||||
Map<String, Archive.Entry> entries = getEntriesMap(this.archive);
|
||||
assertThat(entries.size()).isEqualTo(10);
|
||||
}
|
||||
|
||||
@@ -94,28 +94,28 @@ public class RandomAccessDataFileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fileNotNull() throws Exception {
|
||||
public void fileNotNull() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expectMessage("File must not be null");
|
||||
new RandomAccessDataFile(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fileExists() throws Exception {
|
||||
public void fileExists() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expectMessage("File must exist");
|
||||
new RandomAccessDataFile(new File("/does/not/exist"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fileNotNullWithConcurrentReads() throws Exception {
|
||||
public void fileNotNullWithConcurrentReads() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expectMessage("File must not be null");
|
||||
new RandomAccessDataFile(null, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fileExistsWithConcurrentReads() throws Exception {
|
||||
public void fileExistsWithConcurrentReads() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expectMessage("File must exist");
|
||||
new RandomAccessDataFile(new File("/does/not/exist"), 1);
|
||||
@@ -206,13 +206,13 @@ public class RandomAccessDataFileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subsectionNegativeOffset() throws Exception {
|
||||
public void subsectionNegativeOffset() {
|
||||
this.thrown.expect(IndexOutOfBoundsException.class);
|
||||
this.file.getSubsection(-1, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subsectionNegativeLength() throws Exception {
|
||||
public void subsectionNegativeLength() {
|
||||
this.thrown.expect(IndexOutOfBoundsException.class);
|
||||
this.file.getSubsection(0, -1);
|
||||
}
|
||||
@@ -225,14 +225,14 @@ public class RandomAccessDataFileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subsectionTooBig() throws Exception {
|
||||
public void subsectionTooBig() {
|
||||
this.file.getSubsection(0, 256);
|
||||
this.thrown.expect(IndexOutOfBoundsException.class);
|
||||
this.file.getSubsection(0, 257);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subsectionTooBigWithOffset() throws Exception {
|
||||
public void subsectionTooBigWithOffset() {
|
||||
this.file.getSubsection(1, 255);
|
||||
this.thrown.expect(IndexOutOfBoundsException.class);
|
||||
this.file.getSubsection(1, 256);
|
||||
@@ -278,7 +278,7 @@ public class RandomAccessDataFileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFile() throws Exception {
|
||||
public void getFile() {
|
||||
assertThat(this.file.getFile()).isEqualTo(this.tempFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,25 +34,25 @@ public class AsciiBytesTests {
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void createFromBytes() throws Exception {
|
||||
public void createFromBytes() {
|
||||
AsciiBytes bytes = new AsciiBytes(new byte[] { 65, 66 });
|
||||
assertThat(bytes.toString()).isEqualTo("AB");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createFromBytesWithOffset() throws Exception {
|
||||
public void createFromBytesWithOffset() {
|
||||
AsciiBytes bytes = new AsciiBytes(new byte[] { 65, 66, 67, 68 }, 1, 2);
|
||||
assertThat(bytes.toString()).isEqualTo("BC");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createFromString() throws Exception {
|
||||
public void createFromString() {
|
||||
AsciiBytes bytes = new AsciiBytes("AB");
|
||||
assertThat(bytes.toString()).isEqualTo("AB");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void length() throws Exception {
|
||||
public void length() {
|
||||
AsciiBytes b1 = new AsciiBytes(new byte[] { 65, 66 });
|
||||
AsciiBytes b2 = new AsciiBytes(new byte[] { 65, 66, 67, 68 }, 1, 2);
|
||||
assertThat(b1.length()).isEqualTo(2);
|
||||
@@ -60,7 +60,7 @@ public class AsciiBytesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startWith() throws Exception {
|
||||
public void startWith() {
|
||||
AsciiBytes abc = new AsciiBytes(new byte[] { 65, 66, 67 });
|
||||
AsciiBytes ab = new AsciiBytes(new byte[] { 65, 66 });
|
||||
AsciiBytes bc = new AsciiBytes(new byte[] { 65, 66, 67 }, 1, 2);
|
||||
@@ -72,7 +72,7 @@ public class AsciiBytesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void endsWith() throws Exception {
|
||||
public void endsWith() {
|
||||
AsciiBytes abc = new AsciiBytes(new byte[] { 65, 66, 67 });
|
||||
AsciiBytes bc = new AsciiBytes(new byte[] { 65, 66, 67 }, 1, 2);
|
||||
AsciiBytes ab = new AsciiBytes(new byte[] { 65, 66 });
|
||||
@@ -84,7 +84,7 @@ public class AsciiBytesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void substringFromBeingIndex() throws Exception {
|
||||
public void substringFromBeingIndex() {
|
||||
AsciiBytes abcd = new AsciiBytes(new byte[] { 65, 66, 67, 68 });
|
||||
assertThat(abcd.substring(0).toString()).isEqualTo("ABCD");
|
||||
assertThat(abcd.substring(1).toString()).isEqualTo("BCD");
|
||||
@@ -96,7 +96,7 @@ public class AsciiBytesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void substring() throws Exception {
|
||||
public void substring() {
|
||||
AsciiBytes abcd = new AsciiBytes(new byte[] { 65, 66, 67, 68 });
|
||||
assertThat(abcd.substring(0, 4).toString()).isEqualTo("ABCD");
|
||||
assertThat(abcd.substring(1, 3).toString()).isEqualTo("BC");
|
||||
@@ -107,7 +107,7 @@ public class AsciiBytesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appendString() throws Exception {
|
||||
public void appendString() {
|
||||
AsciiBytes bc = new AsciiBytes(new byte[] { 65, 66, 67, 68 }, 1, 2);
|
||||
AsciiBytes appended = bc.append("D");
|
||||
assertThat(bc.toString()).isEqualTo("BC");
|
||||
@@ -115,7 +115,7 @@ public class AsciiBytesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appendBytes() throws Exception {
|
||||
public void appendBytes() {
|
||||
AsciiBytes bc = new AsciiBytes(new byte[] { 65, 66, 67, 68 }, 1, 2);
|
||||
AsciiBytes appended = bc.append(new byte[] { 68 });
|
||||
assertThat(bc.toString()).isEqualTo("BC");
|
||||
@@ -123,7 +123,7 @@ public class AsciiBytesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeAndEquals() throws Exception {
|
||||
public void hashCodeAndEquals() {
|
||||
AsciiBytes abcd = new AsciiBytes(new byte[] { 65, 66, 67, 68 });
|
||||
AsciiBytes bc = new AsciiBytes(new byte[] { 66, 67 });
|
||||
AsciiBytes bc_substring = new AsciiBytes(new byte[] { 65, 66, 67, 68 })
|
||||
@@ -140,22 +140,22 @@ public class AsciiBytesTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeSameAsString() throws Exception {
|
||||
public void hashCodeSameAsString() {
|
||||
hashCodeSameAsString("abcABC123xyz!");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeSameAsStringWithSpecial() throws Exception {
|
||||
public void hashCodeSameAsStringWithSpecial() {
|
||||
hashCodeSameAsString("special/\u00EB.dat");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeSameAsStringWithCyrillicCharacters() throws Exception {
|
||||
public void hashCodeSameAsStringWithCyrillicCharacters() {
|
||||
hashCodeSameAsString("\u0432\u0435\u0441\u043D\u0430");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeSameAsStringWithEmoji() throws Exception {
|
||||
public void hashCodeSameAsStringWithEmoji() {
|
||||
hashCodeSameAsString("\ud83d\udca9");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.loader.jar.JarURLConnection.JarEntryName;
|
||||
@@ -49,8 +47,7 @@ public class JarEntryNameTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nameWithMixtureOfEncodedAndUnencodedDoubleByteCharacters()
|
||||
throws UnsupportedEncodingException {
|
||||
public void nameWithMixtureOfEncodedAndUnencodedDoubleByteCharacters() {
|
||||
assertThat(new JarEntryName("%c3%a1/b/\u00c7.class").toString())
|
||||
.isEqualTo("\u00e1/b/\u00c7.class");
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class JarFileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEntries() throws Exception {
|
||||
public void getEntries() {
|
||||
Enumeration<java.util.jar.JarEntry> entries = this.jarFile.entries();
|
||||
assertThat(entries.nextElement().getName()).isEqualTo("META-INF/");
|
||||
assertThat(entries.nextElement().getName()).isEqualTo("META-INF/MANIFEST.MF");
|
||||
@@ -146,7 +146,7 @@ public class JarFileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getJarEntry() throws Exception {
|
||||
public void getJarEntry() {
|
||||
java.util.jar.JarEntry entry = this.jarFile.getJarEntry("1.dat");
|
||||
assertThat(entry).isNotNull();
|
||||
assertThat(entry.getName()).isEqualTo("1.dat");
|
||||
@@ -163,12 +163,12 @@ public class JarFileTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getName() throws Exception {
|
||||
public void getName() {
|
||||
assertThat(this.jarFile.getName()).isEqualTo(this.rootJarFile.getPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSize() throws Exception {
|
||||
public void getSize() {
|
||||
assertThat(this.jarFile.size()).isEqualTo((int) this.rootJarFile.length());
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.Set;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
|
||||
import org.apache.maven.shared.artifact.filter.collection.ScopeFilter;
|
||||
import org.junit.Test;
|
||||
@@ -153,7 +152,7 @@ public class DependencyFilterMojoTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
public void execute() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class AbstractConfigurationClassTests {
|
||||
private ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
|
||||
@Test
|
||||
public void allBeanMethodsArePublic() throws IOException, ClassNotFoundException {
|
||||
public void allBeanMethodsArePublic() throws IOException {
|
||||
Set<String> nonPublicBeanMethods = new HashSet<>();
|
||||
for (AnnotationMetadata configurationClass : findConfigurationClasses()) {
|
||||
Set<MethodMetadata> beanMethods = configurationClass
|
||||
|
||||
Reference in New Issue
Block a user