|
16 | 16 |
|
17 | 17 | package org.springframework.test.http; |
18 | 18 |
|
19 | | - |
20 | 19 | import org.junit.jupiter.api.Test; |
21 | 20 |
|
22 | 21 | import org.springframework.http.MediaType; |
@@ -63,11 +62,12 @@ void isEqualWhenDifferentStringShouldFail() { |
63 | 62 |
|
64 | 63 | @Test |
65 | 64 | void isEqualInvalidStringShouldFail() { |
| 65 | + String ls = System.lineSeparator(); // output below is different between Unix and Windows |
66 | 66 | assertThatExceptionOfType(AssertionError.class) |
67 | 67 | .isThrownBy(() -> assertThat(mediaType("application/json")).isEqualTo("example of a bad value")) |
68 | 68 | .withMessageContaining("[Media type]") |
69 | | - .withMessageEndingWith("To be a valid media type but got:\n" + |
70 | | - " \"Invalid mime type \"example of a bad value\": does not contain '/'\"\n"); |
| 69 | + .withMessageEndingWith("To be a valid media type but got:" + ls + |
| 70 | + " \"Invalid mime type \"example of a bad value\": does not contain '/'\"" + ls); |
71 | 71 | } |
72 | 72 |
|
73 | 73 | @Test |
@@ -108,11 +108,12 @@ void isNotEqualWhenSameStringShouldFail() { |
108 | 108 |
|
109 | 109 | @Test |
110 | 110 | void isNotEqualInvalidStringShouldFail() { |
| 111 | + String ls = System.lineSeparator(); // output below is different between Unix and Windows |
111 | 112 | assertThatExceptionOfType(AssertionError.class) |
112 | 113 | .isThrownBy(() -> assertThat(mediaType("application/json")).isNotEqualTo("example of a bad value")) |
113 | 114 | .withMessageContaining("[Media type]") |
114 | | - .withMessageEndingWith("To be a valid media type but got:\n" + |
115 | | - " \"Invalid mime type \"example of a bad value\": does not contain '/'\"\n"); |
| 115 | + .withMessageEndingWith("To be a valid media type but got:" + ls + |
| 116 | + " \"Invalid mime type \"example of a bad value\": does not contain '/'\"" + ls); |
116 | 117 | } |
117 | 118 |
|
118 | 119 | @Test |
|
0 commit comments