// Test that the assertion returns true for an interace that extends no other interfaces.
try
{
DescriptionElement descEl = factory.newDescription();
Description descComp = descEl.toComponent();
InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
if(!val.testAssertionInterface1009(interfac, reporter))
{
fail("The testAssertionInterface1009 method returned false for an interface that extends no other interfaces.");
}
}
catch(WSDLException e)
{
fail("There was a problem running the test assertion method " + e);
}
// Test that the assertion returns true if the interface is not in the direct or indirect list.
try
{
DescriptionElement descEl = factory.newDescription();
Description descComp = descEl.toComponent();
descEl.setTargetNamespace(namespace1);
// Create an interface element, name it and add to the description element
InterfaceElement interfac = descEl.addInterfaceElement();
interfac.setName(name1);
// Create another interface element, name it and add to the description element
InterfaceElement interfac2 = descEl.addInterfaceElement();
interfac2.setName(name2);
interfac.addExtendedInterfaceName(interfac2.getName());
InterfaceElement interfac3 = descEl.addInterfaceElement();
interfac3.setName(name3);
interfac.addExtendedInterfaceName(interfac3.getName());
InterfaceElement interfac4 = descEl.addInterfaceElement();
interfac4.setName(name4);
interfac2.addExtendedInterfaceName(interfac4.getName());
descComp.getInterfaces(); //init Interface's ref to its Description, needed for interface extension
if(!val.testAssertionInterface1009((Interface)interfac, reporter))
{
fail("The testAssertionInterface1009 method returned false for an interface that is not in the list of exteneded interfaces.");
}
}
catch(WSDLException e)
{
fail("There was a problem running the test assertion method " + e);
}
// Test that the assertion returns false if the interface is in the direct list.
try
{
DescriptionElement descEl = factory.newDescription();
Description descComp = descEl.toComponent();
descEl.setTargetNamespace(namespace1);
InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
interfac.setName(name1);
InterfaceImpl interfac2 = (InterfaceImpl)descEl.addInterfaceElement();
interfac2.setName(name2);
InterfaceImpl interfac3 = (InterfaceImpl)descEl.addInterfaceElement();
interfac3.setName(name3);
interfac.addExtendedInterfaceName(interfac.getName());
interfac.addExtendedInterfaceName(interfac2.getName());
interfac.addExtendedInterfaceName(interfac3.getName());
descComp.getInterfaces(); //init Interface's ref to its Description, needed for interface extension
if(val.testAssertionInterface1009(interfac, reporter))
{
fail("The testAssertionInterface1009 method returned true for an interface that is in the direct extended interface list.");
}
}
catch(Exception e)
{
fail("There was a problem running the test assertion method " + e);
}
// Test that the assertion returns false if the interface is in the indirect list.
try
{
DescriptionElement descEl = factory.newDescription();
Description descComp = descEl.toComponent();
InterfaceImpl interfac = (InterfaceImpl)descEl.addInterfaceElement();
interfac.setName(name1);
InterfaceImpl interfac2 = (InterfaceImpl)descEl.addInterfaceElement();
interfac2.setName(name2);
InterfaceImpl interfac3 = (InterfaceImpl)descEl.addInterfaceElement();
interfac3.setName(name3);
interfac.addExtendedInterfaceName(interfac2.getName());
interfac.addExtendedInterfaceName(interfac3.getName());
interfac2.addExtendedInterfaceName(interfac.getName());
descComp.getInterface(interfac.getName()); //to ensure the Interface can reference its containing Description
if(val.testAssertionInterface1009(interfac, reporter))
{
fail("The testAssertionInterface1009 method returned true for an interface that is in the indirect extended interface list.");
}