Skip to content

Commit 575cf12

Browse files
authored
chore: refactor PostPolicyV4Test to be compatible with behavior change of Collections.unmodifiableMap from jdk 17 (#1016)
1 parent 7a1a928 commit 575cf12

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

google-cloud-storage/src/test/java/com/google/cloud/storage/PostPolicyV4Test.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.google.cloud.storage;
1818

1919
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertNotSame;
2120
import static org.junit.Assert.assertTrue;
2221
import static org.junit.Assert.fail;
2322

@@ -33,8 +32,7 @@
3332
public class PostPolicyV4Test {
3433
private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
3534

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) {
3836
assertEquals("map sizes", expected.size(), returned.size());
3937
for (String key : expected.keySet()) {
4038
assertEquals("value of $" + key, expected.get(key), returned.get(key));
@@ -78,7 +76,7 @@ public void testPostPolicyV4_of() {
7876
String url = "http://example.com";
7977
PostPolicyV4 policy = PostPolicyV4.of(url, ALL_FIELDS);
8078
assertEquals(url, policy.getUrl());
81-
assertNotSameButEqual(ALL_FIELDS, policy.getFields());
79+
assertMapsEquals(ALL_FIELDS, policy.getFields());
8280
}
8381

8482
@Test
@@ -115,7 +113,7 @@ public void testPostPolicyV4_ofInvalidField() {
115113
@Test
116114
public void testPostFieldsV4_of() {
117115
PostPolicyV4.PostFieldsV4 fields = PostPolicyV4.PostFieldsV4.of(ALL_FIELDS);
118-
assertNotSameButEqual(ALL_FIELDS, fields.getFieldsMap());
116+
assertMapsEquals(ALL_FIELDS, fields.getFieldsMap());
119117
}
120118

121119
@Test
@@ -157,7 +155,7 @@ public void testPostPolicyV4_builder() {
157155
expectedUpdated.put("content-type", "new-content-type");
158156
expectedUpdated.put("success_action_status", "42");
159157
Map<String, String> updated = builder.build().getFieldsMap();
160-
assertNotSameButEqual(expectedUpdated, updated);
158+
assertMapsEquals(expectedUpdated, updated);
161159
}
162160

163161
@Test

0 commit comments

Comments
 (0)