FileDocCategorySizeDatePackage
AbstractPolicyApiClassTestBase.javaAPI DocExample4094Tue May 29 16:57:36 BST 2007com.sun.xml.ws.policy

AbstractPolicyApiClassTestBase

public abstract class AbstractPolicyApiClassTestBase extends TestCase
author
Marek Potociar (marek.potociar@sun.com)

Fields Summary
Constructors Summary
public AbstractPolicyApiClassTestBase(String name)
Creates a new instance of AbstractPolicyApiClassTestBase

        super(name);
    
Methods Summary
protected abstract java.lang.Object[][]getEqualInstanceRows()

public final voidtestEqualsOnManyEqualPolicies()

        Object[][] testbed = getEqualInstanceRows();
        String className = testbed[0][0].getClass().getName();
        int index = 0;
        for (Object[] instanceRow : testbed) {
            for (int i = 0; i < instanceRow.length; i++) {                
                assertEquals("'" + index + "' array of equal '" + className + "' instances comparison failed on comparing instance '" + i + "' with itself", instanceRow[i], instanceRow[i]);
                for (int j = i + 1; j < instanceRow.length; j++) {
//                    System.out.println( instanceRow[i].toString() + "\n");
//                    System.out.println( instanceRow[j].toString() + "\n");
                    assertEquals("'" + index + "' row of equal '" + className + "' instances comparison failed on comparing instance '" + i + "' to instance '" + j + "'", instanceRow[i], instanceRow[j]);
                    assertEquals("'" + index + "' row of equal '" + className + "' instances comparison failed on comparing instance '" + j + "' to instance '" + i + "'", instanceRow[j], instanceRow[i]);
                }
            }
            index++;
        }
    
public final voidtestEqualsWithNull()

        for (Object[] instanceRow : getEqualInstanceRows()) {
            for (Object instance : instanceRow) {
                assertFalse("Instance of class '" + instance.getClass().getName() + "' must not return true when comparing for equality with 'null' value.", instance.equals(null));
            }
        }