This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new b70b97d80 Fix tf on Windows only.
b70b97d80 is described below
commit b70b97d80157f02688551db1fd4d4510c8ed1d88
Author: JamesBognar <[email protected]>
AuthorDate: Sat Oct 8 10:31:12 2022 -0400
Fix tf on Windows only.
---
.../juneau/assertions/FluentStringAssertion.java | 9 ++++++++
.../rest/client/RestClient_Logging_Test.java | 26 ++++++++--------------
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git
a/juneau-core/juneau-assertions/src/main/java/org/apache/juneau/assertions/FluentStringAssertion.java
b/juneau-core/juneau-assertions/src/main/java/org/apache/juneau/assertions/FluentStringAssertion.java
index 4e2f022cf..4b718cb46 100644
---
a/juneau-core/juneau-assertions/src/main/java/org/apache/juneau/assertions/FluentStringAssertion.java
+++
b/juneau-core/juneau-assertions/src/main/java/org/apache/juneau/assertions/FluentStringAssertion.java
@@ -311,6 +311,15 @@ public class FluentStringAssertion<R> extends
FluentObjectAssertion<String,R> {
return asTransformed(x->x == null ? null :
x.replaceAll("\\s*[\r\n]+\\s*"," "));
}
+ /**
+ * Removes any leading/trailing whitespace from the string.
+ *
+ * @return This object.
+ */
+ public FluentStringAssertion<R> asTrimmed() {
+ return new FluentStringAssertion<>(this, valueIsNull() ? null :
value().trim(), returns());
+ }
+
//-----------------------------------------------------------------------------------------------------------------
// Test methods
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Logging_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Logging_Test.java
index b3dc212c6..54bd0ebfc 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Logging_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Logging_Test.java
@@ -71,8 +71,7 @@ public class RestClient_Logging_Test {
c.reset();
client().logRequests(DetailLevel.FULL,Level.SEVERE,null).logToConsole().logger(l).console(c).build().post("/bean",bean).complete();
- c.assertContents().isLines(
- "",
+ c.assertContents().asTrimmed().isLines(
"=== HTTP Call (outgoing)
======================================================",
"=== REQUEST ===",
"POST http://localhost/bean",
@@ -88,14 +87,12 @@ public class RestClient_Logging_Test {
" Content-Type: application/json",
"---response content---",
"{f:1}",
- "=== END
=======================================================================",
- ""
+ "=== END
======================================================================="
);
c.reset();
client().logRequests(DetailLevel.FULL,Level.SEVERE,null).logToConsole().logger(l).console(c).build().get("/bean").complete();
- c.assertContents().isLines(
- "",
+ c.assertContents().asTrimmed().isLines(
"=== HTTP Call (outgoing)
======================================================",
"=== REQUEST ===",
"GET http://localhost/bean",
@@ -107,14 +104,12 @@ public class RestClient_Logging_Test {
" Content-Type: application/json",
"---response content---",
"{f:1}",
- "=== END
=======================================================================",
- ""
+ "=== END
======================================================================="
);
c.reset();
clientPlain().logRequests(DetailLevel.FULL,Level.SEVERE,null).logToConsole().logger(l).console(c).build().post("/stream",new
InputStreamEntity(inputStream("foo"))).complete();
- c.assertContents().isLines(
- "",
+ c.assertContents().asTrimmed().isLines(
"=== HTTP Call (outgoing)
======================================================",
"=== REQUEST ===",
"POST http://localhost/stream",
@@ -126,8 +121,7 @@ public class RestClient_Logging_Test {
" Content-Encoding: identity",
"---response content---",
"foo",
- "=== END
=======================================================================",
- ""
+ "=== END
======================================================================="
);
c.reset();
@@ -153,8 +147,7 @@ public class RestClient_Logging_Test {
client().logger(l).logRequests(DetailLevel.FULL,Level.WARNING,null).build().post("/bean",bean).complete();
l.assertLastLevel(Level.WARNING);
- l.assertLastMessage().isLines(
- "",
+ l.assertLastMessage().asTrimmed().isLines(
"=== HTTP Call (outgoing)
======================================================",
"=== REQUEST ===",
"POST http://localhost/bean",
@@ -172,7 +165,7 @@ public class RestClient_Logging_Test {
"{f:1}",
"=== END
======================================================================="
);
- l.assertContents().asJavaStrings().isContains(
+ l.assertContents().asTrimmed().asJavaStrings().isContains(
"WARNING: ",
"=== HTTP Call (outgoing)
======================================================",
"=== REQUEST ===",
@@ -189,8 +182,7 @@ public class RestClient_Logging_Test {
" Content-Type: application/json",
"---response content---",
"{f:1}",
- "=== END
=======================================================================",
- ""
+ "=== END
======================================================================="
);
}