File tree Expand file tree Collapse file tree 5 files changed +41
-10
lines changed
main/java/org/cactoos/http
test/java/org/cactoos/http Expand file tree Collapse file tree 5 files changed +41
-10
lines changed Original file line number Diff line number Diff line change 29
29
import java .net .URI ;
30
30
import org .cactoos .Input ;
31
31
import org .cactoos .io .InputOf ;
32
+ import org .cactoos .text .FormattedText ;
33
+ import org .cactoos .text .UncheckedText ;
32
34
33
35
/**
34
36
* Response.
@@ -66,12 +68,14 @@ public HtResponse(final String uri) {
66
68
public HtResponse (final URI uri ) {
67
69
this (
68
70
new HtWire (uri ),
69
- String .format (
70
- "GET %s HTTP/1.1\r \n Host:%s" ,
71
- // @checkstyle AvoidInlineConditionalsCheck (1 line)
72
- uri .getQuery () == null ? "/" : uri .getQuery (),
73
- uri .getHost ()
74
- )
71
+ new UncheckedText (
72
+ new FormattedText (
73
+ "GET %s HTTP/1.1\r \n Host:%s" ,
74
+ // @checkstyle AvoidInlineConditionalsCheck (1 line)
75
+ uri .getQuery () == null ? "/" : uri .getQuery (),
76
+ uri .getHost ()
77
+ )
78
+ ).asString ()
75
79
);
76
80
}
77
81
Original file line number Diff line number Diff line change 24
24
package org .cactoos .http ;
25
25
26
26
import org .cactoos .io .InputOf ;
27
+ import org .cactoos .text .FormattedText ;
27
28
import org .cactoos .text .JoinedText ;
28
29
import org .cactoos .text .TextOf ;
30
+ import org .cactoos .text .UncheckedText ;
29
31
import org .hamcrest .MatcherAssert ;
30
32
import org .hamcrest .Matchers ;
31
33
import org .junit .Test ;
39
41
* @version $Id$
40
42
* @since 0.1
41
43
* @checkstyle JavadocMethodCheck (500 lines)
44
+ * @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
42
45
*/
43
46
public final class HtAutoRedirectTest {
44
47
@@ -53,7 +56,11 @@ public void redirectsRequestAutomatically() throws Exception {
53
56
new JoinedText (
54
57
"\r \n " ,
55
58
"HTTP/1.1 301" ,
56
- String .format ("Location: %s" , home )
59
+ new UncheckedText (
60
+ new FormattedText (
61
+ "Location: %s" , home
62
+ )
63
+ ).asString ()
57
64
)
58
65
)
59
66
)
Original file line number Diff line number Diff line change 24
24
package org .cactoos .http ;
25
25
26
26
import java .io .IOException ;
27
+ import org .cactoos .text .FormattedText ;
27
28
import org .cactoos .text .JoinedText ;
28
29
import org .cactoos .text .TextOf ;
30
+ import org .cactoos .text .UncheckedText ;
29
31
import org .hamcrest .MatcherAssert ;
30
32
import org .hamcrest .Matchers ;
31
33
import org .junit .Test ;
@@ -53,7 +55,11 @@ public void worksFine() throws IOException {
53
55
new JoinedText (
54
56
"\r \n " ,
55
57
"GET / HTTP/1.1" ,
56
- String .format ("Host:%s" , home .getHost ())
58
+ new UncheckedText (
59
+ new FormattedText (
60
+ "Host:%s" , home .getHost ()
61
+ )
62
+ ).asString ()
57
63
).asString ()
58
64
)
59
65
).asString (),
Original file line number Diff line number Diff line change 29
29
import javax .net .ssl .SSLServerSocketFactory ;
30
30
import org .cactoos .Input ;
31
31
import org .cactoos .io .InputOf ;
32
+ import org .cactoos .text .FormattedText ;
32
33
import org .cactoos .text .JoinedText ;
33
34
import org .cactoos .text .TextOf ;
35
+ import org .cactoos .text .UncheckedText ;
34
36
import org .hamcrest .MatcherAssert ;
35
37
import org .hamcrest .Matchers ;
36
38
import org .junit .Test ;
@@ -132,7 +134,12 @@ public InputStream stream() throws IOException {
132
134
new JoinedText (
133
135
delimiter ,
134
136
"GET / HTTP/1.1" ,
135
- String .format ("Host: %s" , this .host ),
137
+ new UncheckedText (
138
+ new FormattedText (
139
+ "Host: %s" ,
140
+ this .host
141
+ )
142
+ ).asString (),
136
143
"Connection: close" ,
137
144
delimiter
138
145
)
Original file line number Diff line number Diff line change 29
29
import org .cactoos .BiFunc ;
30
30
import org .cactoos .io .DeadInput ;
31
31
import org .cactoos .io .DeadInputStream ;
32
+ import org .cactoos .text .FormattedText ;
32
33
import org .cactoos .text .JoinedText ;
33
34
import org .cactoos .text .TextOf ;
35
+ import org .cactoos .text .UncheckedText ;
34
36
import org .hamcrest .MatcherAssert ;
35
37
import org .hamcrest .Matchers ;
36
38
import org .junit .Test ;
@@ -78,7 +80,12 @@ public void worksWithProvidedHostNameAndPort() throws IOException {
78
80
new JoinedText (
79
81
"\r \n " ,
80
82
"GET / HTTP/1.1" ,
81
- String .format ("Host:%s" , home .getHost ())
83
+ new UncheckedText (
84
+ new FormattedText (
85
+ "Host:%s" ,
86
+ home .getHost ()
87
+ )
88
+ ).asString ()
82
89
).asString ()
83
90
)
84
91
).asString (),
You can’t perform that action at this time.
0 commit comments