### Question:
ObjectiveRowBuilderService implements RowBuilderService<ObjectiveRow> { @Override public Collection<ObjectiveRow> generateForCompany(long companyId) { OkrCompany okrCompany = companyService.findById(companyId); Collection<OkrChildUnit> okrChildUnitCollection = BranchHelper.collectChildUnits(okrCompany); return okrChildUnitCollection.stream() .flatMap(childUnit -> generateObjectiveRowCollectionForDepartment(childUnit).stream()) .collect(Collectors.toList()); } ObjectiveRowBuilderService(
      @Qualifier("okrUnitServiceUsers") OkrUnitServiceUsers<OkrChildUnit> okrChildUnitService,
      CompanyService companyService); @Override Collection<ObjectiveRow> generateForOkrChildUnit(long okrUnitId); @Override Collection<ObjectiveRow> generateForCompany(long companyId);  }### Answer:
@Test public void generateObjectiveRowCollectionForCompany_expectEmptyCollectionIfThereAreNoDepartments() { Collection<ObjectiveRow> rows = objectiveRowBuilderService.generateForCompany(companyId); Assert.assertTrue(rows.isEmpty()); verify(companyService, times(1)).findById(companyId); }
@Test public void generateObjectiveRowCollectionForCompany_expectOneRow() { objective.setParentOkrUnit(okrDepartment); okrDepartment.getObjectives().add(objective); objective.getKeyResults().add(keyResult); okrDepartment.setParentOkrUnit(okrCompany); okrCompany.getOkrChildUnits().add(okrDepartment); Collection<ObjectiveRow> rows = objectiveRowBuilderService.generateForCompany(companyId); Assert.assertEquals(1, rows.size()); verify(companyService, times(1)).findById(companyId); }