public class DecodersTest {
@Test
public void testFailDecoder() {
final HeaderDecoder headerDecoder = new HeaderDecoder();
final FailDecoder decoder = new FailDecoder();
final String inputStr = "FAIL 16 [1234,[5,6,7,8]]\n";
final ByteBuffer bb = ByteBuffer.wrap(inputStr.getBytes());
decoder.parse(bb, headerDecoder.parse(bb).getPayloadLength());
assertEquals(1234, decoder.getInputId());
final List<Integer> replicaIds = decoder.getReplicaIds();
for (int i = 0; i < 4; i++) {
assertEquals((i + 5), replicaIds.get(i).intValue());
}
}