### Question:
RollUpBitMask { public static int intValueFromTagList(final String allTags, final String rolledUpTags) { return fromRolledupTagList(allTags, rolledUpTags).asShort(); } private  RollUpBitMask(final short mask); static RollUpBitMask fromShort(final short maskValue); static RollUpBitMask fromMask(final short[] mask); static RollUpBitMask fromRolledupTagList(final String allTags, final String rolledUpTags); static byte[] byteValueFromTagList(final String allTags, final String rolledUpTags); static int intValueFromTagList(final String allTags, final String rolledUpTags); static RollUpBitMask fromTagPositions(final List<Integer> tagPositions); static RollUpBitMask fromTagPositions(final SortedSet<Integer> tagPositions); static RollUpBitMask fromBytes(final byte[] bytes); static Set<RollUpBitMask> getRollUpBitMasks(final int tagCount); static Set<List<Boolean>> getRollUpPermutationsAsBooleans(final int tagCount); static Set<List<Integer>> getRollUpPermutationsAsPositions(final int tagCount); SortedSet<Integer> getTagPositions(); List<Integer> getTagPositionsAsList(); List<Boolean> getBooleanMask(final int tagCount); boolean isTagPositionRolledUp(final int tagPosition); RollUpBitMask convert(final Map<Integer, Integer> newToOldFieldPositionMap); short asShort(); byte[] asBytes(); String asHexString(); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj); static final short MASK_LENGTH; static final RollUpBitMask ZERO_MASK; static final String ROLL_UP_TAG_VALUE; }### Answer:
@Test void testIntValueFromTagList() { final String allTags = "tag2,tag4,tag1,tag3"; final String rolledUpTags = "tag3,tag1"; final int maskVal = RollUpBitMask.intValueFromTagList(allTags, rolledUpTags); final int expectedMaskVal = RollUpBitMask.fromTagPositions(Arrays.asList(0, 2)).asShort(); assertThat(maskVal).isEqualTo(expectedMaskVal); }
@Test void testIntValueFromTagList_missingTag() { assertThatThrownBy(() -> { final String allTags = "tag2,tag4,tag1,tag3"; final String rolledUpTags = "tag3,tagBad"; final int maskVal = RollUpBitMask.intValueFromTagList(allTags, rolledUpTags); }).isInstanceOf(RuntimeException.class); }