11package io .specto .hoverfly .junit .core .model ;
22
33
4+ import static io .specto .hoverfly .junit .core .model .RequestFieldMatcher .newExactMatcher ;
5+ import static java .util .Collections .singletonList ;
6+ import static org .assertj .core .api .Assertions .assertThat ;
7+
48import com .fasterxml .jackson .databind .ObjectMapper ;
59import com .google .common .collect .ImmutableList ;
610import com .google .common .collect .ImmutableMap ;
711import com .google .common .collect .Lists ;
812import com .google .common .collect .Sets ;
913import com .google .common .io .Resources ;
14+ import java .net .URL ;
15+ import java .nio .charset .StandardCharsets ;
16+ import java .util .Collections ;
1017import org .junit .Test ;
1118import org .skyscreamer .jsonassert .JSONAssert ;
1219import org .skyscreamer .jsonassert .JSONCompareMode ;
1320
14- import java .net .URL ;
15- import java .nio .charset .Charset ;
16- import java .util .Collections ;
17-
18- import static io .specto .hoverfly .junit .core .model .RequestFieldMatcher .*;
19- import static java .util .Collections .singletonList ;
20- import static org .assertj .core .api .Assertions .assertThat ;
21-
2221public class SimulationTest {
2322
2423
25- private ObjectMapper objectMapper = new ObjectMapper ();
24+ private final ObjectMapper objectMapper = new ObjectMapper ();
2625
27- private URL v1Resource = Resources .getResource ("simulations/v1-simulation.json" );
28- private URL v1ResourceWithLooseMatching = Resources .getResource ("simulations/v1-simulation-with-loose-matching.json" );
29- private URL v1ResourceWithRecording = Resources .getResource ("simulations/v1-simulation-with-recording.json" );
30- private URL v2Resource = Resources .getResource ("simulations/v2-simulation.json" );
31- private URL v3Resource = Resources .getResource ("simulations/v3-simulation.json" );
32- private URL v4Resource = Resources .getResource ("simulations/v4-simulation.json" );
33- private URL v5Resource = Resources .getResource ("simulations/v5-simulation.json" );
34- private URL v5ResourceWithoutGlobalActions = Resources .getResource ("simulations/v5-simulation-without-global-actions.json" );
35- private URL v5ResourceWithUnknownFields = Resources .getResource ("simulations/v5-simulation-with-unknown-fields.json" );
26+ private final URL v5Resource = Resources .getResource ("simulations/v5-simulation.json" );
27+ private final URL v5ResourceWithoutGlobalActions = Resources .getResource ("simulations/v5-simulation-without-global-actions.json" );
28+ private final URL v5ResourceWithUnknownFields = Resources .getResource ("simulations/v5-simulation-with-unknown-fields.json" );
3629
3730
3831 @ Test
@@ -56,7 +49,7 @@ public void shouldSerialize() throws Exception {
5649 String actual = objectMapper .writeValueAsString (simulation );
5750
5851 // then
59- String expected = Resources .toString (v5Resource , Charset . forName ( "UTF-8" ) );
52+ String expected = Resources .toString (v5Resource , StandardCharsets . UTF_8 );
6053 JSONAssert .assertEquals (expected , actual , JSONCompareMode .STRICT );
6154 }
6255
@@ -74,7 +67,7 @@ public void shouldIgnoreUnknownPropertiesWhenDeserialize() throws Exception {
7467
7568 @ Test
7669 public void shouldNotIncludeNullGlobalActionsFieldWhenSerialize () throws Exception {
77- String expected = Resources .toString (v5ResourceWithoutGlobalActions , Charset . forName ( "UTF-8" ) );
70+ String expected = Resources .toString (v5ResourceWithoutGlobalActions , StandardCharsets . UTF_8 );
7871
7972 Simulation simulation = objectMapper .readValue (expected , Simulation .class );
8073
@@ -121,4 +114,4 @@ private HoverflyData getTestHoverflyData(Request.Builder testRequestBuilder, Res
121114 Sets .newHashSet (new RequestResponsePair (testRequestBuilder .build (), testResponseBuilder .build ())),
122115 new GlobalActions (Collections .emptyList ()));
123116 }
124- }
117+ }
0 commit comments