test_class.declarator: metadata
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AnnotatedElement metadata;
test_class.type: AnnotatedElement
test_class.var_name: metadata
test_class.declarator: boundBuffer
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private BoundBuffer boundBuffer;
test_class.type: BoundBuffer
test_class.var_name: boundBuffer
test_class.declarator: factory
test_class.modifier: private
test_class.original_string: private BoundBufferCodecFactory factory;
test_class.type: BoundBufferCodecFactory
test_class.var_name: factory
test_class.file: preon-binding/src/test/java/org/codehaus/preon/codec/BoundBufferCodecFactoryTest.java
test_class.identifier: BoundBufferCodecFactoryTest
test_case.body: @Test
      public void encodedBufferShouldEqualMatchBuffer() throws IOException {
          byte[] match = { 1, 2, 3, 4 };
  
          when(metadata.isAnnotationPresent(BoundBuffer.class)).thenReturn(true);
          when(metadata.getAnnotation(BoundBuffer.class)).thenReturn(boundBuffer);
          when(boundBuffer.match()).thenReturn(match);
  
          Codec<byte[]> codec = factory.create(metadata, byte[].class, null);
          ByteArrayOutputStream out = new ByteArrayOutputStream();
          codec.encode(match, new OutputStreamBitChannel(out), null);
  
          byte[] output = out.toByteArray();
          assertThat(output.length, is(match.length));
          assertArrayEquals(match, output);
      }
test_case.class_method_signature: BoundBufferCodecFactoryTest.encodedBufferShouldEqualMatchBuffer()
test_case.full_signature: @Test public void encodedBufferShouldEqualMatchBuffer()
test_case.identifier: encodedBufferShouldEqualMatchBuffer
test_case.invocations: thenReturn when isAnnotationPresent thenReturn when getAnnotation thenReturn when match create encode toByteArray assertThat is assertArrayEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void encodedBufferShouldEqualMatchBuffer()
focal_class.declarator: BYTE_CLASS = (new byte[0]).getClass()
focal_class.modifier: private
focal_class.original_string: private Class<?> BYTE_CLASS = (new byte[0]).getClass();
focal_class.type: Class<?>
focal_class.var_name: BYTE_CLASS
focal_class.file: preon-binding/src/main/java/org/codehaus/preon/codec/BoundBufferCodecFactory.java
focal_class.identifier: BoundBufferCodecFactory
focal_class.interfaces: implements CodecFactory
focal_class.class_method_signature: BoundBufferCodecFactory.create(AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context)
focal_class.full_signature: public Codec<T> create(AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context)
focal_class.identifier: create
focal_class.modifiers: public
focal_class.parameters: (AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context)
focal_class.return: Codec<T>
focal_class.signature: Codec<T> create(AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context)
focal_method.body: public <T> Codec<T> create(AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context) {
          if (type.isArray() && BYTE_CLASS.equals(type)
                  && metadata.isAnnotationPresent(BoundBuffer.class)) {
              return (Codec<T>) new BoundBufferCodec(metadata.getAnnotation(
                      BoundBuffer.class).match());
          } else {
              return null;
          }
      }
focal_method.class_method_signature: BoundBufferCodecFactory.create(AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context)
focal_method.full_signature: public Codec<T> create(AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context)
focal_method.identifier: create
focal_method.invocations: isArray equals isAnnotationPresent match getAnnotation
focal_method.modifiers: public
focal_method.parameters: (AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context)
focal_method.return: Codec<T>
focal_method.signature: Codec<T> create(AnnotatedElement metadata, Class<T> type,
                                 ResolverContext context)