[Httpunit-commit] CVS: httpunit/src/com/meterware/pseudoserver HttpUserAgentTest.java,1.6,1.7
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-02-11 04:32:03
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver
In directory sc8-pr-cvs1:/tmp/cvs-serv29478/src/com/meterware/pseudoserver
Modified Files:
HttpUserAgentTest.java
Log Message:
Support parameter overrides in request dispatcher
Index: HttpUserAgentTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/pseudoserver/HttpUserAgentTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- HttpUserAgentTest.java 26 Dec 2002 04:59:35 -0000 1.6
+++ HttpUserAgentTest.java 11 Feb 2003 04:32:00 -0000 1.7
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
- * Copyright (c) 2002, Russell Gold
+ * Copyright (c) 2002-2003, Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -136,12 +136,36 @@
}
- protected void assertMatchingSet( String comment, Object[] expected, Object[] found ) {
- Vector expectedItems = new Vector();
+ 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 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 ] )) {
|