### Question:
BitFieldDataType extends AbstractDataType { @Override public Object getValue(MemBuffer buf, Settings settings, int length) { if (effectiveBitSize == 0) { return new Scalar(0, 0); } BigInteger big = getBigIntegerValue(buf, settings); if (big == null) { return null; } if (effectiveBitSize <= 64) { return new Scalar(effectiveBitSize, big.longValue(), getPrimitiveBaseDataType().isSigned()); } return big; } protected  BitFieldDataType(DataType baseDataType, int bitSize, int bitOffset); protected  BitFieldDataType(DataType baseDataType, int bitSize); boolean isZeroLengthField(); static int getEffectiveBitSize(int declaredBitSize, int baseTypeByteSize); static int getMinimumStorageSize(int bitSize); static int getMinimumStorageSize(int bitSize, int bitOffset); static void checkBaseDataType(DataType baseDataType); static boolean isValidBaseDataType(DataType baseDataType); @Override void addParent(DataType dt); int getBaseTypeSize(); int getStorageSize(); int getBitSize(); int getDeclaredBitSize(); int getBitOffset(); DataType getBaseDataType(); AbstractIntegerDataType getPrimitiveBaseDataType(); @Override final SettingsDefinition[] getSettingsDefinitions(); @Override final boolean isEquivalent(DataType dt); @Override final int hashCode(); @Override final boolean equals(Object obj); @Override Settings getDefaultSettings(); @Override final DataType copy(DataTypeManager dtm); @Override BitFieldDataType clone(DataTypeManager dtm); @Override int getLength(); @Override String getDescription(); @Override Object getValue(MemBuffer buf, Settings settings, int length); @Override Class<?> getValueClass(Settings settings); @Override String getRepresentation(MemBuffer buf, Settings settings, int length); @Override void setDefaultSettings(Settings settings); @Override int getAlignment(); @Override String toString();  }### Answer:
@Test public void testGetValueWithSignedBaseType() throws Exception { assertEquals(-1, getValue(bitField(1, 0), 0x55)); assertEquals(0, getValue(bitField(1, 1), 0x55)); assertEquals(1, getValue(bitField(2, 0), 0x55)); assertEquals(-3, getValue(bitField(3, 0), 0x55)); assertEquals(5, getValue(bitField(4, 0), 0x55)); }
@Test public void testGetValueWithUnsignedBaseType() throws Exception { assertEquals(1, getValue(unsignedBitField(1, 0), 0x55)); assertEquals(0, getValue(unsignedBitField(1, 1), 0x55)); assertEquals(1, getValue(unsignedBitField(2, 0), 0x55)); assertEquals(5, getValue(unsignedBitField(3, 0), 0x55)); assertEquals(5, getValue(unsignedBitField(4, 0), 0x55)); }