From fdc6e80163ed6b6a64054ad09f502c39d46b35ac Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 13 Jul 2020 21:08:49 -0700 Subject: [PATCH] Add trailing escape character test Update `OriginTrackedPropertiesLoaderTests` to also test that an escape character can be the last character on a line. --- .../boot/env/OriginTrackedPropertiesLoaderTests.java | 8 +++++++- .../springframework/boot/env/test-properties.properties | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java index d1ae901483..e749745387 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -248,6 +248,12 @@ class OriginTrackedPropertiesLoaderTests { assertThat(getValue(value)).isEqualTo("trailing "); } + @Test + void getPropertyWithEscapedTrailingSpace() { + OriginTrackedValue value = this.properties.get("test-with-escaped-trailing-space"); + assertThat(getValue(value)).isEqualTo("trailing "); + } + private Object getValue(OriginTrackedValue value) { return (value != null) ? value.getValue() : null; } diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties index 7630cff49f..db81b6c3d7 100644 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties @@ -42,3 +42,4 @@ test-multiline-immediate-bang=\ test-iso8859-1-chars=æ×ÈÅÞßáñÀÿ test-with-trailing-space= trailing +test-with-escaped-trailing-space= trailing\