@Test
public void shouldEncodeCorrectly() throws IOException {

    int nrbits = 2;
    EnumCodec<Direction> codec = new EnumCodec<Direction>(Direction.class, map, size, BigEndian);
    when(size.eval(org.mockito.Matchers.any(Resolver.class))).thenReturn(nrbits);
    codec.encode(Direction.Backward, channel, resolver);
    verify(channel).write(nrbits, 2L, BigEndian);
    verifyNoMoreInteractions(channel);
    verifyNoMoreInteractions(resolver);
}