Describe the issue
The javadoc for DynamoDbIgnoreNulls shows two assertions at the end.
// innerBean1 w/ @DynamoDbIgnoreNulls does not have any attribute values because all the fields are null
assertThat(itemMap.get("innerBean1").m(), empty());
// innerBean2 w/o @DynamoDbIgnoreNulls has a NULLL attribute.
assertThat(nestedBean.getInnerBean2(), hasEntry("attribute", nullAttributeValue()));
Assuming that hamcrest matchers are being used, for example
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
I found that assertThat(itemMap.get("innerBean1").m(), empty()); does not compile. Matchers.empty() is used to check a Collection, but itemMap.get("innerBean1").m() returns a Map. A Map is not a Collection.
Also, the second assertion:
assertThat(nestedBean.getInnerBean2(), hasEntry("attribute", nullAttributeValue()));
doesn't make since since nestedBean.getInnerBean2(), returns null and hasEntry("attribute", nullAttributeValue()) is checking for an entry in a map.
Links
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/enhanced/dynamodb/mapper/annotations/DynamoDbIgnoreNulls.html
Describe the issue
The javadoc for
DynamoDbIgnoreNullsshows two assertions at the end.Assuming that hamcrest matchers are being used, for example
I found that
assertThat(itemMap.get("innerBean1").m(), empty());does not compile.Matchers.empty()is used to check aCollection, butitemMap.get("innerBean1").m()returns aMap. AMapis not aCollection.Also, the second assertion:
doesn't make since since
nestedBean.getInnerBean2(),returnsnullandhasEntry("attribute", nullAttributeValue())is checking for an entry in a map.Links
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/enhanced/dynamodb/mapper/annotations/DynamoDbIgnoreNulls.html