### Question:
EncodedValue { public long setValue(long flags, long value) { value = Math.round(value / factor); checkValue((long) (value * factor)); value <<= shift; flags &= ~mask; return flags | value; } EncodedValue(String name, int shift, int bits, double factor, long defaultValue, int maxValue);  EncodedValue(String name, int shift, int bits, double factor, long defaultValue, int maxValue, boolean allowZero); long setValue(long flags, long value); String getName(); long getValue(long flags); int getBits(); double getFactor(); long setDefaultValue(long flags); long getMaxValue(); long swap(long flags, EncodedValue otherEncoder);  }### Answer:
@Test public void testSetValue() { EncodedValue instance = new EncodedValue("test", 6, 4, 1, 5, 10); assertEquals(10, instance.getValue(instance.setValue(0, 10))); instance = new EncodedValue("test", 0, 4, 1, 5, 10); assertEquals(10, instance.getValue(instance.setValue(0, 10))); instance = new EncodedValue("test", 0, 4, 1, 5, 10); assertEquals(5, instance.getValue(instance.setDefaultValue(0))); }