### Question:
SortableSlot implements WritableComparable<SortableSlot> { public void addByte(int data) throws IOException { buffer.writeByte(data); }  void begin(int slot); int getSlot(); void addByte(int data); void addRandom(); void add(Writable data); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override int compareTo(SortableSlot o); @Override int hashCode(); @Override boolean equals(Object obj); static final String NAME_BEGIN; static final String NAME_ADD_BYTE; static final String NAME_ADD_RANDOM; static final String NAME_ADD; }### Answer:
@Test public void addByte() throws Exception { Map<String, SortableSlot> slots = new HashMap<>(); slots.put("min", createWithByte(Byte.MIN_VALUE)); slots.put("min-half", createWithByte(Byte.MIN_VALUE / 2)); slots.put("-1", createWithByte(-1)); slots.put("0", createWithByte(0)); slots.put("1", createWithByte(1)); slots.put("max-half", createWithByte(Byte.MAX_VALUE / 2)); slots.put("max", createWithByte(Byte.MAX_VALUE)); slots.put("0,-1", createWithByte(0)); slots.get("0,-1").addByte(-1); slots.put("0,0", createWithByte(0)); slots.get("0,0").addByte(-1); slots.put("0,1", createWithByte(0)); slots.get("0,1").addByte(-1); List<SortableSlot> copy = new ArrayList<>(slots.values()); Collections.sort(copy); assertThat(copy.get(0), is(slots.get("min"))); assertThat(copy.get(1), is(slots.get("min-half"))); assertThat(copy.get(2), is(slots.get("-1"))); assertThat(copy.get(3), is(slots.get("0"))); assertThat(copy.get(4), is(slots.get("0,-1"))); assertThat(copy.get(5), is(slots.get("0,0"))); assertThat(copy.get(6), is(slots.get("0,1"))); assertThat(copy.get(7), is(slots.get("1"))); assertThat(copy.get(8), is(slots.get("max-half"))); assertThat(copy.get(9), is(slots.get("max"))); }