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 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 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 ); } }
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() ); }
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 ); } }
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 ) ); }
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 assertEquals( String comment, byte[] expected, byte[] actual ) { if (!equals( expected, actual )) { fail( comment + " expected:\n" + toString( expected ) + ", but was:\n" + toString( actual ) ); } }
protected void assertEquals( String comment, byte[] expected, byte[] actual ) { if (!equals( expected, actual )) { fail( comment + " expected:\n" + toString( expected ) + ", but was:\n" + toString( actual ) ); } }
protected void assertEquals( String comment, Object[] expected, Object[] found ) { if (!equals( expected, found )) { fail( comment + " expected: " + asText( expected ) + " but found " + asText( found ) ); } }
protected void assertEquals( String comment, Object[] expected, Object[] found ) { if (!equals( expected, found )) { fail( comment + " expected: " + asText( expected ) + " but found " + asText( found ) ); } }