RollUpBitMaskUtil { public static RollUpBitMask fromSortedTagList(final List<StatisticTag> tags) { final SortedSet<Integer> tagPositions = new TreeSet<>(); int pos = 0; if (tags != null) { for (final StatisticTag tag : tags) { if (RollUpBitMask.ROLL_UP_TAG_VALUE.equals(tag.getValue())) { tagPositions.add(pos); } pos++; } } return RollUpBitMask.fromTagPositions(tagPositions); }  static RollUpBitMask fromSortedTagList(final List<StatisticTag> tags);  }
@Test void testFromSortedTagList() { final List<StatisticTag> tagList = new ArrayList<>(); tagList.add(new StatisticTag("Tag0", "someValue")); tagList.add(new StatisticTag("Tag1", RollUpBitMask.ROLL_UP_TAG_VALUE)); tagList.add(new StatisticTag("Tag2", "someValue")); tagList.add(new StatisticTag("Tag3", RollUpBitMask.ROLL_UP_TAG_VALUE)); final RollUpBitMask rowKeyBitMap = RollUpBitMaskUtil.fromSortedTagList(tagList); assertThat(rowKeyBitMap.toString()).isEqualTo("000000000001010"); }
@Test void testFromSortedTagListEmptyList() { final List<StatisticTag> tagList = new ArrayList<>(); final RollUpBitMask rowKeyBitMap = RollUpBitMaskUtil.fromSortedTagList(tagList); assertThat(rowKeyBitMap.toString()).isEqualTo("000000000000000"); }
@Test void testFromSortedTagListNullList() { final RollUpBitMask rowKeyBitMap = RollUpBitMaskUtil.fromSortedTagList(null); assertThat(rowKeyBitMap.toString()).isEqualTo("000000000000000"); }