@@ -0,0 +1,2619 @@
+package io.quarkus.hibernate.orm.attributeconverter;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0Aimport javax.inject.Inject;%0Aimport javax.persistence.AttributeConverter;%0Aimport javax.persistence.Basic;%0Aimport javax.persistence.Converter;%0Aimport javax.persistence.Entity;%0Aimport javax.persistence.GeneratedValue;%0Aimport javax.persistence.Id;%0Aimport javax.persistence.Table;%0Aimport javax.transaction.UserTransaction;%0A%0Aimport org.hibernate.Session;%0Aimport org.jboss.shrinkwrap.api.ShrinkWrap;%0Aimport org.jboss.shrinkwrap.api.spec.JavaArchive;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.api.extension.RegisterExtension;%0A%0Aimport io.quarkus.test.QuarkusUnitTest;%0A%0A/**%0A * Checks that %7B@code @Converter(autoApply = true)%7D works correctly.%0A * %3Cp%3E%0A * This test used to fail on startup when the annotation was not detected correctly.%0A */%0Apublic class AttributeConverterAutoApplyTest %7B%0A%0A    @RegisterExtension%0A    static QuarkusUnitTest runner = new QuarkusUnitTest()%0A            .setArchiveProducer(() -%3E ShrinkWrap.create(JavaArchive.class)%0A                    .addClass(MyEntity.class)%0A                    .addClass(MyData.class)%0A                    .addClass(MyDataConverter.class))%0A            .withConfigurationResource(%22application.properties%22);%0A%0A    @Inject%0A    Session session;%0A%0A    @Inject%0A    UserTransaction transaction;%0A%0A    @Test%0A    @SuppressWarnings(%22unchecked%22)%0A    public void testConverter() throws Exception %7B%0A        transaction.begin();%0A        MyEntity entity = new MyEntity();%0A        entity.myData = new MyData(%22foo%22);%0A        session.persist(entity);%0A        transaction.commit();%0A%0A        transaction.begin();%0A        assertThat(session.createNativeQuery(%22select myData from myentity%22).getResultList())%0A                .containsExactly(%22foo%22);%0A        transaction.commit();%0A    %7D%0A%0A    @Entity%0A    @Table(name = %22myentity%22)%0A    public static class MyEntity %7B%0A%0A        @Id%0A        @GeneratedValue%0A        public long id;%0A%0A        @Basic%0A        public MyData myData;%0A%0A    %7D%0A%0A    public static class MyData %7B%0A        public final String value;%0A%0A        public MyData(String value) %7B%0A            this.value = value;%0A        %7D%0A    %7D%0A%0A    @Converter(autoApply = true)%0A    public static class MyDataConverter implements AttributeConverter%3CMyData, String%3E %7B%0A        @Override%0A        public String convertToDatabaseColumn(MyData attribute) %7B%0A            return attribute == null ? null : attribute.value;%0A        %7D%0A%0A        @Override%0A        public MyData convertToEntityAttribute(String dbData) %7B%0A            return dbData == null ? null : new MyData(dbData);%0A        %7D%0A    %7D%0A%7D%0A

Test @Converter(autoApply = true)