This commit is contained in:
Stephane Nicoll 2017-12-29 14:48:24 +01:00
parent f036a89c77
commit 106642a8d4
2 changed files with 14 additions and 15 deletions

View File

@ -88,12 +88,12 @@ public abstract class AbstractReactiveWebServerFactoryTests {
}
@Test
public void basicSslFromClassPath() throws Exception {
public void basicSslFromClassPath() {
testBasicSslWithKeyStore("classpath:test.jks");
}
@Test
public void basicSslFromFileSystem() throws Exception {
public void basicSslFromFileSystem() {
testBasicSslWithKeyStore("src/test/resources/test.jks");
}

View File

@ -16,7 +16,6 @@
package org.springframework.boot.yaml;
import java.io.IOException;
import java.util.Properties;
import org.junit.Test;
@ -37,42 +36,42 @@ import static org.assertj.core.api.Assertions.assertThat;
public class SpringProfileDocumentMatcherTests {
@Test
public void matchesSingleProfile() throws IOException {
public void matchesSingleProfile() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
Properties properties = getProperties("spring.ProfILEs: foo");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
@Test
public void abstainNoConfiguredProfiles() throws IOException {
public void abstainNoConfiguredProfiles() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
Properties properties = getProperties("some.property: spam");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.ABSTAIN);
}
@Test
public void noActiveProfiles() throws IOException {
public void noActiveProfiles() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher();
Properties properties = getProperties("spring.profiles: bar,spam");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
@Test
public void matchesCommaSeparatedString() throws IOException {
public void matchesCommaSeparatedString() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
Properties properties = getProperties("spring.profiles: bar,spam");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
@Test
public void matchesCommaSeparatedArray() throws IOException {
public void matchesCommaSeparatedArray() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
Properties properties = getProperties("spring.profiles: [bar, spam]");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
@Test
public void matchesList() throws IOException {
public void matchesList() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
Properties properties = getProperties(
String.format("spring.profiles:%n - bar%n - spam"));
@ -80,42 +79,42 @@ public class SpringProfileDocumentMatcherTests {
}
@Test
public void noMatchingProfiles() throws IOException {
public void noMatchingProfiles() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
Properties properties = getProperties("spring.profiles: baz,blah");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
@Test
public void inverseMatchSingle() throws IOException {
public void inverseMatchSingle() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
Properties properties = getProperties("spring.profiles: '!baz'");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
@Test
public void testInverseMatchMulti() throws IOException {
public void testInverseMatchMulti() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar");
Properties properties = getProperties("spring.profiles: '!baz,!blah'");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
@Test
public void negatedWithMatch() throws Exception {
public void negatedWithMatch() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar", "blah");
Properties properties = getProperties("spring.profiles: '!baz,blah'");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.FOUND);
}
@Test
public void negatedWithNoMatch() throws IOException {
public void negatedWithNoMatch() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "bar", "blah");
Properties properties = getProperties("spring.profiles: '!baz,another'");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);
}
@Test
public void negatedTrumpsMatching() throws IOException {
public void negatedTrumpsMatching() {
DocumentMatcher matcher = new SpringProfileDocumentMatcher("foo", "baz", "blah");
Properties properties = getProperties("spring.profiles: '!baz,blah'");
assertThat(matcher.matches(properties)).isEqualTo(MatchStatus.NOT_FOUND);