org.mockcentral.editor.nodes.mockobject_group
Class MockObjectDataValidator

java.lang.Object
  extended by org.mockcentral.editor.nodes.mockobject_group.MockObjectDataValidator

public class MockObjectDataValidator
extends java.lang.Object

A class used to validate prospective name and interface data for a Mock Object.

Author:
David Hutchinson

Constructor Summary
MockObjectDataValidator(IMockObjectDataManager mockObjectDataManager)
          Creates a new instance.
 
Method Summary
 java.lang.String isValidInterface(java.lang.String interfaceName)
          Vaidates the supplied interface, testing for a non-empty value and that the value is the name of a valid interface.
 java.lang.String isValidJndiName(java.lang.String jndiName, java.lang.Object excluded)
          Returns whether the supplied JNDI name is valid.
 java.lang.String isValidMockObjectName(java.lang.String mockObjectName, java.lang.Object excluded)
          Verifies that the supplied Mock Object name is not empty and does not duplicate that of another Mock Object defined in the Fixture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockObjectDataValidator

public MockObjectDataValidator(IMockObjectDataManager mockObjectDataManager)
Creates a new instance.

Parameters:
mockObjectDataManager - the IMockObjectDataManager used by this validator to check for already used Mock Object and JNDI names.
Method Detail

isValidMockObjectName

public java.lang.String isValidMockObjectName(java.lang.String mockObjectName,
                                              java.lang.Object excluded)
Verifies that the supplied Mock Object name is not empty and does not duplicate that of another Mock Object defined in the Fixture.

Parameters:
mockObjectName - the proposed name for the Mock Object.
Returns:
a String containing an error message as appropriate, or null if the proposed Mock Object name is valid.

isValidInterface

public java.lang.String isValidInterface(java.lang.String interfaceName)
Vaidates the supplied interface, testing for a non-empty value and that the value is the name of a valid interface.

Parameters:
interfaceName - the name of the proposed interface.
Returns:
a String containing an error message as appropriate, or null if the proposed interface is valid.

isValidJndiName

public java.lang.String isValidJndiName(java.lang.String jndiName,
                                        java.lang.Object excluded)
Returns whether the supplied JNDI name is valid.

Parameters:
jndiName - the JNDI name.
excluded - an Object to exclude from duplication testing.
Returns:
whether the supplied JNDI name is valid.