### Question:
Encounter extends BaseChangeableOpenmrsData { public Set<Obs> getObsAtTopLevel(boolean includeVoided) { return getAllObs(includeVoided).stream() .filter(o -> o.getObsGroup() == null) .collect(Collectors.toCollection(LinkedHashSet::new)); } Encounter();  Encounter(Integer encounterId); Date getEncounterDatetime(); void setEncounterDatetime(Date encounterDatetime); Integer getEncounterId(); void setEncounterId(Integer encounterId); EncounterType getEncounterType(); void setEncounterType(EncounterType encounterType); Location getLocation(); void setLocation(Location location); Set<Obs> getObs(); Set<Obs> getAllObs(boolean includeVoided); Set<Obs> getAllObs(); Set<Obs> getObsAtTopLevel(boolean includeVoided); void setObs(Set<Obs> obs); void addObs(Obs observation); void removeObs(Obs observation); Set<Order> getOrders(); void setOrders(Set<Order> orders); void addOrder(Order order); void removeOrder(Order order); Patient getPatient(); void setPatient(Patient patient); Set<Diagnosis> getDiagnoses(); void setDiagnoses(Set<Diagnosis> diagnoses); Set<EncounterProvider> getEncounterProviders(); void setEncounterProviders(Set<EncounterProvider> encounterProviders); Set<EncounterProvider> getActiveEncounterProviders(); Form getForm(); void setForm(Form form); @Override String toString(); @Override Integer getId(); @Override void setId(Integer id); Visit getVisit(); void setVisit(Visit visit); Map<EncounterRole, Set<Provider>> getProvidersByRoles(); Map<EncounterRole, Set<Provider>> getProvidersByRoles(boolean includeVoided); Set<Provider> getProvidersByRole(EncounterRole role); Set<Provider> getProvidersByRole(EncounterRole role, boolean includeVoided); void addProvider(EncounterRole role, Provider provider); void setProvider(EncounterRole role, Provider provider); void removeProvider(EncounterRole role, Provider provider); Encounter copyAndAssignToAnotherPatient(Patient patient); List<OrderGroup> getOrderGroups(); List<Order> getOrdersWithoutOrderGroups(); Boolean hasDiagnosis(Diagnosis diagnosis); static final long serialVersionUID; }### Answer:
@Test public void getObsAtTopLevel_shouldNotReturnNullWithNullObsSet() { Encounter encounter = new Encounter(); assertNotNull(encounter.getObsAtTopLevel(true)); assertEquals(encounter.getObsAtTopLevel(true).size(), 0); assertNotNull(encounter.getObsAtTopLevel(false)); assertEquals(encounter.getObsAtTopLevel(false).size(), 0); }