|
|
|
@ -20,7 +20,9 @@ import java.util.Map;
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
|
|
import org.junit.Before;
|
|
|
|
|
import org.junit.Rule;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
import org.junit.rules.ExpectedException;
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.origin.OriginTrackedValue;
|
|
|
|
|
import org.springframework.boot.origin.TextResourceOrigin;
|
|
|
|
@ -37,6 +39,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
*/
|
|
|
|
|
public class OriginTrackedPropertiesLoaderTests {
|
|
|
|
|
|
|
|
|
|
@Rule
|
|
|
|
|
public ExpectedException thrown = ExpectedException.none();
|
|
|
|
|
|
|
|
|
|
private ClassPathResource resource;
|
|
|
|
|
|
|
|
|
|
private Map<String, OriginTrackedValue> properties;
|
|
|
|
@ -85,6 +90,15 @@ public class OriginTrackedPropertiesLoaderTests {
|
|
|
|
|
assertThat(getLocation(value)).isEqualTo("12:14");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void getMalformedUnicodeProperty() throws Exception {
|
|
|
|
|
// gh-2716
|
|
|
|
|
this.thrown.expect(IllegalStateException.class);
|
|
|
|
|
this.thrown.expectMessage("Malformed \\uxxxx encoding");
|
|
|
|
|
new OriginTrackedPropertiesLoader(new ClassPathResource(
|
|
|
|
|
"test-properties-malformed-unicode.properties", getClass())).load();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void getEscapedProperty() {
|
|
|
|
|
OriginTrackedValue value = this.properties.get("test=property");
|
|
|
|
|