}
// Test that the assertion returns true for a service with no name.
try
{
ServiceImpl service = new ServiceImpl();
if(!val.testAssertionService1060(new Service[]{service}, reporter))
{
fail("The testAssertionService1060 method returned false for a service with no defined name.");
}
}
catch(WSDLException e)
{
fail("There was a problem running the test assertion method " + e);
}
// Test that the assertion returns true for a service that is the only service defined.
try
{
DescriptionElement descEl = factory.newDescription();
descEl.setTargetNamespace(namespace1);
ServiceImpl service = (ServiceImpl)descEl.addServiceElement();
service.setName(name1);
if(!val.testAssertionService1060(new Service[]{service}, reporter))
{
fail("The testAssertionService1060 method returned false for a service that is the only service defined.");
}
}
catch(WSDLException e)
{
fail("There was a problem running the test assertion method " + e);
}
// Test that the assertion returns true for a list of services that contains no duplicate names.
try
{
DescriptionElement descEl = factory.newDescription();
descEl.setTargetNamespace(namespace1);
ServiceImpl service = (ServiceImpl)descEl.addServiceElement();
service.setName(name1);
ServiceImpl service2 = (ServiceImpl)descEl.addServiceElement();
service2.setName(name2);
ServiceImpl service3 = (ServiceImpl)descEl.addServiceElement();
service3.setName(name3);
Service[] services = new Service[]{service, service2, service3};
if(!val.testAssertionService1060(services, reporter))
{
fail("The testAssertionService1060 method returned false for a list of services that contains no duplicate names.");
}
}
catch(WSDLException e)
{
fail("There was a problem running the test assertion method " + e);
}
// Test that the assertion returns false for two services that are defined with the same QName object.
try
{
DescriptionElement descEl = factory.newDescription();
descEl.setTargetNamespace(namespace1);
ServiceImpl service = (ServiceImpl)descEl.addServiceElement();
service.setName(name1);
ServiceImpl service2 = (ServiceImpl)descEl.addServiceElement();
service2.setName(name2);
ServiceImpl service3 = (ServiceImpl)descEl.addServiceElement();
service3.setName(name1);
Service[] services = new Service[]{service, service2, service3};
if(val.testAssertionService1060(services, reporter))
{
fail("The testAssertionService1060 method returned true for a list of services that contains two services defined with the same QName object.");
}
}
catch(WSDLException e)
{
fail("There was a problem running the test assertion method " + e);
}
// Test that the assertion returns false for two services that are defined with the same name and
// different QName objects.
try
{
DescriptionElement descEl = factory.newDescription();
descEl.setTargetNamespace(namespace1);
ServiceImpl service = (ServiceImpl)descEl.addServiceElement();
service.setName(name1);
ServiceImpl service2 = (ServiceImpl)descEl.addServiceElement();
service2.setName(name2);
ServiceImpl service3 = (ServiceImpl)descEl.addServiceElement();
service3.setName(new NCName("name1"));
Service[] services = new Service[]{service, service2, service3};
if(val.testAssertionService1060(services, reporter))
{