assertEquals( paramOne.getWindowId(), paramTwo.getWindowId() );
}
public void testAddParameters()
{
final PortalURLParameter paramOne = PortalURLParameterFactory.createPortalURLParameter();
final PortalURLParameter paramTwo = PortalURLParameterFactory.createPortalURLParameter();
underTest.addParameter( paramOne );
underTest.addParameter( paramTwo );
final Collection params = underTest.getParameters();
assertNotNull( params );
assertEquals( 2, params.size() );
assertTrue( params.contains( paramOne ) );
assertTrue( params.contains( paramTwo ) );
int matchCount = 0;
Iterator itr = params.iterator();
while ( itr.hasNext() )
{
final PortalURLParameter param = (PortalURLParameter) itr.next();
final String name = param.getName();
final String value = param.getValues()[0];
final String windowId = param.getWindowId();
assertNotNull( name );
assertNotNull( value );
assertNotNull( windowId );
PortalURLParameter expected = null;
if ( windowId.equals( paramOne.getWindowId() ) )
{
expected = paramOne;
matchCount++;
itr.remove();
}
if ( windowId.equals( paramTwo.getWindowId() ) )
{
expected = paramTwo;
matchCount++;
itr.remove();
}
assertNotNull( expected );
assertEquals( expected.getName(), name );
assertEquals( expected.getValues()[0], value );
}
assertEquals( 2, matchCount );
}