Commit 98a2a91d authored by Phillip Webb's avatar Phillip Webb

Polish

parent ebb2f70e
...@@ -40,7 +40,6 @@ public final class WebMvcTags { ...@@ -40,7 +40,6 @@ public final class WebMvcTags {
private static final Tag URI_REDIRECTION = Tag.of("uri", "REDIRECTION"); private static final Tag URI_REDIRECTION = Tag.of("uri", "REDIRECTION");
private WebMvcTags() { private WebMvcTags() {
} }
...@@ -110,10 +109,9 @@ public final class WebMvcTags { ...@@ -110,10 +109,9 @@ public final class WebMvcTags {
} }
private static String getPathInfo(HttpServletRequest request) { private static String getPathInfo(HttpServletRequest request) {
String uri = StringUtils.hasText(request.getPathInfo()) ? String pathInfo = request.getPathInfo();
request.getPathInfo() : "/"; String uri = (StringUtils.hasText(pathInfo) ? pathInfo : "/");
return uri.replaceAll("//+", "/") return uri.replaceAll("//+", "/").replaceAll("/$", "");
.replaceAll("/$", "");
} }
/** /**
......
...@@ -79,4 +79,5 @@ public class WebMvcTagsTests { ...@@ -79,4 +79,5 @@ public class WebMvcTagsTests {
Tag tag = WebMvcTags.uri(null, null); Tag tag = WebMvcTags.uri(null, null);
assertThat(tag.getValue()).isEqualTo("UNKNOWN"); assertThat(tag.getValue()).isEqualTo("UNKNOWN");
} }
} }
...@@ -122,6 +122,7 @@ public class IntegrationAutoConfiguration { ...@@ -122,6 +122,7 @@ public class IntegrationAutoConfiguration {
@Configuration @Configuration
@EnableIntegrationManagement(defaultCountsEnabled = "true") @EnableIntegrationManagement(defaultCountsEnabled = "true")
protected static class EnableIntegrationManagementConfiguration { protected static class EnableIntegrationManagementConfiguration {
} }
} }
......
...@@ -137,20 +137,20 @@ public class JooqAutoConfigurationTests { ...@@ -137,20 +137,20 @@ public class JooqAutoConfigurationTests {
this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class, this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class,
TxManagerConfiguration.class, TestRecordMapperProvider.class, TxManagerConfiguration.class, TestRecordMapperProvider.class,
TestRecordUnmapperProvider.class, TestRecordListenerProvider.class, TestRecordUnmapperProvider.class, TestRecordListenerProvider.class,
TestExecuteListenerProvider.class, TestVisitListenerProvider.class TestExecuteListenerProvider.class, TestVisitListenerProvider.class)
).run((context) -> { .run((context) -> {
DSLContext dsl = context.getBean(DSLContext.class); DSLContext dsl = context.getBean(DSLContext.class);
assertThat(dsl.configuration().recordMapperProvider().getClass()) assertThat(dsl.configuration().recordMapperProvider().getClass())
.isEqualTo(TestRecordMapperProvider.class); .isEqualTo(TestRecordMapperProvider.class);
assertThat(dsl.configuration().recordUnmapperProvider().getClass()) assertThat(dsl.configuration().recordUnmapperProvider().getClass())
.isEqualTo(TestRecordUnmapperProvider.class); .isEqualTo(TestRecordUnmapperProvider.class);
assertThat(dsl.configuration().recordListenerProviders().length) assertThat(dsl.configuration().recordListenerProviders().length)
.isEqualTo(1); .isEqualTo(1);
assertThat(dsl.configuration().executeListenerProviders().length) assertThat(dsl.configuration().executeListenerProviders().length)
.isEqualTo(2); .isEqualTo(2);
assertThat(dsl.configuration().visitListenerProviders().length) assertThat(dsl.configuration().visitListenerProviders().length)
.isEqualTo(1); .isEqualTo(1);
}); });
} }
@Test @Test
......
...@@ -124,9 +124,9 @@ abstract class ArchiveCommand extends OptionParsingCommand { ...@@ -124,9 +124,9 @@ abstract class ArchiveCommand extends OptionParsingCommand {
protected ExitStatus run(OptionSet options) throws Exception { protected ExitStatus run(OptionSet options) throws Exception {
List<?> nonOptionArguments = new ArrayList<Object>( List<?> nonOptionArguments = new ArrayList<Object>(
options.nonOptionArguments()); options.nonOptionArguments());
Assert.isTrue(nonOptionArguments.size() >= 2, () -> "The name of the " Assert.isTrue(nonOptionArguments.size() >= 2,
+ "resulting " + this.type + " and at least one source file must be " () -> "The name of the " + "resulting " + this.type
+ "specified"); + " and at least one source file must be " + "specified");
File output = new File((String) nonOptionArguments.remove(0)); File output = new File((String) nonOptionArguments.remove(0));
Assert.isTrue( Assert.isTrue(
......
...@@ -112,9 +112,8 @@ public class ClassPathChangeUploader ...@@ -112,9 +112,8 @@ public class ClassPathChangeUploader
FileCopyUtils.copy(bytes, request.getBody()); FileCopyUtils.copy(bytes, request.getBody());
ClientHttpResponse response = request.execute(); ClientHttpResponse response = request.execute();
HttpStatus statusCode = response.getStatusCode(); HttpStatus statusCode = response.getStatusCode();
Assert.state(statusCode == HttpStatus.OK, Assert.state(statusCode == HttpStatus.OK, () -> "Unexpected "
() -> "Unexpected " + statusCode + statusCode + " response uploading class files");
+ " response uploading class files");
logUpload(classLoaderFiles); logUpload(classLoaderFiles);
return; return;
} }
......
...@@ -67,8 +67,8 @@ import org.springframework.util.StringUtils; ...@@ -67,8 +67,8 @@ import org.springframework.util.StringUtils;
*/ */
public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
private static final Pattern INTELLIJ_CLASSPATH_JAR_PATTERN = Pattern.compile( private static final Pattern INTELLIJ_CLASSPATH_JAR_PATTERN = Pattern
".*classpath(\\d+)?.jar"); .compile(".*classpath(\\d+)?.jar");
public ModifiedClassPathRunner(Class<?> testClass) throws InitializationError { public ModifiedClassPathRunner(Class<?> testClass) throws InitializationError {
super(testClass); super(testClass);
...@@ -147,7 +147,6 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { ...@@ -147,7 +147,6 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
return createdBy != null && createdBy.contains("IntelliJ"); return createdBy != null && createdBy.contains("IntelliJ");
} }
catch (Exception ex) { catch (Exception ex) {
return false;
} }
} }
return false; return false;
...@@ -168,8 +167,8 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { ...@@ -168,8 +167,8 @@ public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner {
private String[] getClassPath(URL booterJar) throws Exception { private String[] getClassPath(URL booterJar) throws Exception {
Attributes attributes = getManifestMainAttributesFromUrl(booterJar); Attributes attributes = getManifestMainAttributesFromUrl(booterJar);
return StringUtils.delimitedListToStringArray(attributes return StringUtils.delimitedListToStringArray(
.getValue(Attributes.Name.CLASS_PATH), " "); attributes.getValue(Attributes.Name.CLASS_PATH), " ");
} }
private Attributes getManifestMainAttributesFromUrl(URL url) throws Exception { private Attributes getManifestMainAttributesFromUrl(URL url) throws Exception {
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment