public void testNotNull() { MapConstraint<Object, Object> constraint = MapConstraints.notNull(); constraint.checkKeyValue("foo", 1); assertEquals("Not null", constraint.toString()); try { constraint.checkKeyValue(null, 1); fail("NullPointerException expected"); } catch (NullPointerException expected) { } try { constraint.checkKeyValue("foo", null); fail("NullPointerException expected"); } catch (NullPointerException expected) { } try { constraint.checkKeyValue(null, null); fail("NullPointerException expected"); } catch (NullPointerException expected) { } }