2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.java.api.generator.test;
10 import static junit.framework.TestCase.assertTrue;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
16 import org.junit.Test;
19 * Bug5151 involves adding <code>{@literal @}return</code> annotations to accessor methods.
21 public class Bug5151Test extends BaseCompilationTest {
23 private static final String BUG_ID = "bug5151";
26 public void test() throws Exception {
27 final File sourcesOutputDir = CompilationTestUtils.generatorOutput(BUG_ID);
28 final File compiledOutputDir = CompilationTestUtils.compilerOutput(BUG_ID);
29 generateTestSources(CompilationTestUtils.FS + "compilation" + CompilationTestUtils.FS + BUG_ID,
32 // Test if sources are compilable
33 CompilationTestUtils.testCompilation(sourcesOutputDir, compiledOutputDir);
35 final Map<String, File> generatedFiles = FileSearchUtil.getFiles(sourcesOutputDir);
36 assertEquals(13, generatedFiles.size());
38 final File fooContainerFile = generatedFiles.get("FooContainer.java");
39 assertNotNull(fooContainerFile);
40 assertTrue(FileSearchUtil.findInFile(fooContainerFile,
41 "@return <code>java.lang.String</code> <code>fooInContainer</code>, "
42 + "or <code>null</code> if not present"));
44 final File fooDataFile = generatedFiles.get("FooData.java");
45 assertNotNull(fooDataFile);
46 assertTrue(FileSearchUtil.findInFile(fooDataFile,
47 "FooContainer</code> <code>fooContainer</code>, or <code>null</code> if not present"));
49 CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);