[ONOS-4149],[ONOS-3909] YANG list translator impl and bug fixes.
Change-Id: Ia1a94142a3a114815766f661ed850bf9cacde66f
diff --git a/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java b/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java
index 1ae9143..22daf1a 100644
--- a/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java
+++ b/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java
@@ -16,18 +16,36 @@
package org.onosproject.yangutils.translator.tojava.utils;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertNotNull;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
-import org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType;
-import org.onosproject.yangutils.translator.tojava.GeneratedMethodTypes;
import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
-import org.onosproject.yangutils.utils.UtilConstants;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertNotNull;
+import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getImportText;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaAttributeDefination;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaClassDefClose;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaClassDefStart;
+import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getListAttribute;
+import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
+import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_CLOSE_BRACKET;
+import static org.onosproject.yangutils.utils.UtilConstants.DIAMOND_OPEN_BRACKET;
+import static org.onosproject.yangutils.utils.UtilConstants.IMPORT;
+import static org.onosproject.yangutils.utils.UtilConstants.INTERFACE;
+import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
+import static org.onosproject.yangutils.utils.UtilConstants.LIST;
+import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
+import static org.onosproject.yangutils.utils.UtilConstants.OPEN_CURLY_BRACKET;
+import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
+import static org.onosproject.yangutils.utils.UtilConstants.PRIVATE;
+import static org.onosproject.yangutils.utils.UtilConstants.PUBLIC;
+import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
+import static org.onosproject.yangutils.utils.UtilConstants.SPACE;
+import static org.onosproject.yangutils.utils.UtilConstants.STRING_DATA_TYPE;
/**
* Unit test cases for java code snippet generator.
@@ -36,10 +54,8 @@
private static final String PKG_INFO = "org.onosproject.unittest";
private static final String CLASS_INFO = "JavaCodeSnippetGenTest";
- private static final int FILE_GEN_TYPE = GeneratedJavaFileType.INTERFACE_MASK;
- private static final GeneratedMethodTypes METHOD_GEN_TYPE = GeneratedMethodTypes.GETTER;
+ private static final int FILE_GEN_TYPE = INTERFACE_MASK;
private static final String YANG_NAME = "Test";
- private static final String STRING = "String";
/**
* Unit test for private constructor.
@@ -54,6 +70,7 @@
@Test
public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
InstantiationException, IllegalAccessException, InvocationTargetException {
+
Class<?>[] classesToConstruct = {JavaCodeSnippetGen.class };
for (Class<?> clazz : classesToConstruct) {
Constructor<?> constructor = clazz.getDeclaredConstructor();
@@ -67,14 +84,14 @@
*/
@Test
public void testForImportText() {
+
JavaQualifiedTypeInfo importInfo = new JavaQualifiedTypeInfo();
importInfo.setPkgInfo(PKG_INFO);
importInfo.setClassInfo(CLASS_INFO);
- String imports = JavaCodeSnippetGen.getImportText(importInfo);
+ String imports = getImportText(importInfo);
- assertThat(true, is(imports.equals(UtilConstants.IMPORT + PKG_INFO + UtilConstants.PERIOD + CLASS_INFO
- + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE)));
+ assertThat(true, is(imports.equals(IMPORT + PKG_INFO + PERIOD + CLASS_INFO + SEMI_COLAN + NEW_LINE)));
}
/**
@@ -82,11 +99,10 @@
*/
@Test
public void testForJavaClassDefStart() {
- String classDef = JavaCodeSnippetGen.getJavaClassDefStart(FILE_GEN_TYPE, YANG_NAME);
- assertThat(true,
- is(classDef.equals(UtilConstants.PUBLIC + UtilConstants.SPACE + UtilConstants.INTERFACE
- + UtilConstants.SPACE + YANG_NAME + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET
- + UtilConstants.NEW_LINE)));
+
+ String classDef = getJavaClassDefStart(FILE_GEN_TYPE, YANG_NAME);
+ assertThat(true, is(classDef
+ .equals(PUBLIC + SPACE + INTERFACE + SPACE + YANG_NAME + SPACE + OPEN_CURLY_BRACKET + NEW_LINE)));
}
@@ -95,36 +111,20 @@
*/
@Test
public void testForListAttribute() {
- String listAttribute = JavaCodeSnippetGen.getListAttribute(STRING);
- assertThat(true, is(listAttribute.equals(UtilConstants.LIST + UtilConstants.DIAMOND_OPEN_BRACKET + STRING
- + UtilConstants.DIAMOND_CLOSE_BRACKET)));
+
+ String listAttribute = getListAttribute(STRING_DATA_TYPE);
+ assertThat(true,
+ is(listAttribute.equals(LIST + DIAMOND_OPEN_BRACKET + STRING_DATA_TYPE + DIAMOND_CLOSE_BRACKET)));
}
/**
* Unit test case for java class interface definition close.
*/
@Test
- public void testForJavaClassDefInterfaceClose() {
- String interfaceDef = JavaCodeSnippetGen.getJavaClassDefClose();
- assertThat(true, is(interfaceDef.equals(UtilConstants.CLOSE_CURLY_BRACKET)));
- }
+ public void testForJavaClassDefClose() {
- /**
- * Unit test case for java class builder class definition close.
- */
- @Test
- public void testForJavaClassDefBuilderClassClose() {
- String builderClassDef = JavaCodeSnippetGen.getJavaClassDefClose();
- assertThat(true, is(builderClassDef.equals(UtilConstants.CLOSE_CURLY_BRACKET)));
- }
-
- /**
- * Unit test case for java class typedef definition close.
- */
- @Test
- public void testForJavaClassDefTypeDefClose() {
- String typeDef = JavaCodeSnippetGen.getJavaClassDefClose();
- assertThat(true, is(typeDef.equals(UtilConstants.CLOSE_CURLY_BRACKET)));
+ String interfaceDef = getJavaClassDefClose();
+ assertThat(true, is(interfaceDef.equals(CLOSE_CURLY_BRACKET)));
}
/**
@@ -133,30 +133,22 @@
@Test
public void testForJavaAttributeInfo() {
- String attributeWithoutTypePkg = JavaCodeSnippetGen.getJavaAttributeDefination(null, UtilConstants.STRING,
- YANG_NAME, false);
- assertThat(true,
- is(attributeWithoutTypePkg.equals(UtilConstants.PRIVATE + UtilConstants.SPACE + UtilConstants.STRING
- + UtilConstants.SPACE + YANG_NAME + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE)));
- String attributeWithTypePkg = JavaCodeSnippetGen.getJavaAttributeDefination(
- UtilConstants.JAVA_LANG, UtilConstants.STRING, YANG_NAME, false);
- assertThat(true, is(attributeWithTypePkg
- .equals(UtilConstants.PRIVATE + UtilConstants.SPACE + UtilConstants.JAVA_LANG + UtilConstants.PERIOD
- + UtilConstants.STRING + UtilConstants.SPACE + YANG_NAME + UtilConstants.SEMI_COLAN
- + UtilConstants.NEW_LINE)));
- String attributeWithListPkg = JavaCodeSnippetGen.getJavaAttributeDefination(
- UtilConstants.JAVA_LANG, UtilConstants.STRING, YANG_NAME, true);
- assertThat(true,
- is(attributeWithListPkg.equals(UtilConstants.PRIVATE + UtilConstants.SPACE + UtilConstants.LIST
- + UtilConstants.DIAMOND_OPEN_BRACKET + UtilConstants.JAVA_LANG + UtilConstants.PERIOD
- + UtilConstants.STRING + UtilConstants.DIAMOND_CLOSE_BRACKET + UtilConstants.SPACE + YANG_NAME
- + UtilConstants.SUFIX_S + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE)));
- String attributeWithListWithoutPkg = JavaCodeSnippetGen.getJavaAttributeDefination(null, UtilConstants.STRING,
- YANG_NAME, true);
- assertThat(true,
- is(attributeWithListWithoutPkg.equals(UtilConstants.PRIVATE + UtilConstants.SPACE + UtilConstants.LIST
- + UtilConstants.DIAMOND_OPEN_BRACKET + UtilConstants.STRING
- + UtilConstants.DIAMOND_CLOSE_BRACKET + UtilConstants.SPACE + YANG_NAME + UtilConstants.SUFIX_S
- + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE)));
+ String attributeWithoutTypePkg = getJavaAttributeDefination(null, STRING_DATA_TYPE, YANG_NAME, false);
+ assertThat(true, is(attributeWithoutTypePkg.equals(
+ PRIVATE + SPACE + STRING_DATA_TYPE + SPACE + YANG_NAME + SEMI_COLAN + NEW_LINE)));
+
+ String attributeWithTypePkg = getJavaAttributeDefination(JAVA_LANG, STRING_DATA_TYPE, YANG_NAME, false);
+ assertThat(true, is(attributeWithTypePkg.equals(PRIVATE + SPACE + JAVA_LANG + PERIOD
+ + STRING_DATA_TYPE + SPACE + YANG_NAME + SEMI_COLAN + NEW_LINE)));
+
+ String attributeWithListPkg = getJavaAttributeDefination(JAVA_LANG, STRING_DATA_TYPE, YANG_NAME, true);
+ assertThat(true, is(attributeWithListPkg.equals(
+ PRIVATE + SPACE + LIST + DIAMOND_OPEN_BRACKET + JAVA_LANG + PERIOD + STRING_DATA_TYPE
+ + DIAMOND_CLOSE_BRACKET + SPACE + YANG_NAME + SEMI_COLAN + NEW_LINE)));
+
+ String attributeWithListWithoutPkg = getJavaAttributeDefination(null, STRING_DATA_TYPE, YANG_NAME, true);
+ assertThat(true, is(attributeWithListWithoutPkg.equals(
+ PRIVATE + SPACE + LIST + DIAMOND_OPEN_BRACKET + STRING_DATA_TYPE + DIAMOND_CLOSE_BRACKET + SPACE
+ + YANG_NAME + SEMI_COLAN + NEW_LINE)));
}
}
diff --git a/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java b/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
deleted file mode 100644
index fddd7a9..0000000
--- a/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright 2016 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.translator.tojava.utils;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
-import org.onosproject.yangutils.utils.UtilConstants;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-
-/**
- * Unit tests for generated methods from the file type.
- */
-public final class MethodsGeneratorTest {
-
- public static JavaAttributeInfo testAttr;
- public static YangType<?> attrType = new YangType<>();
-
- /**
- * Unit test for private constructor.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the
- * private constructor
- * @throws IllegalAccessException if instance is provoked or a method is
- * provoked
- * @throws InvocationTargetException when an exception occurs by the method
- * or constructor
- */
- @Test
- public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {
- MethodsGenerator.class
- };
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertNotNull(constructor.newInstance());
- }
- }
-
- // /**
- // * Unit test case for checking the parse builder and typedef constructor.
- // */
- // @Test
- // public void getParseBuilderInterfaceMethodConstructorTest() {
- //
- // JavaQualifiedTypeInfo forSetter = new JavaQualifiedTypeInfo();
- // attrType.setDataTypeName("binary");
- // attrType.getDataTypeName();
- // attrType.setDataType(YangDataTypes.BINARY);
- // attrType.getDataType();
- // testAttr.setAttributeName("attributeTest");
- // testAttr.setAttributeType(attrType);
- // forSetter.setPkgInfo("test1/test3");
- // forSetter.setClassInfo("This class contains");
- // testAttr.setImportInfo(forSetter);
- // String stringTypeDef = MethodsGenerator.getTypeDefConstructor(testAttr, "Testname");
- // }
-
- /**
- * Unit test case for checking the values received from constructor, default
- * constructor and build string formation.
- */
- @Test
- public void getValuesTest() {
-
- String stringConstructor = MethodsGenerator.getConstructorString("testname");
- assertThat(stringConstructor.contains(UtilConstants.JAVA_DOC_CONSTRUCTOR)
- && stringConstructor.contains(UtilConstants.JAVA_DOC_PARAM)
- && stringConstructor.contains(UtilConstants.BUILDER_OBJECT), is(true));
- String stringDefaultConstructor = MethodsGenerator.getDefaultConstructorString("testnameBuilder", "public");
- assertThat(stringDefaultConstructor.contains(UtilConstants.JAVA_DOC_DEFAULT_CONSTRUCTOR)
- && stringDefaultConstructor.contains(UtilConstants.BUILDER)
- && stringDefaultConstructor.contains("testname"), is(true));
- String stringBuild = MethodsGenerator.getBuildString("testname");
- assertThat(stringBuild.contains(UtilConstants.OVERRIDE) && stringBuild.contains(UtilConstants.BUILD)
- && stringBuild.contains(UtilConstants.RETURN), is(true));
-
- }
-
- /**
- * Unit test for checking the values received for class getter, class and
- * typedef setters with list data type.
- */
- // @Test
- // public void getGetterSetterTest() {
- //
- // JavaQualifiedTypeInfo forGetterSetter = new JavaQualifiedTypeInfo();
- // attrType.setDataTypeName("int");
- // attrType.getDataTypeName();
- // attrType.setDataType(YangDataTypes.UINT8);
- // attrType.getDataType();
- // testAttr.setAttributeName("AttributeTest1");
- // testAttr.setAttributeType(attrType);
- // forGetterSetter.setPkgInfo("null");
- // forGetterSetter.setClassInfo("This class contains");
- // testAttr.setImportInfo(forGetterSetter);
- // testAttr.setListAttr(true);
- // String getterForClass = MethodsGenerator.getGetterForClass(testAttr);
- // assertThat(getterForClass.contains(UtilConstants.GET_METHOD_PREFIX) && getterForClass.contains("List<")
- // && getterForClass.contains("attributeTest1"), is(true));
- // String setterForClass = MethodsGenerator.getSetterForClass(testAttr, "TestThis");
- // assertThat(setterForClass.contains(UtilConstants.SET_METHOD_PREFIX) && setterForClass.contains("List<")
- // && setterForClass.contains("attributeTest1"), is(true));
- // String typeDefSetter = MethodsGenerator.getSetterForTypeDefClass(testAttr);
- // assertThat(typeDefSetter.contains(UtilConstants.SET_METHOD_PREFIX) && typeDefSetter.contains("List<")
- // && typeDefSetter.contains("attributeTest1") && typeDefSetter.contains("this."), is(true));
- // }
-
- /**
- * Unit test case for checking the parse builder and typedef constructor
- * with list data type.
- */
- // @Test
- // public void getConstructorWithListTypeTest() {
- //
- // JavaQualifiedTypeInfo forSetter = new JavaQualifiedTypeInfo();
- // attrType.setDataTypeName("binary");
- // attrType.getDataTypeName();
- // attrType.setDataType(YangDataTypes.BINARY);
- // attrType.getDataType();
- // testAttr.setAttributeName("attributeTest");
- // testAttr.setAttributeType(attrType);
- // forSetter.setPkgInfo("null");
- // forSetter.setClassInfo("This class contains");
- // testAttr.setImportInfo(forSetter);
- // testAttr.setListAttr(true);
- // String stringTypeDef = MethodsGenerator.getTypeDefConstructor(testAttr, "Testname");
- // assertThat(stringTypeDef.contains("(List<") && stringTypeDef.contains("Testname")
- // && stringTypeDef.contains(UtilConstants.THIS), is(true));
- // }
-}
diff --git a/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java b/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
index a41ed7d..cfa1cf1 100644
--- a/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
+++ b/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
@@ -21,9 +21,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.utils.UtilConstants;
import static org.junit.Assert.assertNotNull;
@@ -34,12 +32,12 @@
*/
public final class FileSystemUtilTest {
- public static final String BASE_DIR_PKG = "target.UnitTestCase.";
- public static final String PKG_INFO_CONTENT = "testGeneration6";
- public static final String BASE_PKG = "target/UnitTestCase";
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
+ private static final String BASE_DIR_PKG = "target.UnitTestCase.";
+ private static final String PKG_INFO_CONTENT = "testGeneration6";
+ private static final String BASE_PKG = "target/UnitTestCase";
+ private static final String TEST_DATA_1 = "This is to append a text to the file first1\n";
+ private static final String TEST_DATA_2 = "This is next second line\n";
+ private static final String TEST_DATA_3 = "This is next third line in the file";
/**
* A private constructor is tested.
@@ -47,20 +45,15 @@
* @throws SecurityException if any security violation is observed
* @throws NoSuchMethodException if when the method is not found
* @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the
- * private constructor
- * @throws IllegalAccessException if instance is provoked or a method is
- * provoked
- * @throws InvocationTargetException when an exception occurs by the method
- * or constructor
+ * @throws InstantiationException if instantiation is provoked for the private constructor
+ * @throws IllegalAccessException if instance is provoked or a method is provoked
+ * @throws InvocationTargetException when an exception occurs by the method or constructor
*/
@Test
public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
InstantiationException, IllegalAccessException, InvocationTargetException {
- Class<?>[] classesToConstruct = {
- FileSystemUtil.class
- };
+ Class<?>[] classesToConstruct = {FileSystemUtil.class };
for (Class<?> clazz : classesToConstruct) {
Constructor<?> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
@@ -70,6 +63,8 @@
/**
* This test case checks the contents to be written in the file.
+ *
+ * @throws IOException when fails to create a test file
*/
@Test
public void updateFileHandleTest() throws IOException {
@@ -80,15 +75,17 @@
createFile.createNewFile();
File createSourceFile = new File(dir + "sourceTestFile");
createSourceFile.createNewFile();
- FileSystemUtil.updateFileHandle(createFile, "This is to append a text to the file first1\n", false);
- FileSystemUtil.updateFileHandle(createFile, "This is next second line\n", false);
- FileSystemUtil.updateFileHandle(createFile, "This is next third line in the file", false);
+ FileSystemUtil.updateFileHandle(createFile, TEST_DATA_1, false);
+ FileSystemUtil.updateFileHandle(createFile, TEST_DATA_2, false);
+ FileSystemUtil.updateFileHandle(createFile, TEST_DATA_3, false);
FileSystemUtil.appendFileContents(createFile, createSourceFile);
FileSystemUtil.updateFileHandle(createFile, null, true);
}
/**
- * This test case checks whether the package is existing.
+ * This test case checks whether the package is existing.
+ *
+ * @throws IOException when failed to create a test file
*/
@Test
public void packageExistTest() throws IOException {
@@ -104,21 +101,4 @@
createDir.delete();
}
- /**
- * This test case checks the package does not exist.
- */
- // @Test
- // public void packageNotExistTest() throws IOException {
-
- // String dirPath = "notexist1.notexist2";
- // String strPath = BASE_DIR_PKG + dirPath;
- // File createDir = new File(strPath.replace(UtilConstants.PERIOD, UtilConstants.SLASH));
- // assertFalse(FileSystemUtil.doesPackageExist(strPath));
- // createDir.mkdirs();
- // assertFalse(FileSystemUtil.doesPackageExist(strPath));
- // CopyrightHeader.parseCopyrightHeader();
- // FileSystemUtil.createPackage(strPath, PKG_INFO_CONTENT);
- // assertTrue(FileSystemUtil.doesPackageExist(strPath));
- // createDir.delete();
- // }
}
diff --git a/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java b/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java
index a0f88cb..4a1d8de 100644
--- a/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java
+++ b/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java
@@ -62,7 +62,7 @@
@Test
public void buildGenerationTest() {
- String buildDoc = JavaDocGen.getJavaDoc(JavaDocType.BUILD, "testGeneration1", false);
+ String buildDoc = JavaDocGen.getJavaDoc(JavaDocType.BUILD_METHOD, "testGeneration1", false);
assertTrue(buildDoc.contains("Builds object of") && buildDoc.contains(" */\n"));
}
@@ -117,7 +117,7 @@
@Test
public void getterGenerationTest() {
- String getterJavaDoc = JavaDocGen.getJavaDoc(JavaDocType.GETTER, "testGeneration1", false);
+ String getterJavaDoc = JavaDocGen.getJavaDoc(JavaDocType.GETTER_METHOD, "testGeneration1", false);
assertTrue(getterJavaDoc.contains("Returns the attribute") && getterJavaDoc.contains(" */\n"));
}
@@ -157,7 +157,7 @@
@Test
public void setterGenerationTest() {
- String setterJavaDoc = JavaDocGen.getJavaDoc(JavaDocType.SETTER, "testGeneration1", false);
+ String setterJavaDoc = JavaDocGen.getJavaDoc(JavaDocType.SETTER_METHOD, "testGeneration1", false);
assertTrue(setterJavaDoc.contains("Returns the builder object of") && setterJavaDoc.contains(" */\n"));
}
@@ -167,7 +167,7 @@
@Test
public void typeDefSetterGenerationTest() {
- String typeDefSetter = JavaDocGen.getJavaDoc(JavaDocType.TYPE_DEF_SETTER, "testGeneration1", false);
+ String typeDefSetter = JavaDocGen.getJavaDoc(JavaDocType.TYPE_DEF_SETTER_METHOD, "testGeneration1", false);
assertTrue(typeDefSetter.contains("Sets the value of") && typeDefSetter.contains(" */\n"));
}
}
\ No newline at end of file