IndexVolumeDaoImpl implements IndexVolumeDao { @Override public List<IndexVolume> getAll() { return JooqUtil.contextResult(indexDbConnProvider, context -> context .select() .from(INDEX_VOLUME) .fetch() .map(RECORD_TO_INDEX_VOLUME_MAPPER::apply)); } @Inject  IndexVolumeDaoImpl(final IndexDbConnProvider indexDbConnProvider,
                       final ExpressionMapperFactory expressionMapperFactory); @Override IndexVolume create(final IndexVolume indexVolume); @Override IndexVolume update(IndexVolume indexVolume); @Override Optional<IndexVolume> fetch(final int id); @Override boolean delete(final int id); @Override List<IndexVolume> getAll(); @Override List<IndexVolume> getVolumesInGroupOnNode(final String groupName, final String nodeName); @Override List<IndexVolume> getVolumesInGroup(final String groupName); @Override void updateVolumeState(final int id,
                                  final Long updateTimeMs,
                                  final Long bytesUsed,
                                  final Long bytesFree,
                                  final Long bytesTotal); @Override ResultPage<IndexVolume> find(final ExpressionCriteria criteria);  }
@Test void testGetAll() { final var indexVolumeGroup01 = createGroup(TestData.createVolumeGroupName()); final var indexVolumeGroup02 = createGroup(TestData.createVolumeGroupName()); final var indexVolumeGroup03 = createGroup(TestData.createVolumeGroupName()); createVolume(indexVolumeGroup01.getId()); createVolume(indexVolumeGroup01.getId()); createVolume(indexVolumeGroup02.getId()); createVolume(indexVolumeGroup02.getId()); createVolume(indexVolumeGroup02.getId()); createVolume(indexVolumeGroup02.getId()); createVolume(indexVolumeGroup03.getId()); final var indexVolumes = indexVolumeDao.getAll(); BiConsumer<Integer, Integer> checkTheNewVolumeExists = (id, expectedCount) -> { final var foundIndexVolumesForGroup = indexVolumes.stream() .filter(indexVolume -> indexVolume.getIndexVolumeGroupId().equals(id)).collect(Collectors.toList()); assertThat(foundIndexVolumesForGroup.size()).isEqualTo(expectedCount); }; checkTheNewVolumeExists.accept(indexVolumeGroup01.getId(), 2); checkTheNewVolumeExists.accept(indexVolumeGroup02.getId(), 4); checkTheNewVolumeExists.accept(indexVolumeGroup03.getId(), 1); }