|
| 1 | +/* |
| 2 | + * Hibernate, Relational Persistence for Idiomatic Java |
| 3 | + * |
| 4 | + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. |
| 5 | + * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. |
| 6 | + */ |
| 7 | +package org.hibernate.processor.test.supresswarnings; |
| 8 | + |
| 9 | +import org.hibernate.processor.HibernateProcessor; |
| 10 | +import org.hibernate.processor.test.util.CompilationTest; |
| 11 | +import org.hibernate.processor.test.util.WithClasses; |
| 12 | +import org.hibernate.processor.test.util.WithProcessorOption; |
| 13 | +import org.junit.Test; |
| 14 | + |
| 15 | +import static org.hibernate.processor.test.util.TestUtil.assertMetamodelClassGeneratedFor; |
| 16 | +import static org.hibernate.processor.test.util.TestUtil.getMetaModelSourceAsString; |
| 17 | +import static org.junit.Assert.assertTrue; |
| 18 | + |
| 19 | +/** |
| 20 | + * @author Hardy Ferentschik |
| 21 | + */ |
| 22 | +public class SuppressExplicitWarningsAnnotationGeneratedTest extends CompilationTest { |
| 23 | + @Test |
| 24 | + @WithClasses(TestEntity.class) |
| 25 | + @WithProcessorOption(key = HibernateProcessor.ADD_SUPPRESS_WARNINGS_ANNOTATION, value = "foo, bar") |
| 26 | + public void testSuppressedWarningsAnnotationGenerated() { |
| 27 | + assertMetamodelClassGeneratedFor( TestEntity.class ); |
| 28 | + |
| 29 | + // need to check the source because @SuppressWarnings is not a runtime annotation |
| 30 | + String metaModelSource = getMetaModelSourceAsString( TestEntity.class ); |
| 31 | + assertTrue( |
| 32 | + "@SuppressWarnings should be added to the metamodel.", |
| 33 | + metaModelSource.contains( "@SuppressWarnings({\"foo\", \"bar\"})" ) |
| 34 | + ); |
| 35 | + } |
| 36 | +} |
0 commit comments