|
| 1 | +/** |
| 2 | + * Copyright (C) 2010-2015 eBusiness Information, Excilys Group |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | + * use this file except in compliance with the License. You may obtain a copy of |
| 6 | + * the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed To in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | + * License for the specific language governing permissions and limitations under |
| 14 | + * the License. |
| 15 | + */ |
| 16 | +package org.androidannotations.otto; |
| 17 | + |
| 18 | +import static org.junit.Assert.assertFalse; |
| 19 | +import static org.junit.Assert.assertTrue; |
| 20 | + |
| 21 | +import java.io.File; |
| 22 | + |
| 23 | +import org.androidannotations.internal.AndroidAnnotationProcessor; |
| 24 | +import org.androidannotations.testutils.AAProcessorTestHelper; |
| 25 | +import org.junit.Before; |
| 26 | +import org.junit.Test; |
| 27 | + |
| 28 | +public class OttoGenerationTest extends AAProcessorTestHelper { |
| 29 | + |
| 30 | + @Before |
| 31 | + public void setUp() { |
| 32 | + addManifestProcessorParameter(OttoGenerationTest.class); |
| 33 | + addProcessor(AndroidAnnotationProcessor.class); |
| 34 | + } |
| 35 | + |
| 36 | + @Test |
| 37 | + public void enhancedClassCompilesSuccessfully() { |
| 38 | + assertCompilationSuccessful(compileFiles(EnhancedBean.class)); |
| 39 | + } |
| 40 | + |
| 41 | + @Test |
| 42 | + public void nonEnhancedClassCompilesSuccessfully() { |
| 43 | + assertCompilationSuccessful(compileFiles(NonEnhancedBean.class)); |
| 44 | + } |
| 45 | + |
| 46 | + @Test |
| 47 | + public void enhancedClassGeneratesCode() { |
| 48 | + CompileResult result = compileFiles(EnhancedBean.class); |
| 49 | + File generatedFile = toGeneratedFile(EnhancedBean.class); |
| 50 | + |
| 51 | + assertCompilationSuccessful(result); |
| 52 | + |
| 53 | + assertTrue(generatedFile.exists()); |
| 54 | + } |
| 55 | + |
| 56 | + @Test |
| 57 | + public void nonEnhancedClassDoesNotGenerateCode() { |
| 58 | + CompileResult result = compileFiles(NonEnhancedBean.class); |
| 59 | + File generatedFile = toGeneratedFile(NonEnhancedBean.class); |
| 60 | + |
| 61 | + assertCompilationSuccessful(result); |
| 62 | + |
| 63 | + assertFalse(generatedFile.exists()); |
| 64 | + } |
| 65 | +} |
0 commit comments