Skip to content

Commit 41df45d

Browse files
committed
#1134 extra test
1 parent 79568f6 commit 41df45d

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2014-2022 Yegor Bugayenko
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included
14+
* in all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.takes.rs;
25+
26+
import java.io.IOException;
27+
import java.net.HttpURLConnection;
28+
import org.hamcrest.MatcherAssert;
29+
import org.hamcrest.Matchers;
30+
import org.junit.jupiter.api.Test;
31+
import org.takes.Response;
32+
33+
/**
34+
* Test case for {@link RsWithBody}.
35+
* @since 1.22
36+
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
37+
*/
38+
final class RsWithBodyTest {
39+
40+
/**
41+
* RsWithType can replace an existing type.
42+
* @throws IOException If fails
43+
*/
44+
@Test
45+
void buildsResponseWithBody() throws IOException {
46+
final Response res = new RsWithBody(
47+
new RsWithStatus(HttpURLConnection.HTTP_OK),
48+
"привет, Jeff"
49+
);
50+
new RsPrint(res).print();
51+
MatcherAssert.assertThat(
52+
new RsPrint(res).print(),
53+
Matchers.containsString(
54+
"Content-Length: 18\r\n\r\nпривет"
55+
)
56+
);
57+
}
58+
59+
}

0 commit comments

Comments
 (0)