### Question:
EntryFilter { public void updateSportTypes(SportTypeList sportTypeList) { if (sportType != null) { sportType = sportTypeList.getByID(sportType.getId()); if (sportType != null) { if (sportSubType != null) { sportSubType = sportType.getSportSubTypeList().getByID(sportSubType.getId()); } if (equipment != null) { equipment = sportType.getEquipmentList().getByID(equipment.getId()); } } else { sportSubType = null; equipment = null; } } }  LocalDate getDateStart(); void setDateStart(LocalDate dateStart); LocalDate getDateEnd(); void setDateEnd(LocalDate dateEnd); EntryType getEntryType(); void setEntryType(EntryType entryType); SportType getSportType(); void setSportType(SportType sportType); SportSubType getSportSubType(); void setSportSubType(SportSubType sportSubType); IntensityType getIntensity(); void setIntensity(IntensityType intensity); Equipment getEquipment(); void setEquipment(Equipment equipment); boolean isRegularExpressionMode(); void setRegularExpressionMode(boolean regularExpressionMode); String getCommentSubString(); void setCommentSubString(String commentSubString); static EntryFilter createDefaultExerciseFilter(); void updateSportTypes(SportTypeList sportTypeList); @Override String toString();  }### Answer:
@Test public void testUpdateSportTypes() { EntryFilter filter = EntryFilter.createDefaultExerciseFilter(); filter.updateSportTypes(sportTypeList); assertNull(filter.getSportType()); assertNull(filter.getSportSubType()); SportType type2 = sportTypeList.getByID(2); filter.setSportType(type2); SportSubType subType22 = type2.getSportSubTypeList().getByID(22); filter.setSportSubType(subType22); filter.updateSportTypes(sportTypeList); assertEquals(2, filter.getSportType().getId()); assertEquals(22, filter.getSportSubType().getId()); type2.getSportSubTypeList().removeByID(22); filter.updateSportTypes(sportTypeList); assertEquals(2, filter.getSportType().getId()); assertNull(filter.getSportSubType()); sportTypeList.removeByID(2); filter.updateSportTypes(sportTypeList); assertNull(filter.getSportType()); assertNull(filter.getSportSubType()); }