Merge branch '1.5.x' into 2.0.x
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -149,6 +150,15 @@ public class JarURLConnectionTests {
|
||||
.hasSameContentAs(new ByteArrayInputStream(new byte[] { 3 }));
|
||||
}
|
||||
|
||||
@Test(expected = FileNotFoundException.class)
|
||||
public void connectionToEntryUsingWrongAbsoluteUrlForEntryFromNestedJarFile()
|
||||
throws Exception {
|
||||
URL url = new URL("jar:file:" + getAbsolutePath() + "!/w.jar!/3.dat");
|
||||
JarFile nested = this.jarFile
|
||||
.getNestedJarFile(this.jarFile.getEntry("nested.jar"));
|
||||
JarURLConnection.get(url, nested).getInputStream();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getContentLengthReturnsLengthOfUnderlyingEntry() throws Exception {
|
||||
URL url = new URL(new URL("jar", null, -1,
|
||||
|
||||
@@ -167,4 +167,46 @@ public class StringSequenceTests {
|
||||
assertThat(a).isEqualTo(b).isNotEqualTo(c);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startsWithWhenExactMatch() {
|
||||
assertThat(new StringSequence("abc").startsWith("abc")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startsWithWhenLongerAndStartsWith() {
|
||||
assertThat(new StringSequence("abcd").startsWith("abc")).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startsWithWhenLongerAndDoesNotStartWith() {
|
||||
assertThat(new StringSequence("abcd").startsWith("abx")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startsWithWhenShorterAndDoesNotStartWith() {
|
||||
assertThat(new StringSequence("ab").startsWith("abc")).isFalse();
|
||||
assertThat(new StringSequence("ab").startsWith("c")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startsWithOffsetWhenExactMatch() {
|
||||
assertThat(new StringSequence("xabc").startsWith("abc", 1)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startsWithOffsetWhenLongerAndStartsWith() {
|
||||
assertThat(new StringSequence("xabcd").startsWith("abc", 1)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startsWithOffsetWhenLongerAndDoesNotStartWith() {
|
||||
assertThat(new StringSequence("xabcd").startsWith("abx", 1)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startsWithOffsetWhenShorterAndDoesNotStartWith() {
|
||||
assertThat(new StringSequence("xab").startsWith("abc", 1)).isFalse();
|
||||
assertThat(new StringSequence("xab").startsWith("c", 1)).isFalse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user