|
17 | 17 | package com.google.cloud.storage;
|
18 | 18 |
|
19 | 19 | import static org.junit.Assert.assertEquals;
|
20 |
| -import static org.junit.Assert.assertNotSame; |
21 | 20 | import static org.junit.Assert.assertTrue;
|
22 | 21 | import static org.junit.Assert.fail;
|
23 | 22 |
|
|
33 | 32 | public class PostPolicyV4Test {
|
34 | 33 | private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
35 | 34 |
|
36 |
| - private void assertNotSameButEqual(Map<String, String> expected, Map<String, String> returned) { |
37 |
| - assertNotSame(expected, returned); |
| 35 | + private void assertMapsEquals(Map<String, String> expected, Map<String, String> returned) { |
38 | 36 | assertEquals("map sizes", expected.size(), returned.size());
|
39 | 37 | for (String key : expected.keySet()) {
|
40 | 38 | assertEquals("value of $" + key, expected.get(key), returned.get(key));
|
@@ -78,7 +76,7 @@ public void testPostPolicyV4_of() {
|
78 | 76 | String url = "http://example.com";
|
79 | 77 | PostPolicyV4 policy = PostPolicyV4.of(url, ALL_FIELDS);
|
80 | 78 | assertEquals(url, policy.getUrl());
|
81 |
| - assertNotSameButEqual(ALL_FIELDS, policy.getFields()); |
| 79 | + assertMapsEquals(ALL_FIELDS, policy.getFields()); |
82 | 80 | }
|
83 | 81 |
|
84 | 82 | @Test
|
@@ -115,7 +113,7 @@ public void testPostPolicyV4_ofInvalidField() {
|
115 | 113 | @Test
|
116 | 114 | public void testPostFieldsV4_of() {
|
117 | 115 | PostPolicyV4.PostFieldsV4 fields = PostPolicyV4.PostFieldsV4.of(ALL_FIELDS);
|
118 |
| - assertNotSameButEqual(ALL_FIELDS, fields.getFieldsMap()); |
| 116 | + assertMapsEquals(ALL_FIELDS, fields.getFieldsMap()); |
119 | 117 | }
|
120 | 118 |
|
121 | 119 | @Test
|
@@ -157,7 +155,7 @@ public void testPostPolicyV4_builder() {
|
157 | 155 | expectedUpdated.put("content-type", "new-content-type");
|
158 | 156 | expectedUpdated.put("success_action_status", "42");
|
159 | 157 | Map<String, String> updated = builder.build().getFieldsMap();
|
160 |
| - assertNotSameButEqual(expectedUpdated, updated); |
| 158 | + assertMapsEquals(expectedUpdated, updated); |
161 | 159 | }
|
162 | 160 |
|
163 | 161 | @Test
|
|
0 commit comments