21
21
import static org .openqa .selenium .json .Json .MAP_TYPE ;
22
22
import static org .openqa .selenium .remote .http .Contents .utf8String ;
23
23
24
- import java .io .UnsupportedEncodingException ;
25
24
import java .net .URLDecoder ;
25
+ import java .nio .charset .StandardCharsets ;
26
26
import java .util .Map ;
27
27
import java .util .Set ;
28
28
import org .junit .jupiter .api .Test ;
@@ -41,26 +41,22 @@ void shouldReturnImageIfTagIsPresent() {
41
41
HttpHandler handler =
42
42
req -> {
43
43
String filters = req .getQueryParameter ("filters" );
44
- try {
45
- String decoded = URLDecoder .decode (filters , "UTF-8" );
46
- Map <String , Object > raw = new Json ().toType (decoded , MAP_TYPE );
44
+ String decoded = URLDecoder .decode (filters , StandardCharsets .UTF_8 );
45
+ Map <String , Object > raw = new Json ().toType (decoded , MAP_TYPE );
47
46
48
- Map <?, ?> rawRef = (Map <?, ?>) raw .get ("reference" );
49
- assertThat (rawRef .get ("selenium/standalone-firefox:latest" )).isEqualTo (true );
47
+ Map <?, ?> rawRef = (Map <?, ?>) raw .get ("reference" );
48
+ assertThat (rawRef .get ("selenium/standalone-firefox:latest" )).isEqualTo (true );
50
49
51
- return new HttpResponse ()
52
- .addHeader ("Content-Type" , "application/json" )
53
- .setContent (
54
- utf8String (
55
- "[{\" Containers\" :-1,\" Created\" :1581716253,"
56
- + "\" Id\" :\" sha256:bc24341497a00a3afbf04c518cb4bf98834d933ae331d1c5d3cd6f52c079049e\" ,"
57
- + "\" Labels\" :{\" authors\" :\" SeleniumHQ\" },\" ParentId\" :\" \" ,"
58
- + "\" RepoDigests\" :null,"
59
- + "\" RepoTags\" :[\" selenium/standalone-firefox:latest\" ],"
60
- + "\" SharedSize\" :-1,\" Size\" :765131593,\" VirtualSize\" :765131593}]" ));
61
- } catch (UnsupportedEncodingException ignore ) {
62
- return null ;
63
- }
50
+ return new HttpResponse ()
51
+ .addHeader ("Content-Type" , "application/json" )
52
+ .setContent (
53
+ utf8String (
54
+ "[{\" Containers\" :-1,\" Created\" :1581716253,"
55
+ + "\" Id\" :\" sha256:bc24341497a00a3afbf04c518cb4bf98834d933ae331d1c5d3cd6f52c079049e\" ,"
56
+ + "\" Labels\" :{\" authors\" :\" SeleniumHQ\" },\" ParentId\" :\" \" ,"
57
+ + "\" RepoDigests\" :null,"
58
+ + "\" RepoTags\" :[\" selenium/standalone-firefox:latest\" ],"
59
+ + "\" SharedSize\" :-1,\" Size\" :765131593,\" VirtualSize\" :765131593}]" ));
64
60
};
65
61
66
62
Reference reference = Reference .parse ("selenium/standalone-firefox:latest" );
0 commit comments