@SuppressWarnings("unchecked")
@Test
public void testBoundObjectNoMembersTwoTypesNoPrefix() throws DecodingException {

    Codec codec1 = createMock(Codec.class);
    Codec codec2 = createMock(Codec.class);
    expect(metadata.isAnnotationPresent(Bound.class)).andReturn(false).anyTimes();
    expect(metadata.isAnnotationPresent(BoundObject.class)).andReturn(true).anyTimes();
    expect(metadata.getAnnotation(BoundObject.class)).andReturn(settings);
    expect(settings.selectFrom()).andReturn(choices).times(2);
    expect(choices.alternatives()).andReturn(new Choices.Choice[0]);
    expect(choices.defaultType()).andReturn((Class) Void.class);
    expect(settings.type()).andReturn((Class) Void.class);
    expect(settings.types()).andReturn(new Class[]{TestObject1.class, TestObject2.class})
            .times(2);
    expect(
            delegate.create((AnnotatedElement) EasyMock.isNull(), EasyMock.isA(Class.class),
                    (ResolverContext) EasyMock.isNull())).andReturn(codec1);
    expect(codec1.getTypes()).andReturn(new Class[]{TestObject1.class});
    expect(codec2.getTypes()).andReturn(new Class[]{TestObject2.class});
    expect(
            delegate.create((AnnotatedElement) EasyMock.isNull(), EasyMock.isA(Class.class),
                    (ResolverContext) EasyMock.isNull())).andReturn(codec2);
    replay(metadata, delegate, buffer, resolver, settings, codec1, codec2, choices);
    ObjectCodecFactory factory = new ObjectCodecFactory(delegate);
    try {
        Codec<TestObject1> created = factory.create(metadata, TestObject1.class, null);
        fail("Expecting failure due to missing prefixes.");
    } catch (CodecConstructionException cce) {
        // What we expect.
    }
    verify(metadata, delegate, buffer, resolver, settings, choices);
}