NumericCodec implements Codec<Object> { public void encode(Object value, BitChannel channel, Resolver resolver) throws IOException { type.encode(channel, sizeExpr.eval(resolver), byteOrder, value); } NumericCodec(Expression<Integer, Resolver> sizeExpr,
                        ByteOrder byteOrder, NumericType type,
                        Expression<Integer, Resolver> matchExpr); Object decode(BitBuffer buffer, Resolver resolver,
                         Builder builder); void encode(Object value, BitChannel channel, Resolver resolver); Class<?>[] getTypes(); Expression<Integer, Resolver> getSize(); Class<?> getType(); CodecDescriptor getCodecDescriptor(); String toString();  }
@Test public void shouldEncodeCorrectly() throws IOException { NumericCodec codec = new NumericCodec(size, ByteOrder.BigEndian, NumericCodec.NumericType.Long, matchExpression); when(size.eval(resolver)).thenReturn(3); codec.encode(new Long(12L), channel, resolver); Mockito.verify(channel).write(3, 12L, ByteOrder.BigEndian); }