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 org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
15 import org.junit.Test;
18 * Bug5151 involves adding <code>{@literal @}return</code> annotations to accessor methods.
20 public class Bug5151Test extends BaseCompilationTest {
22 private static final String BUG_ID = "bug5151";
25 public void test() throws Exception {
26 final File sourcesOutputDir = CompilationTestUtils.generatorOutput(BUG_ID);
27 final File compiledOutputDir = CompilationTestUtils.compilerOutput(BUG_ID);
28 generateTestSources(CompilationTestUtils.FS + "compilation" + CompilationTestUtils.FS + BUG_ID,
31 // Test if sources are compilable
32 CompilationTestUtils.testCompilation(sourcesOutputDir, compiledOutputDir);
34 final Map<String, File> generatedFiles = FileSearchUtil.getFiles(sourcesOutputDir);
35 assertEquals(13, generatedFiles.size());
37 final File fooContainerFile = generatedFiles.get("FooContainer.java");
38 assertNotNull(fooContainerFile);
39 FileSearchUtil.assertFileContains(fooContainerFile,
40 "@return {@code java.lang.String} fooInContainer, or {@code null} if it is not present");
42 final File fooDataFile = generatedFiles.get("FooData.java");
43 assertNotNull(fooDataFile);
44 FileSearchUtil.assertFileContains(fooDataFile,
45 "FooContainer} fooContainer, or {@code null} if it is not present");
47 CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);