1515
1616import static org .junit .Assert .*;
1717
18- public class GivenAContextConverter {
18+ public class ContextConverterTest {
1919 TestLogger testLogger = new TestLogger ();
2020 EvaluationContextConverter evaluationContextConverter = new EvaluationContextConverter (
2121 LDLogger .withAdapter (testLogger , "test-logger" )
@@ -31,7 +31,7 @@ public void itCanCreateAContextFromAKeyOnly() {
3131 LDContext converted = evaluationContextConverter .toLdContext (new ImmutableContext ("the-key" ));
3232 assertEquals (expectedContext , converted );
3333
34- HashMap <String , Value > attributes = new HashMap ();
34+ HashMap <String , Value > attributes = new HashMap <> ();
3535 attributes .put ("key" , new Value ("the-key" ));
3636 LDContext convertedKey = evaluationContextConverter .toLdContext (new ImmutableContext (attributes ));
3737 assertEquals (expectedContext , convertedKey );
@@ -44,7 +44,7 @@ public void itCanCreateAContextFromAKeyAndKind() {
4444 LDContext expectedContext = LDContext .builder (ContextKind .of ("organization" ), "org-key" ).build ();
4545
4646 LDContext converted = evaluationContextConverter
47- .toLdContext (new ImmutableContext ("org-key" , new HashMap () {{
47+ .toLdContext (new ImmutableContext ("org-key" , new HashMap < String , Value > () {{
4848 put ("kind" , new Value ("organization" ));
4949 }}));
5050
@@ -66,7 +66,7 @@ public void itLogsAnErrorWhenThereIsNoTargetingKey() {
6666 public void itGivesTargetingKeyPrecedence () {
6767 LDContext expectedContext = LDContext .builder ("key-to-use" ).build ();
6868
69- HashMap <String , Value > attributes = new HashMap ();
69+ HashMap <String , Value > attributes = new HashMap <> ();
7070 attributes .put ("key" , new Value ("key-not-to-use" ));
7171
7272 LDContext converted = evaluationContextConverter .toLdContext (
@@ -80,7 +80,7 @@ public void itGivesTargetingKeyPrecedence() {
8080
8181 @ Test
8282 public void itHandlesAKeyOfIncorrectType () {
83- HashMap <String , Value > attributes = new HashMap ();
83+ HashMap <String , Value > attributes = new HashMap <> ();
8484 attributes .put ("key" , new Value (0 ));
8585
8686 evaluationContextConverter .toLdContext (
@@ -98,7 +98,7 @@ public void itHandlesAKeyOfIncorrectType() {
9898 public void itHandlesInvalidBuiltInAttributes () {
9999 LDContext expectedContext = LDContext .builder ("user-key" ).build ();
100100
101- HashMap <String , Value > attributes = new HashMap ();
101+ HashMap <String , Value > attributes = new HashMap <> ();
102102 attributes .put ("name" , new Value (3 ));
103103 attributes .put ("anonymous" , new Value ("potato" ));
104104 // The attributes were not valid, so they should be discarded.
@@ -123,7 +123,7 @@ public void itHandlesValidBuiltInAttributes() {
123123 .anonymous (true )
124124 .build ();
125125
126- HashMap <String , Value > attributes = new HashMap ();
126+ HashMap <String , Value > attributes = new HashMap <> ();
127127 attributes .put ("name" , new Value ("the-name" ));
128128 attributes .put ("anonymous" , new Value (true ));
129129
@@ -148,17 +148,17 @@ public void itCanCreateAValidMultiKindContext() {
148148 .build ()
149149 );
150150
151- EvaluationContext evaluationContext = new ImmutableContext (new HashMap () {{
151+ EvaluationContext evaluationContext = new ImmutableContext (new HashMap < String , Value > () {{
152152 put ("kind" , new Value ("multi" ));
153- put ("organization" , new Value (new ImmutableStructure (new HashMap () {{
153+ put ("organization" , new Value (new ImmutableStructure (new HashMap < String , Value > () {{
154154 put ("name" , new Value ("the-org-name" ));
155155 put ("targetingKey" , new Value ("my-org-key" ));
156156 put ("myCustomAttribute" , new Value ("myAttributeValue" ));
157157 put ("privateAttributes" , new Value (new ArrayList <Value >() {{
158158 add (new Value ("myCustomAttribute" ));
159159 }}));
160160 }})));
161- put ("user" , new Value (new ImmutableStructure (new HashMap () {{
161+ put ("user" , new Value (new ImmutableStructure (new HashMap < String , Value > () {{
162162 put ("key" , new Value ("my-user-key" ));
163163 put ("anonymous" , new Value (true ));
164164 put ("myCustomAttribute" , new Value ("myAttributeValue" ));
0 commit comments