-
Notifications
You must be signed in to change notification settings - Fork 995
DynamoDbIgnoreNulls example assertions are incorrect #4459
Copy link
Copy link
Closed
Labels
documentationThis is a problem with documentation.This is a problem with documentation.p2This is a standard priority issueThis is a standard priority issue
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationThis is a problem with documentation.This is a problem with documentation.p2This is a standard priority issueThis is a standard priority issue