GSERParserTestCase.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2013-2014 Manuel Gaupp
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* This class tests the GSERParser.
*/
public class GSERParserTestCase extends DirectoryServerTestCase
{
/**
* Try to create a GSER Parser with <CODE>null</CODE> as parameter.
*/
public void testGSERParserInitWithNull () throws Exception
{
}
/**
* Test the <CODE>hasNext</CODE> method.
*/
@Test
public void testHasNext() throws Exception
{
}
/**
* Test the <CODE>skipSP</CODE> method.
*/
@Test
public void testSkipSP() throws Exception
{
{
}
}
/**
* Test the <CODE>skipMSP</CODE> method.
*/
@Test
public void testSkipMSP() throws Exception
{
{
}
}
/**
* Verify that <CODE>skipMSP</CODE> requires at least one space.
*/
public void testSkipMSPwithZeroSpaces() throws Exception
{
}
/**
* Create data for the <CODE>testSequence</CODE> test case.
*/
public Object[][] createSequenceValues()
{
return new Object[][] {
{"{123,122}", true},
{"{ 123,1}", true },
{"{ 123 , 1 }", true },
{"{0123,}", false},
{"{0123 42 }", false},
{"{123 , 11 ", false},
{" {123 , 11 ", false},
{" 123 , 11}", false}
};
}
/**
* Test sequence parsing.
*/
{
boolean result = true;
try
{
{
result = false;
}
}
catch (GSERException e)
{
result = false;
}
}
/**
* Create data for the <CODE>testString</CODE> test case.
*/
public Object[][] createStringValues()
{
return new Object[][] {
{"\"\"", true},
{"\"escaped\"\"dquotes\"", true },
{"\"valid Unicode \u00D6\u00C4\"", true },
{"\"only one \" \"", false},
{"invalid without dquotes", false},
{"\"missing end", false},
{"\"valid string\" with extra trailing characters", false}
};
}
/**
* Test the parsing of String values.
*/
{
boolean result = true;
try
{
{
result = false;
}
}
catch (GSERException e)
{
result = false;
}
}
/**
* Create data for the <CODE>testInteger</CODE> test case.
*/
public Object[][] createIntegerValues()
{
return new Object[][] {
{"0123456", true},
{"42", true},
{"0", true },
{"", false},
{"0xFF", false},
{"NULL", false},
{"Not a Number", false}
};
}
/**
* Create data for the <CODE>testBigInteger</CODE> test case.
*/
public Object[][] createBigIntegerValues()
{
return new Object[][] {
{"0123456", true},
{"42", true},
{"0", true },
{"", false},
{"0xFF", false},
{"NULL", false},
{"Not a Number", false},
{"2147483648",true}
};
}
/**
* Test the parsing of Integer values.
*/
{
boolean result = true;
try
{
{
result = false;
}
}
catch (GSERException e)
{
result = false;
}
}
/**
* Test the parsing of BigInteger values.
*/
{
boolean result = true;
try
{
{
result = false;
}
}
catch (GSERException e)
{
result = false;
}
}
/**
* Create data for the <CODE>testNamedValueIdentifier</CODE> test case.
*/
public Object[][] createNamedValueIdentifierValues()
{
return new Object[][] {
{"serialNumber ", true},
{"issuer ", true},
{"Serialnumber ", false},
{"0serialnumber ", false},
{"serial Number ", false},
{"missingSpace",false}
};
}
/**
* Test the parsing of NamedValue identifiers.
*/
{
boolean result = true;
try
{
{
result = false;
}
}
catch (GSERException e)
{
result = false;
}
}
/**
* Create data for the <CODE>testIdentifiedChoiceIdentifier</CODE> test case.
*/
public Object[][] createIdentifiedChoicdeIdentifierValues()
{
return new Object[][] {
{"serialNumber:", true},
{"issuer1:", true},
{"Serialnumber:", false},
{"0serialnumber:", false},
{"serial Number:", false},
{"missingColon",false}
};
}
/**
* Test the parsing of IdentifiedChoice identifiers.
*/
{
boolean result = true;
try
{
{
result = false;
}
}
catch (GSERException e)
{
result = false;
}
}
}