@Test
public void testVariousConditions() {

  RowMerger underTest = new RowMerger(observer);
  String rowKey = "row_key1";
  String family1 = "family1";
  String family2 = "family2";
  String qualifier1 = "qualifier1";
  String qualifier2 = "qualifier2";
  String value1 = "value1";
  String value2 = "value2";
  String value3 = "value3";
  String value4 = "value4";
  String value5 = "value5";
  ByteString rowKeyByteString = toByteString(rowKey);
  ByteString qualifier1ByteString = toByteString(qualifier1);
  ByteString qualifier2ByteString = toByteString(qualifier2);
  ByteString value1ByteString = toByteString(value1);
  ByteString value2ByteString = toByteString(value2);
  ByteString value3ByteString = toByteString(value3);
  ByteString value4ByteString = toByteString(value4);
  ByteString value5ByteString = toByteString(value5);
  final long ts1 = 54321L;
  final long ts2 = 12345L;
  final String label = "label";
  // TODO: For now, all values in the response should be translated. There should be some deduping
  // soon.
  underTest.onNext(
      ReadRowsResponse.newBuilder()
          .addAllChunks(
              Arrays.asList(
                  // First cell.
                  createCell(rowKey, family1, qualifier1, value1, ts1, false),
                  // Duplicate cell.
                  createCell(rowKey, family1, qualifier1, value1, ts1, false),
                  // Same family, same column, but different timestamps.
                  createCell(rowKey, family1, qualifier1, value2, ts2, false),
                  // With label
                  createCell(rowKey, family1, qualifier1, value2, ts2, false, label),
                  // Same family, same timestamp, but different column.
                  createCell(rowKey, family1, qualifier2, value3, ts1, false),
                  // Same column, same timestamp, but different family.
                  createCell(rowKey, family2, qualifier1, value4, ts1, false),
                  // Same timestamp, but different family qualifier2 column.
                  createCell(rowKey, family2, qualifier2, value5, ts1, true)))
          .build());
  verify(observer, times(1))
      .onNext(
          eq(
              FlatRow.newBuilder()
                  .withRowKey(rowKeyByteString)
                  .addCell(family1, qualifier1ByteString, ts1, value1ByteString)
                  .addCell(family1, qualifier1ByteString, ts2, value2ByteString)
                  .addCell(
                      family1, qualifier1ByteString, ts2, value2ByteString, Arrays.asList(label))
                  .addCell(family1, qualifier2ByteString, ts1, value3ByteString)
                  .addCell(family2, qualifier1ByteString, ts1, value4ByteString)
                  .addCell(family2, qualifier2ByteString, ts1, value5ByteString)
                  .build()));
}