### Question:
ObjectUtil { public void trimStringValues(Object object) { Class<?> clazz = object.getClass(); while (clazz != null) { for (Field field : clazz.getDeclaredFields()) { trimField(object, field); } clazz = clazz.getSuperclass(); } }  void trimStringValues(Object object);  }### Answer:
@Test public void trimStringValues_should_trim_field() { SimpleClass simpleClass = new SimpleClass(); simpleClass.setSimpleField(" \t value \t "); ObjectUtil.trimStringValues(simpleClass); assertThat(simpleClass.getSimpleField()).isEqualTo("value"); }
@Test public void trimStringValues_should_trim_super_fields_too() { SubClass subClass = new SubClass(); subClass.setSuperField(" \t superValue \t "); subClass.setSubField(" \t subValue \t "); ObjectUtil.trimStringValues(subClass); assertThat(subClass.getSuperField()).isEqualTo("superValue"); assertThat(subClass.getSubField()).isEqualTo("subValue"); }