Vidyashree Rama
Committed by Gerrit Code Review

Whitebox issue fix

Change-Id: I856266e26d2686affb9271c460927ba3e0e07db2
...@@ -40,6 +40,6 @@ public enum ResolvableStatus { ...@@ -40,6 +40,6 @@ public enum ResolvableStatus {
40 /** 40 /**
41 * Identifies that resolvable entity is resolved. 41 * Identifies that resolvable entity is resolved.
42 */ 42 */
43 - RESOLVED; 43 + RESOLVED
44 44
45 } 45 }
......
1 /* 1 /*
2 - * Copyright 2016 Open Networking Laboratory 2 + * Copyright 2016-present Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -28,28 +28,28 @@ public interface YangLeavesHolder { ...@@ -28,28 +28,28 @@ public interface YangLeavesHolder {
28 /** 28 /**
29 * Returns the list of leaves from data holder like container / list. 29 * Returns the list of leaves from data holder like container / list.
30 * 30 *
31 - * @return the list of leaves. 31 + * @return the list of leaves
32 */ 32 */
33 - public List<YangLeaf> getListOfLeaf(); 33 + List<YangLeaf> getListOfLeaf();
34 34
35 /** 35 /**
36 - * Add a leaf in data holder like container / list. 36 + * Adds leaf in data holder like container / list.
37 * 37 *
38 - * @param leaf the leaf to be added. 38 + * @param leaf the leaf to be added
39 */ 39 */
40 void addLeaf(YangLeaf leaf); 40 void addLeaf(YangLeaf leaf);
41 41
42 /** 42 /**
43 * Returns the list of leaf-list from data holder like container / list. 43 * Returns the list of leaf-list from data holder like container / list.
44 * 44 *
45 - * @return the list of leaf-list. 45 + * @return the list of leaf-list
46 */ 46 */
47 List<YangLeafList> getListOfLeafList(); 47 List<YangLeafList> getListOfLeafList();
48 48
49 /** 49 /**
50 - * Add a leaf-list in data holder like container / list. 50 + * Adds leaf-list in data holder like container / list.
51 * 51 *
52 - * @param leafList the leaf-list to be added. 52 + * @param leafList the leaf-list to be added
53 */ 53 */
54 void addLeafList(YangLeafList leafList); 54 void addLeafList(YangLeafList leafList);
55 } 55 }
......
...@@ -20,7 +20,7 @@ package org.onosproject.yangutils.datamodel.utils; ...@@ -20,7 +20,7 @@ package org.onosproject.yangutils.datamodel.utils;
20 */ 20 */
21 public enum GeneratedLanguage { 21 public enum GeneratedLanguage {
22 /** 22 /**
23 - * Java. 23 + * Target language is java.
24 */ 24 */
25 - JAVA_GENERATION; 25 + JAVA_GENERATION
26 } 26 }
......
...@@ -43,12 +43,11 @@ public class YangUtilsParserManager implements YangUtilsParser { ...@@ -43,12 +43,11 @@ public class YangUtilsParserManager implements YangUtilsParser {
43 * Create a char stream that reads from YANG file. Throws an exception 43 * Create a char stream that reads from YANG file. Throws an exception
44 * in case input YANG file is either null or non existent. 44 * in case input YANG file is either null or non existent.
45 */ 45 */
46 - ANTLRInputStream input = null; 46 + ANTLRInputStream input;
47 try { 47 try {
48 input = new ANTLRFileStream(yangFile); 48 input = new ANTLRFileStream(yangFile);
49 } catch (IOException e) { 49 } catch (IOException e) {
50 - e.printStackTrace(); 50 + throw new ParserException("YANG file error : YANG file does not exist.");
51 - throw e;
52 } 51 }
53 52
54 // Create a lexer that feeds off of input char stream. 53 // Create a lexer that feeds off of input char stream.
......
...@@ -22,10 +22,10 @@ import org.onosproject.yangutils.parser.Parsable; ...@@ -22,10 +22,10 @@ import org.onosproject.yangutils.parser.Parsable;
22 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser; 22 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
23 import org.onosproject.yangutils.parser.exceptions.ParserException; 23 import org.onosproject.yangutils.parser.exceptions.ParserException;
24 import org.onosproject.yangutils.parser.impl.TreeWalkListener; 24 import org.onosproject.yangutils.parser.impl.TreeWalkListener;
25 +import org.onosproject.yangutils.utils.YangConstructType;
25 26
26 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY; 27 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
27 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage; 28 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
28 -import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_CONTENT;
29 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER; 29 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
30 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER; 30 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
31 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat; 31 import static org.onosproject.yangutils.parser.impl.parserutils.ListenerUtil.removeQuotesAndHandleConcat;
...@@ -44,7 +44,7 @@ import static org.onosproject.yangutils.utils.YangConstructType.STATUS_DATA; ...@@ -44,7 +44,7 @@ import static org.onosproject.yangutils.utils.YangConstructType.STATUS_DATA;
44 * deprecated-keyword 44 * deprecated-keyword
45 * 45 *
46 * ANTLR grammar rule 46 * ANTLR grammar rule
47 - * statusStatement : STATUS_KEYWORD (CURRENT_KEYWORD | OBSOLETE_KEYWORD | DEPRECATED_KEYWORD) STMTEND; 47 + * statusStatement : STATUS_KEYWORD status STMTEND;
48 */ 48 */
49 49
50 /** 50 /**
...@@ -99,14 +99,27 @@ public final class StatusListener { ...@@ -99,14 +99,27 @@ public final class StatusListener {
99 YangStatusType status; 99 YangStatusType status;
100 100
101 String value = removeQuotesAndHandleConcat(ctx.status().getText()); 101 String value = removeQuotesAndHandleConcat(ctx.status().getText());
102 - if (value.equals(CURRENT_KEYWORD)) { 102 + switch (value) {
103 + case CURRENT_KEYWORD: {
103 status = YangStatusType.CURRENT; 104 status = YangStatusType.CURRENT;
104 - } else if (value.equals(DEPRECATED_KEYWORD)) { 105 + break;
106 + }
107 + case DEPRECATED_KEYWORD: {
105 status = YangStatusType.DEPRECATED; 108 status = YangStatusType.DEPRECATED;
106 - } else if (value.equals(OBSOLETE_KEYWORD)) { 109 + break;
110 + }
111 + case OBSOLETE_KEYWORD: {
107 status = YangStatusType.OBSOLETE; 112 status = YangStatusType.OBSOLETE;
108 - } else { 113 + break;
109 - throw new ParserException(constructListenerErrorMessage(INVALID_CONTENT, STATUS_DATA, value, ENTRY)); 114 + }
115 + default: {
116 + ParserException parserException = new ParserException("YANG file error : " +
117 + YangConstructType.getYangConstructType(STATUS_DATA) + " " + ctx.status().getText() +
118 + " is not valid.");
119 + parserException.setLine(ctx.getStart().getLine());
120 + parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
121 + throw parserException;
122 + }
110 } 123 }
111 124
112 return status; 125 return status;
......
...@@ -26,12 +26,12 @@ public interface HasJavaFileInfo { ...@@ -26,12 +26,12 @@ public interface HasJavaFileInfo {
26 * 26 *
27 * @return generated java file information 27 * @return generated java file information
28 */ 28 */
29 - public JavaFileInfo getJavaFileInfo(); 29 + JavaFileInfo getJavaFileInfo();
30 30
31 /** 31 /**
32 * Sets the java file info object. 32 * Sets the java file info object.
33 * 33 *
34 * @param javaInfo java file info object 34 * @param javaInfo java file info object
35 */ 35 */
36 - public void setJavaFileInfo(JavaFileInfo javaInfo); 36 + void setJavaFileInfo(JavaFileInfo javaInfo);
37 } 37 }
......
...@@ -25,7 +25,7 @@ public interface HasJavaImportData { ...@@ -25,7 +25,7 @@ public interface HasJavaImportData {
25 * 25 *
26 * @return data of java imports to be included in generated file 26 * @return data of java imports to be included in generated file
27 */ 27 */
28 - public JavaImportData getJavaImportData(); 28 + JavaImportData getJavaImportData();
29 29
30 /** 30 /**
31 * Sets the data of java imports to be included in generated file. 31 * Sets the data of java imports to be included in generated file.
...@@ -33,5 +33,5 @@ public interface HasJavaImportData { ...@@ -33,5 +33,5 @@ public interface HasJavaImportData {
33 * @param javaImportData data of java imports to be included in generated 33 * @param javaImportData data of java imports to be included in generated
34 * file 34 * file
35 */ 35 */
36 - public void setJavaImportData(JavaImportData javaImportData); 36 + void setJavaImportData(JavaImportData javaImportData);
37 } 37 }
......
...@@ -29,7 +29,7 @@ import static org.onosproject.yangutils.translator.tojava.TraversalType.ROOT; ...@@ -29,7 +29,7 @@ import static org.onosproject.yangutils.translator.tojava.TraversalType.ROOT;
29 import static org.onosproject.yangutils.translator.tojava.TraversalType.SIBILING; 29 import static org.onosproject.yangutils.translator.tojava.TraversalType.SIBILING;
30 30
31 /** 31 /**
32 - * Representation of Java code generator based on application schema. 32 + * Representation of java code generator based on application schema.
33 */ 33 */
34 public final class JavaCodeGeneratorUtil { 34 public final class JavaCodeGeneratorUtil {
35 35
...@@ -75,7 +75,7 @@ public final class JavaCodeGeneratorUtil { ...@@ -75,7 +75,7 @@ public final class JavaCodeGeneratorUtil {
75 YangNode curNode = rootNode; 75 YangNode curNode = rootNode;
76 TraversalType curTraversal = ROOT; 76 TraversalType curTraversal = ROOT;
77 77
78 - while (!(curNode == null)) { 78 + while (curNode != null) {
79 if (curTraversal != PARENT) { 79 if (curTraversal != PARENT) {
80 setCurNode(curNode); 80 setCurNode(curNode);
81 generateCodeEntry(curNode, yangPlugin); 81 generateCodeEntry(curNode, yangPlugin);
...@@ -166,9 +166,8 @@ public final class JavaCodeGeneratorUtil { ...@@ -166,9 +166,8 @@ public final class JavaCodeGeneratorUtil {
166 * Free the current node. 166 * Free the current node.
167 * 167 *
168 * @param node YANG node 168 * @param node YANG node
169 - * @throws DataModelException when fails to do datamodel operations
170 */ 169 */
171 - private static void free(YangNode node) throws DataModelException { 170 + private static void free(YangNode node) {
172 171
173 YangNode parent = node.getParent(); 172 YangNode parent = node.getParent();
174 parent.setChild(null); 173 parent.setChild(null);
...@@ -202,7 +201,7 @@ public final class JavaCodeGeneratorUtil { ...@@ -202,7 +201,7 @@ public final class JavaCodeGeneratorUtil {
202 setCurNode(curNode.getChild()); 201 setCurNode(curNode.getChild());
203 TraversalType curTraversal = ROOT; 202 TraversalType curTraversal = ROOT;
204 203
205 - while (!(curNode == null)) { 204 + while (curNode != null) {
206 205
207 if (curTraversal != PARENT) { 206 if (curTraversal != PARENT) {
208 close(curNode); 207 close(curNode);
...@@ -220,7 +219,6 @@ public final class JavaCodeGeneratorUtil { ...@@ -220,7 +219,6 @@ public final class JavaCodeGeneratorUtil {
220 } 219 }
221 220
222 freeRestResources(); 221 freeRestResources();
223 - curNode = null;
224 } 222 }
225 223
226 /** 224 /**
......
...@@ -19,6 +19,7 @@ import java.util.ArrayList; ...@@ -19,6 +19,7 @@ import java.util.ArrayList;
19 import java.util.List; 19 import java.util.List;
20 import java.util.SortedSet; 20 import java.util.SortedSet;
21 import java.util.TreeSet; 21 import java.util.TreeSet;
22 +import static java.util.Collections.sort;
22 23
23 import org.onosproject.yangutils.datamodel.YangNode; 24 import org.onosproject.yangutils.datamodel.YangNode;
24 import org.onosproject.yangutils.translator.exception.TranslatorException; 25 import org.onosproject.yangutils.translator.exception.TranslatorException;
...@@ -62,7 +63,7 @@ public class JavaImportData { ...@@ -62,7 +63,7 @@ public class JavaImportData {
62 /** 63 /**
63 * Returns if the list needs to be imported. 64 * Returns if the list needs to be imported.
64 * 65 *
65 - * @return true if any of the attribute needs to be maintained as a list. 66 + * @return true if any of the attribute needs to be maintained as a list
66 */ 67 */
67 public boolean getIfListImported() { 68 public boolean getIfListImported() {
68 return isListToImport; 69 return isListToImport;
...@@ -71,7 +72,7 @@ public class JavaImportData { ...@@ -71,7 +72,7 @@ public class JavaImportData {
71 /** 72 /**
72 * Sets the status of importing list. 73 * Sets the status of importing list.
73 * 74 *
74 - * @param isList status to mention list is bing imported. 75 + * @param isList status to mention list is bing imported
75 */ 76 */
76 public void setIfListImported(boolean isList) { 77 public void setIfListImported(boolean isList) {
77 isListToImport = isList; 78 isListToImport = isList;
...@@ -138,10 +139,9 @@ public class JavaImportData { ...@@ -138,10 +139,9 @@ public class JavaImportData {
138 List<String> imports = new ArrayList<>(); 139 List<String> imports = new ArrayList<>();
139 140
140 for (JavaQualifiedTypeInfo importInfo : getImportSet()) { 141 for (JavaQualifiedTypeInfo importInfo : getImportSet()) {
141 - importString = IMPORT; 142 + if (!importInfo.getPkgInfo().equals(EMPTY_STRING) && importInfo.getClassInfo() != null
142 - if (importInfo.getPkgInfo() != EMPTY_STRING && importInfo.getClassInfo() != null 143 + && !importInfo.getPkgInfo().equals(JAVA_LANG)) {
143 - && importInfo.getPkgInfo() != JAVA_LANG) { 144 + importString = IMPORT + importInfo.getPkgInfo() + PERIOD + importInfo.getClassInfo() + SEMI_COLAN
144 - importString = importString + importInfo.getPkgInfo() + PERIOD + importInfo.getClassInfo() + SEMI_COLAN
145 + NEW_LINE; 145 + NEW_LINE;
146 146
147 imports.add(importString); 147 imports.add(importString);
...@@ -152,7 +152,7 @@ public class JavaImportData { ...@@ -152,7 +152,7 @@ public class JavaImportData {
152 imports.add(getImportForList()); 152 imports.add(getImportForList());
153 } 153 }
154 154
155 - java.util.Collections.sort(imports); 155 + sort(imports);
156 return imports; 156 return imports;
157 } 157 }
158 158
......
...@@ -1108,7 +1108,6 @@ public class TempJavaCodeFragmentFiles { ...@@ -1108,7 +1108,6 @@ public class TempJavaCodeFragmentFiles {
1108 addToStringMethod(newAttrInfo); 1108 addToStringMethod(newAttrInfo);
1109 } 1109 }
1110 } 1110 }
1111 - return;
1112 } 1111 }
1113 1112
1114 /** 1113 /**
......
...@@ -136,9 +136,11 @@ public class YangJavaModule extends YangModule implements JavaCodeGeneratorInfo, ...@@ -136,9 +136,11 @@ public class YangJavaModule extends YangModule implements JavaCodeGeneratorInfo,
136 YangJavaModelUtils.generateCodeOfRootNode(this, yangPlugin, modulePkg); 136 YangJavaModelUtils.generateCodeOfRootNode(this, yangPlugin, modulePkg);
137 } 137 }
138 138
139 + /**
140 + * Creates a java file using the YANG module info.
141 + */
139 @Override 142 @Override
140 public void generateCodeExit() throws IOException { 143 public void generateCodeExit() throws IOException {
141 getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this); 144 getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_INTERFACE_WITH_BUILDER, this);
142 - return;
143 } 145 }
144 } 146 }
......
...@@ -53,7 +53,6 @@ public final class FileSystemUtil { ...@@ -53,7 +53,6 @@ public final class FileSystemUtil {
53 * @return existence status of package 53 * @return existence status of package
54 */ 54 */
55 public static boolean doesPackageExist(String pkg) { 55 public static boolean doesPackageExist(String pkg) {
56 -
57 File pkgDir = new File(getPackageDirPathFromJavaJPackage(pkg)); 56 File pkgDir = new File(getPackageDirPathFromJavaJPackage(pkg));
58 File pkgWithFile = new File(pkgDir + SLASH + "package-info.java"); 57 File pkgWithFile = new File(pkgDir + SLASH + "package-info.java");
59 if (pkgDir.exists() && pkgWithFile.isFile()) { 58 if (pkgDir.exists() && pkgWithFile.isFile()) {
...@@ -70,7 +69,6 @@ public final class FileSystemUtil { ...@@ -70,7 +69,6 @@ public final class FileSystemUtil {
70 * @throws IOException any IO exception 69 * @throws IOException any IO exception
71 */ 70 */
72 public static void createPackage(String pkg, String pkgInfo) throws IOException { 71 public static void createPackage(String pkg, String pkgInfo) throws IOException {
73 -
74 if (!doesPackageExist(pkg)) { 72 if (!doesPackageExist(pkg)) {
75 try { 73 try {
76 File pack = createDirectories(pkg); 74 File pack = createDirectories(pkg);
...@@ -92,9 +90,7 @@ public final class FileSystemUtil { ...@@ -92,9 +90,7 @@ public final class FileSystemUtil {
92 * @throws IOException any IO errors 90 * @throws IOException any IO errors
93 */ 91 */
94 public static void appendFileContents(File toAppend, File srcFile) throws IOException { 92 public static void appendFileContents(File toAppend, File srcFile) throws IOException {
95 -
96 updateFileHandle(srcFile, NEW_LINE + readAppendFile(toAppend.toString(), FOUR_SPACE_INDENTATION), false); 93 updateFileHandle(srcFile, NEW_LINE + readAppendFile(toAppend.toString(), FOUR_SPACE_INDENTATION), false);
97 - return;
98 } 94 }
99 95
100 /** 96 /**
...@@ -106,7 +102,6 @@ public final class FileSystemUtil { ...@@ -106,7 +102,6 @@ public final class FileSystemUtil {
106 * @throws IOException when fails to convert to string 102 * @throws IOException when fails to convert to string
107 */ 103 */
108 public static String readAppendFile(String toAppend, String spaces) throws IOException { 104 public static String readAppendFile(String toAppend, String spaces) throws IOException {
109 -
110 FileReader fileReader = new FileReader(toAppend); 105 FileReader fileReader = new FileReader(toAppend);
111 BufferedReader bufferReader = new BufferedReader(fileReader); 106 BufferedReader bufferReader = new BufferedReader(fileReader);
112 try { 107 try {
...@@ -114,8 +109,8 @@ public final class FileSystemUtil { ...@@ -114,8 +109,8 @@ public final class FileSystemUtil {
114 String line = bufferReader.readLine(); 109 String line = bufferReader.readLine();
115 110
116 while (line != null) { 111 while (line != null) {
117 - if (line.equals(SPACE) | line.equals(EMPTY_STRING) | line.equals(EIGHT_SPACE_INDENTATION) 112 + if (line.equals(SPACE) || line.equals(EMPTY_STRING) || line.equals(EIGHT_SPACE_INDENTATION)
118 - | line.equals(MULTIPLE_NEW_LINE)) { 113 + || line.equals(MULTIPLE_NEW_LINE)) {
119 stringBuilder.append(NEW_LINE); 114 stringBuilder.append(NEW_LINE);
120 } else if (line.equals(FOUR_SPACE_INDENTATION)) { 115 } else if (line.equals(FOUR_SPACE_INDENTATION)) {
121 stringBuilder.append(EMPTY_STRING); 116 stringBuilder.append(EMPTY_STRING);
...@@ -142,7 +137,6 @@ public final class FileSystemUtil { ...@@ -142,7 +137,6 @@ public final class FileSystemUtil {
142 * does not exist but cannot be created, or cannot be opened for any other reason 137 * does not exist but cannot be created, or cannot be opened for any other reason
143 */ 138 */
144 public static void updateFileHandle(File inputFile, String contentTobeAdded, boolean isClose) throws IOException { 139 public static void updateFileHandle(File inputFile, String contentTobeAdded, boolean isClose) throws IOException {
145 -
146 FileWriter fileWriter = new FileWriter(inputFile, true); 140 FileWriter fileWriter = new FileWriter(inputFile, true);
147 PrintWriter outputPrintWriter = new PrintWriter(fileWriter, true); 141 PrintWriter outputPrintWriter = new PrintWriter(fileWriter, true);
148 if (!isClose) { 142 if (!isClose) {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
17 package org.onosproject.yangutils.utils.io.impl; 17 package org.onosproject.yangutils.utils.io.impl;
18 18
19 import org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax; 19 import org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax;
20 -import org.onosproject.yangutils.utils.UtilConstants;
21 20
22 import static org.onosproject.yangutils.utils.UtilConstants.BUILDER; 21 import static org.onosproject.yangutils.utils.UtilConstants.BUILDER;
23 import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_CLASS_JAVA_DOC; 22 import static org.onosproject.yangutils.utils.UtilConstants.BUILDER_CLASS_JAVA_DOC;
...@@ -62,7 +61,7 @@ public final class JavaDocGen { ...@@ -62,7 +61,7 @@ public final class JavaDocGen {
62 /** 61 /**
63 * JavaDocs types. 62 * JavaDocs types.
64 */ 63 */
65 - public static enum JavaDocType { 64 + public enum JavaDocType {
66 65
67 /** 66 /**
68 * For class. 67 * For class.
...@@ -141,7 +140,7 @@ public final class JavaDocGen { ...@@ -141,7 +140,7 @@ public final class JavaDocGen {
141 public static String getJavaDoc(JavaDocType type, String name, boolean isList) { 140 public static String getJavaDoc(JavaDocType type, String name, boolean isList) {
142 141
143 name = JavaIdentifierSyntax.getSmallCase(JavaIdentifierSyntax.getCamelCase(name, null)); 142 name = JavaIdentifierSyntax.getSmallCase(JavaIdentifierSyntax.getCamelCase(name, null));
144 - String javaDoc = UtilConstants.EMPTY_STRING; 143 + String javaDoc;
145 if (type.equals(JavaDocType.IMPL_CLASS)) { 144 if (type.equals(JavaDocType.IMPL_CLASS)) {
146 javaDoc = generateForImplClass(name); 145 javaDoc = generateForImplClass(name);
147 } else if (type.equals(JavaDocType.BUILDER_CLASS)) { 146 } else if (type.equals(JavaDocType.BUILDER_CLASS)) {
......
...@@ -60,7 +60,7 @@ public class YangUtilsParserManagerTest { ...@@ -60,7 +60,7 @@ public class YangUtilsParserManagerTest {
60 * This test case checks whether the io exception is generated 60 * This test case checks whether the io exception is generated
61 * when the input YANG file is non existent. 61 * when the input YANG file is non existent.
62 */ 62 */
63 - @Test(expected = IOException.class) 63 + @Test(expected = ParserException.class)
64 public void getDataModelNonExistentFileTest() throws IOException, ParserException { 64 public void getDataModelNonExistentFileTest() throws IOException, ParserException {
65 65
66 YangUtilsParserManager manager = new YangUtilsParserManager(); 66 YangUtilsParserManager manager = new YangUtilsParserManager();
......
...@@ -140,7 +140,7 @@ public class StatusListenerTest { ...@@ -140,7 +140,7 @@ public class StatusListenerTest {
140 @Test 140 @Test
141 public void processStatusInvalidValue() throws IOException, ParserException { 141 public void processStatusInvalidValue() throws IOException, ParserException {
142 thrown.expect(ParserException.class); 142 thrown.expect(ParserException.class);
143 - thrown.expectMessage("Invalid content in status \"invalid\" before processing."); 143 + thrown.expectMessage("YANG file error : status invalid is not valid.");
144 YangNode node = manager.getDataModel("src/test/resources/StatusInvalidValue.yang"); 144 YangNode node = manager.getDataModel("src/test/resources/StatusInvalidValue.yang");
145 } 145 }
146 146
......