protected void assertImplement( String comment, Object[] objects, Class expectedClass ) { if (objects.length == 0) fail( "No " + comment + " found." ); for (int i = 0; i < objects.length; i++) { assertImplements( comment, objects[i], expectedClass ); } }
/** * define a Web Page with the given page name and boy adding the html and body tags with pageName as the title of the page * use the given xml names space if it is not null * @param xmlns * @param pageName * @param body */ protected void defineWebPage( String xmlns,String pageName, String body ) { String preamble=""; if (xmlns==null) xmlns=""; else { preamble ="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; preamble+="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; xmlns=" xmlns=\""+xmlns+"\""; } defineResource( pageName + ".html", preamble+"<html"+xmlns+">\n<head><title>" + pageName + "</title></head>\n" + "<body>\n" + body + "\n</body>\n</html>" ); }
private void assertMatchingSet( String comment, Object[] expected, Vector foundItems ) { Vector expectedItems = new Vector(); for (int i = 0; i < expected.length; i++) expectedItems.addElement( expected[ i ] ); for (int i = 0; i < expected.length; i++) { if (!foundItems.contains( expected[ i ] )) { fail( comment + ": expected " + asText( expected ) + " but missing " + expected[ i ] ); } else { foundItems.removeElement( expected[ i ] ); } } if (!foundItems.isEmpty()) fail( comment + ": expected " + asText( expected ) + " but found superfluous" + foundItems.firstElement() ); }
/** * define a Web Page with the given page name and boy adding the html and body tags with pageName as the title of the page * @param pageName * @param body */ protected void defineWebPage( String pageName, String body ) { defineWebPage(null,pageName,body); }
protected void assertMatchingSet( String comment, Object[] expected, Enumeration found ) { Vector foundItems = new Vector(); while (found.hasMoreElements()) foundItems.addElement( found.nextElement() ); assertMatchingSet( comment, expected, foundItems ); }
private void assertMatchingSet( String comment, Object[] expected, Vector foundItems ) { Vector expectedItems = new Vector(); for (int i = 0; i < expected.length; i++) expectedItems.addElement( expected[ i ] ); for (int i = 0; i < expected.length; i++) { if (!foundItems.contains( expected[ i ] )) { fail( comment + ": expected " + asText( expected ) + " but missing " + expected[ i ] ); } else { foundItems.removeElement( expected[ i ] ); } } if (!foundItems.isEmpty()) fail( comment + ": expected " + asText( expected ) + " but found superfluous" + foundItems.firstElement() ); }
protected void assertImplement( String comment, Object[] objects, Class expectedClass ) { if (objects.length == 0) fail( "No " + comment + " found." ); for (int i = 0; i < objects.length; i++) { assertImplements( comment, objects[i], expectedClass ); } }
protected void assertImplements( String comment, Object object, Class expectedClass ) { if (object == null) { fail( comment + " should be of class " + expectedClass.getName() + " but is null" ); } else if (!expectedClass.isInstance( object )) { fail( comment + " should be of class " + expectedClass.getName() + " but is " + object.getClass().getName() ); } }
protected void assertEqualQueries( String query1, String query2 ) { assertEquals( new QuerySpec( query1 ), new QuerySpec( query2 ) ); }
private void assertMatchingSet( String comment, Object[] expected, Vector foundItems ) { Vector expectedItems = new Vector(); for (int i = 0; i < expected.length; i++) expectedItems.addElement( expected[ i ] ); for (int i = 0; i < expected.length; i++) { if (!foundItems.contains( expected[ i ] )) { fail( comment + ": expected " + asText( expected ) + " but missing " + expected[ i ] ); } else { foundItems.removeElement( expected[ i ] ); } } if (!foundItems.isEmpty()) fail( comment + ": expected " + asText( expected ) + " but found superfluous" + foundItems.firstElement() ); }
/** * define a Web Page with the given page name and boy adding the html and body tags with pageName as the title of the page * @param pageName * @param body */ protected void defineWebPage( String pageName, String body ) { defineWebPage(null,pageName,body); }
protected void assertMatchingSet( String comment, Object[] expected, Enumeration found ) { Vector foundItems = new Vector(); while (found.hasMoreElements()) foundItems.addElement( found.nextElement() ); assertMatchingSet( comment, expected, foundItems ); }
public static void assertMatchingSet( String comment, Object[] expected, Object[] found ) { Vector foundItems = new Vector(); for (int i = 0; i < found.length; i++) foundItems.addElement( found[ i ] ); Vector expectedItems = new Vector(); for (int i = 0; i < expected.length; i++) expectedItems.addElement( expected[ i ] ); for (int i = 0; i < expected.length; i++) { if (!foundItems.contains( expected[ i ] )) { fail( comment + ": expected " + asText( expected ) + " but found " + asText( found ) ); } else { foundItems.removeElement( expected[ i ] ); } } for (int i = 0; i < found.length; i++) { if (!expectedItems.contains( found[ i ] )) { fail( comment + ": expected " + asText( expected ) + " but found " + asText( found ) ); } else { expectedItems.removeElement( found[ i ] ); } } if (!foundItems.isEmpty()) fail( comment + ": expected " + asText( expected ) + " but found " + asText( found ) ); }
protected void assertImplements( String comment, Object object, Class expectedClass ) { if (object == null) { fail( comment + " should be of class " + expectedClass.getName() + " but is null" ); } else if (!expectedClass.isInstance( object )) { fail( comment + " should be of class " + expectedClass.getName() + " but is " + object.getClass().getName() ); } }
protected void assertEqualQueries( String query1, String query2 ) { assertEquals( new QuerySpec( query1 ), new QuerySpec( query2 ) ); }