System.out.println(xml);
}
public void testClientPropertyEncoding() throws Exception {
{
ClientProperty clientProperty = new ClientProperty("StringKey", "String", Constants.ENCODING_BASE64);
assertEquals("", "StringKey", clientProperty.getName());
assertEquals("", "String", clientProperty.getType());
assertEquals("", Constants.ENCODING_BASE64, clientProperty.getEncoding());
assertEquals("", true, clientProperty.isBase64());
assertEquals("", null, clientProperty.getStringValue());
assertEquals("", null, clientProperty.getValueRaw());
String xml = clientProperty.toXml();
assertXpathExists("/clientProperty[@name='StringKey']", xml);
assertXpathExists("/clientProperty[@type='String']", xml);
assertXpathExists("/clientProperty[@encoding='"+Constants.ENCODING_BASE64+"']", xml);
System.out.println(xml);
assertXMLEqual("comparing test xml to control xml",
"<clientProperty name='StringKey' type='String' encoding='base64'/>",
xml);
clientProperty.setValue("BlaBlaBla");
xml = clientProperty.toXml();
assertEquals("Base64?", "QmxhQmxhQmxh", clientProperty.getValueRaw());
assertEquals("", "BlaBlaBla", clientProperty.getStringValue());
System.out.println(xml);
assertXMLEqual("comparing test xml to control xml",
"<clientProperty name='StringKey' type='String' encoding='base64'>QmxhQmxhQmxh</clientProperty>",
xml);
try {
assertEquals("", 99, clientProperty.getIntValue());
fail("String to int not possible");
}
catch(java.lang.NumberFormatException e) {
System.out.println("OK Expected exception NumberFormatException");
}