  @Test
  public void toObject_nullInPrimitiveTypes() {

    Map<String, Object> properties = new HashMap<>();
    properties.put("name", "Pepe");
    properties.put("age", null);

    thrown.expect(NullPointerException.class);
    thrown.expectMessage("The property \"age\" has the value null. It can't be set to a int.");
    mapper.toObject(properties);
  }