|
20 | 20 | import static com.google.cloud.firestore.LocalFirestoreHelper.mapAnyType; |
21 | 21 | import static org.junit.Assert.assertEquals; |
22 | 22 | import static org.junit.Assert.assertNull; |
| 23 | +import static org.junit.Assert.assertThrows; |
23 | 24 | import static org.junit.Assert.assertTrue; |
24 | 25 | import static org.junit.Assert.fail; |
25 | 26 |
|
@@ -1236,9 +1237,15 @@ public void primitiveDeserializeLong() { |
1236 | 1237 | } |
1237 | 1238 | } |
1238 | 1239 |
|
1239 | | - @Test(expected = RuntimeException.class) |
| 1240 | + @Test |
1240 | 1241 | public void primitiveDeserializeWrongTypeMap() { |
1241 | | - deserialize("{'value': {'foo': 'bar'}}", StringBean.class); |
| 1242 | + String expectedExceptionMessage = |
| 1243 | + ".* Failed to convert value of type .*Map to String \\(found in field 'value'\\).*"; |
| 1244 | + Throwable exception = |
| 1245 | + assertThrows( |
| 1246 | + RuntimeException.class, |
| 1247 | + () -> deserialize("{'value': {'foo': 'bar'}}", StringBean.class)); |
| 1248 | + assertTrue(exception.getMessage().matches(expectedExceptionMessage)); |
1242 | 1249 | } |
1243 | 1250 |
|
1244 | 1251 | @Test |
@@ -2517,7 +2524,7 @@ public void settersCanOverridePrimitiveSettersParsing() { |
2517 | 2524 | NonConflictingSetterSubBean bean = |
2518 | 2525 | deserialize("{'value': 2}", NonConflictingSetterSubBean.class); |
2519 | 2526 | // sub-bean converts to negative value |
2520 | | - assertEquals(-2, bean.value, 0); |
| 2527 | + assertEquals(-2, bean.value); |
2521 | 2528 | } |
2522 | 2529 |
|
2523 | 2530 | @Test |
|
0 commit comments