mvdb 2003/01/15 16:54:50 Modified: betwixt/src/test/org/apache/commons/betwixt/io TestSAXBeanWriter.java Log: Fixed the testcase. Now there will be checked if the text node is empty. If it is not empty after a trim it will fail. Revision Changes Path 1.2 +18 -9 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/io/TestSAXBeanWriter.java Index: TestSAXBeanWriter.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/io/TestSAXBeanWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestSAXBeanWriter.java 8 Nov 2002 22:09:01 -0000 1.1 +++ TestSAXBeanWriter.java 16 Jan 2003 00:54:50 -0000 1.2 @@ -7,7 +7,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -102,7 +102,6 @@ SAXBeanWriter writer = new SAXBeanWriter(new SAXContentHandler(out)); writer.write(bean); String beanString = out.getBuffer().toString(); - // test the result DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); @@ -125,9 +124,19 @@ this.assertNotNull("Person name missing", child.getFirstChild()); this.assertEquals("Person name wrong", "John Smith", child.getFirstChild().getNodeValue().trim()); } else { - if (!child.getNodeName().equals("#text")) { - this.fail("Unknown attribute " + child.getNodeName()); + if (child.getNodeName().equals("#text")) { + // now check if the textNode is empty after a trim. + String value = child.getNodeValue(); + if (value != null) { + value = value.trim(); + } + if (value.length() != 0) { + fail("Text should not contain content in node " + child.getNodeName()); + } + }else{ + fail("Invalid node " + child.getNodeName()); } + } } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>