1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -30,9 +30,9 @@ public class LinkedCaseInsensitiveMapTests {
30
30
31
31
@ Test
32
32
public void putAndGet () {
33
- map .put ("key" , "value1" );
34
- map .put ("key" , "value2" );
35
- map .put ("key" , "value3" );
33
+ assertNull ( map .put ("key" , "value1" ) );
34
+ assertEquals ( "value1" , map .put ("key" , "value2" ) );
35
+ assertEquals ( "value2" , map .put ("key" , "value3" ) );
36
36
assertEquals (1 , map .size ());
37
37
assertEquals ("value3" , map .get ("key" ));
38
38
assertEquals ("value3" , map .get ("KEY" ));
@@ -47,9 +47,9 @@ public void putAndGet() {
47
47
48
48
@ Test
49
49
public void putWithOverlappingKeys () {
50
- map .put ("key" , "value1" );
51
- map .put ("KEY" , "value2" );
52
- map .put ("Key" , "value3" );
50
+ assertNull ( map .put ("key" , "value1" ) );
51
+ assertEquals ( "value1" , map .put ("KEY" , "value2" ) );
52
+ assertEquals ( "value2" , map .put ("Key" , "value3" ) );
53
53
assertEquals (1 , map .size ());
54
54
assertEquals ("value3" , map .get ("key" ));
55
55
assertEquals ("value3" , map .get ("KEY" ));
@@ -64,9 +64,9 @@ public void putWithOverlappingKeys() {
64
64
65
65
@ Test
66
66
public void getOrDefault () {
67
- map .put ("key" , "value1" );
68
- map .put ("KEY" , "value2" );
69
- map .put ("Key" , "value3" );
67
+ assertNull ( map .put ("key" , "value1" ) );
68
+ assertEquals ( "value1" , map .put ("KEY" , "value2" ) );
69
+ assertEquals ( "value2" , map .put ("Key" , "value3" ) );
70
70
assertEquals ("value3" , map .getOrDefault ("key" , "N" ));
71
71
assertEquals ("value3" , map .getOrDefault ("KEY" , "N" ));
72
72
assertEquals ("value3" , map .getOrDefault ("Key" , "N" ));
@@ -76,9 +76,9 @@ public void getOrDefault() {
76
76
77
77
@ Test
78
78
public void getOrDefaultWithNullValue () {
79
- map .put ("key" , null );
80
- map .put ("KEY" , null );
81
- map .put ("Key" , null );
79
+ assertNull ( map .put ("key" , null ) );
80
+ assertNull ( map .put ("KEY" , null ) );
81
+ assertNull ( map .put ("Key" , null ) );
82
82
assertNull (map .getOrDefault ("key" , "N" ));
83
83
assertNull (map .getOrDefault ("KEY" , "N" ));
84
84
assertNull (map .getOrDefault ("Key" , "N" ));
@@ -88,9 +88,9 @@ public void getOrDefaultWithNullValue() {
88
88
89
89
@ Test
90
90
public void computeIfAbsentWithExistingValue () {
91
- map .put ("key" , "value1" );
92
- map .put ("KEY" , "value2" );
93
- map .put ("Key" , "value3" );
91
+ assertNull ( map .putIfAbsent ("key" , "value1" ) );
92
+ assertEquals ( "value1" , map .putIfAbsent ("KEY" , "value2" ) );
93
+ assertEquals ( "value1" , map .put ("Key" , "value3" ) );
94
94
assertEquals ("value3" , map .computeIfAbsent ("key" , key -> "value1" ));
95
95
assertEquals ("value3" , map .computeIfAbsent ("KEY" , key -> "value2" ));
96
96
assertEquals ("value3" , map .computeIfAbsent ("Key" , key -> "value3" ));
@@ -105,7 +105,7 @@ public void computeIfAbsentWithComputedValue() {
105
105
106
106
@ Test
107
107
public void mapClone () {
108
- map .put ("key" , "value1" );
108
+ assertNull ( map .put ("key" , "value1" ) );
109
109
LinkedCaseInsensitiveMap <String > copy = map .clone ();
110
110
111
111
assertEquals (map .getLocale (), copy .getLocale ());
0 commit comments