use of org.nhindirect.policy.PolicyGrammarException in project nhin-d by DirectProject.
the class SimpleTextV1LexiconPolicyParser_buildExpressionTest method testBuildExpression_binaryOperation_missingParameter_assertGrammarException.
public void testBuildExpression_binaryOperation_missingParameter_assertGrammarException() throws Exception {
final SimpleTextV1LexiconPolicyParser parser = new SimpleTextV1LexiconPolicyParser();
final InputStream stream = IOUtils.toInputStream("&& true");
final Vector<SimpleTextV1LexiconPolicyParser.TokenTypeAssociation> tokens = parser.parseToTokens(stream);
boolean exceptionOccured = false;
try {
parser.buildExpression(tokens.iterator());
} catch (PolicyGrammarException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
stream.close();
}
use of org.nhindirect.policy.PolicyGrammarException in project nhin-d by DirectProject.
the class SimpleTextV1LexiconPolicyParser_buildExpressionTest method testBuildExpression_operation_missingSingleParameter_assertGrammarException.
public void testBuildExpression_operation_missingSingleParameter_assertGrammarException() throws Exception {
final SimpleTextV1LexiconPolicyParser parser = new SimpleTextV1LexiconPolicyParser();
final InputStream stream = IOUtils.toInputStream("&&");
final Vector<SimpleTextV1LexiconPolicyParser.TokenTypeAssociation> tokens = parser.parseToTokens(stream);
boolean exceptionOccured = false;
try {
parser.buildExpression(tokens.iterator());
} catch (PolicyGrammarException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
stream.close();
}
use of org.nhindirect.policy.PolicyGrammarException in project nhin-d by DirectProject.
the class SimpleTextV1LexiconPolicyParser_parseTest method testParse_extraniousOperator_assertGrammarException.
public void testParse_extraniousOperator_assertGrammarException() throws Exception {
final SimpleTextV1LexiconPolicyParser parser = new SimpleTextV1LexiconPolicyParser();
final InputStream stream = IOUtils.toInputStream("1 = 1 =");
boolean exceptionOccured = false;
try {
parser.parse(stream);
} catch (PolicyGrammarException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.policy.PolicyGrammarException in project nhin-d by DirectProject.
the class SimpleTextV1LexiconPolicyParser_buildExpressionTest method testBuildExpression_emptyGroup_assertGrammarException.
public void testBuildExpression_emptyGroup_assertGrammarException() throws Exception {
final SimpleTextV1LexiconPolicyParser parser = new SimpleTextV1LexiconPolicyParser();
final InputStream stream = IOUtils.toInputStream("()");
final Vector<SimpleTextV1LexiconPolicyParser.TokenTypeAssociation> tokens = parser.parseToTokens(stream);
boolean exceptionOccured = false;
try {
parser.buildExpression(tokens.iterator());
} catch (PolicyGrammarException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.policy.PolicyGrammarException in project nhin-d by DirectProject.
the class SimpleTextV1LexiconPolicyParser_buildExpressionTest method testBuildExpression_erroniousExpressionAtEnd_assertGrammarException.
public void testBuildExpression_erroniousExpressionAtEnd_assertGrammarException() throws Exception {
final SimpleTextV1LexiconPolicyParser parser = new SimpleTextV1LexiconPolicyParser();
final InputStream stream = IOUtils.toInputStream("((d = 1)) +");
final Vector<SimpleTextV1LexiconPolicyParser.TokenTypeAssociation> tokens = parser.parseToTokens(stream);
boolean exceptionOccured = false;
try {
parser.buildExpression(tokens.iterator());
} catch (PolicyGrammarException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
Aggregations