Use new Java features (switch expressions, text blocks, new JDK methods)
Closes gh-29747
This commit is contained in:
committed by
Sam Brannen
parent
48abd493fe
commit
afb8a0d1b1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -62,13 +62,13 @@ public class ProtobufMessageConverterTests {
|
||||
this.message = MessageBuilder.withPayload(this.testMsg.toByteArray())
|
||||
.setHeader(CONTENT_TYPE, ProtobufMessageConverter.PROTOBUF).build();
|
||||
this.messageWithoutContentType = MessageBuilder.withPayload(this.testMsg.toByteArray()).build();
|
||||
this.messageJson = MessageBuilder.withPayload(
|
||||
"{\n" +
|
||||
" \"foo\": \"Foo\",\n" +
|
||||
" \"blah\": {\n" +
|
||||
" \"blah\": 123\n" +
|
||||
" }\n" +
|
||||
"}")
|
||||
this.messageJson = MessageBuilder.withPayload("""
|
||||
{
|
||||
"foo": "Foo",
|
||||
"blah": {
|
||||
"blah": 123
|
||||
}
|
||||
}""".replace("\t", " "))
|
||||
.setHeader(CONTENT_TYPE, APPLICATION_JSON)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -319,9 +319,7 @@ public class MessageHeaderAccessorTests {
|
||||
})).isEqualTo(expected);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 80; i++) {
|
||||
sb.append('a');
|
||||
}
|
||||
sb.append("a".repeat(80));
|
||||
final String payload = sb.toString() + " > 80";
|
||||
|
||||
String actual = accessor.getShortLogMessage(payload);
|
||||
@@ -355,10 +353,8 @@ public class MessageHeaderAccessorTests {
|
||||
})).isEqualTo(expected);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 80; i++) {
|
||||
sb.append('a');
|
||||
}
|
||||
final String payload = sb.toString() + " > 80";
|
||||
sb.append("a".repeat(80));
|
||||
final String payload = sb + " > 80";
|
||||
|
||||
String actual = accessor.getDetailedLogMessage(payload);
|
||||
assertThat(actual).isEqualTo("headers={contentType=text/plain} payload=" + sb + " > 80");
|
||||
|
||||
Reference in New Issue
Block a user