org.nakedobjects.testing
Class View

java.lang.Object
  extended byorg.nakedobjects.testing.Documentor
      extended byorg.nakedobjects.testing.AbstractView
          extended byorg.nakedobjects.testing.View

public class View
extends AbstractView


Field Summary
 
Fields inherited from class org.nakedobjects.testing.AbstractView
forObject
 
Constructor Summary
View(NakedObject object)
           
View(NakedObject object, java.util.Hashtable viewCache)
           
 
Method Summary
 void assertCantDrop(DragView draggedView)
          Check that dragged object cannot be dropped on this object.
 void assertCantRightClick(java.lang.String name)
          Check that the specified object menu item is currently disabled.
 void assertFieldContains(java.lang.String fieldName, java.lang.String expectedValue)
          Check that the specified field contains the expected value.
 void assertFieldContains(java.lang.String message, java.lang.String fieldName, java.lang.String expectedValue)
          Check that the specified field contains the expected value.
 void assertFieldContains(java.lang.String message, java.lang.String fieldName, View expectedView)
          Check that the specified field contains the expected object (as represented by the specifed view.
 void assertFieldContains(java.lang.String fieldName, View expectedView)
          Check that the specified field contains the expected object (as represented by the specifed view.
 void assertFieldReadOnly(java.lang.String fieldName)
          Check that a field exists with the specified name, and it is read-only.
 void assertTitleEquals(java.lang.String expectedTitle)
          Check that the title of this object is the same as the expected title.
 void assertTitleEquals(java.lang.String message, java.lang.String expectedTitle)
          Check that the title of this object is the same as the expected title.
 void checkAssociation(java.lang.String fieldName, AbstractView expected)
          Deprecated.  
 void checkCantDrop(DragView draggedView)
          Check that the dragged object (represented by the specified view) cannot be dropped onto this object.
 void checkCantRightClick(java.lang.String name)
          Check that the specified object menu item is currently disabled.
 void checkField(java.lang.String fieldName, AbstractView check)
          Check that the specified field has an association to same object as another view represents.
 void checkField(java.lang.String fieldName, NakedValue expectedValue)
          Check that the specified field has the same value as the specified NakedValue.
 void checkField(java.lang.String fieldName, java.lang.String expectedTitle)
          Check that the specified field has the expected value, or the associated object has the expected title.
 void checkTitle(java.lang.String expected)
          Check that this object has the specified expected title.
 DragView drag()
          Initiates a drag action, where this object is to be dragged and later dropped on a field or another object.
 DragView drag(java.lang.String fieldName)
          Initiates a drag action of the (only) object contained within the specified field.
 DragView drag(java.lang.String fieldName, java.lang.String title)
          Initiates a drag action of the object, with the given title, contained within the specified multi-object field, i.e. a collection.
 View drop(DragView draggedView)
          Drop the specified view (object) onto this object and invoke the corresponding action method.
 void drop(java.lang.String fieldName, DragView draggedView)
          Drop the specified view (object) into the specified field.
 void fieldEntry(java.lang.String name, java.lang.String value)
          Enters text into an editable field.
 AbstractView getField(java.lang.String fieldName)
           
 View getField(java.lang.String fieldName, java.lang.String title)
          Get the view for the object held within the named collection view, that has the specified title.
 java.lang.String getFieldTitle(java.lang.String field)
          returns the title of the object as a String
 java.lang.String getTitle()
          returns the title of the object as a String
 java.lang.String objectString(View view)
           
 void removeReference(java.lang.String fieldName)
          Removes an existing object reference from the specified field.
 void removeReference(java.lang.String fieldName, java.lang.String title)
          Removes the existing object reference, which has the specified title, from the specified multi-object field.
 View rightClick(java.lang.String name)
          Invokes this object's zero-parameter action method of the the given name.
 View select(java.lang.String title)
          Returns the view, from within this collection, that has the specified title.
 void testField(java.lang.String fieldName, java.lang.String expectedValue)
          Test the named field by calling fieldEntry with the specifed value and then check the value stored is the same.
 void testField(java.lang.String fieldName, java.lang.String setValue, java.lang.String expectedValue)
          Test the named field by calling fieldEntry with the set value and then check the value stored against the expected value.
 void testField(java.lang.String fieldName, View expected)
          Test the named field by calling fieldEntry with the set value and then check the value stored against the expected value.
 
Methods inherited from class org.nakedobjects.testing.AbstractView
getForObject, toString
 
Methods inherited from class org.nakedobjects.testing.Documentor
close, doc, docln, flush, initDocumentation, initSection, isGenerating, objectString, simpleObjectString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

View

public View(NakedObject object)

View

public View(NakedObject object,
            java.util.Hashtable viewCache)
Method Detail

getField

public AbstractView getField(java.lang.String fieldName)

getField

public View getField(java.lang.String fieldName,
                     java.lang.String title)
Get the view for the object held within the named collection view, that has the specified title.


getFieldTitle

public java.lang.String getFieldTitle(java.lang.String field)
returns the title of the object as a String


getTitle

public java.lang.String getTitle()
returns the title of the object as a String

Specified by:
getTitle in class AbstractView

assertCantDrop

public void assertCantDrop(DragView draggedView)
Check that dragged object cannot be dropped on this object. If it can be dropped the test fails.

Group:
assert

assertCantRightClick

public void assertCantRightClick(java.lang.String name)
Check that the specified object menu item is currently disabled. If it is enabled the test fails.

Group:
assert

assertFieldContains

public void assertFieldContains(java.lang.String message,
                                java.lang.String fieldName,
                                View expectedView)
Check that the specified field contains the expected object (as represented by the specifed view. If it does not contain the expected object the test fails.

Parameters:
message - text to add to the failure message, which is displayed after a failure.
Group:
assert

assertFieldContains

public void assertFieldContains(java.lang.String fieldName,
                                View expectedView)
Check that the specified field contains the expected object (as represented by the specifed view. If it does not contain the expected object the test fails.

Group:
assert

assertFieldContains

public void assertFieldContains(java.lang.String fieldName,
                                java.lang.String expectedValue)
Check that the specified field contains the expected value. If it does not contain the expected value the test fails.

Group:
assert

assertFieldContains

public void assertFieldContains(java.lang.String message,
                                java.lang.String fieldName,
                                java.lang.String expectedValue)
Check that the specified field contains the expected value. If it does not contain the expected value the test fails.

Parameters:
message - text to add to the failure message, which is displayed after a failure.
Group:
assert

assertFieldReadOnly

public void assertFieldReadOnly(java.lang.String fieldName)
Check that a field exists with the specified name, and it is read-only. If it does not exist, or is writable, the test fails.

Group:
assert

assertTitleEquals

public void assertTitleEquals(java.lang.String expectedTitle)
Check that the title of this object is the same as the expected title. If it is not the same the test fails.

Group:
assert

assertTitleEquals

public void assertTitleEquals(java.lang.String message,
                              java.lang.String expectedTitle)
Check that the title of this object is the same as the expected title. If it is not the same the test fails.

Parameters:
message - text to add to the failure message, which is displayed after a failure.
Group:
assert

checkAssociation

public void checkAssociation(java.lang.String fieldName,
                             AbstractView expected)
Deprecated.  

Check that this object's specified field contains a reference to a specific object, which is represented by the specifed view. If no such association exist the test will fail. The expected association is detailed in the documentation.


checkCantDrop

public void checkCantDrop(DragView draggedView)
Check that the dragged object (represented by the specified view) cannot be dropped onto this object. If it can be dropped the test fails. A note is added to the documentation to explain that such an action is not allowed.

Group:
check

checkCantRightClick

public void checkCantRightClick(java.lang.String name)
Check that the specified object menu item is currently disabled. If it is enabled the test fails. A note is added to the documentation to explain that the action cannot be invoked in the object's current state.

Group:
check

checkField

public void checkField(java.lang.String fieldName,
                       java.lang.String expectedTitle)
Check that the specified field has the expected value, or the associated object has the expected title. If it differs the test fails. A note is added to the documentation to explain that the specified field now has a specific title.

Group:
check

checkField

public void checkField(java.lang.String fieldName,
                       NakedValue expectedValue)
Check that the specified field has the same value as the specified NakedValue. If it differs the test fails. A note is added to the documentation to explain that the specified field now has a specific value.

Group:
check

checkField

public void checkField(java.lang.String fieldName,
                       AbstractView check)
Check that the specified field has an association to same object as another view represents. If it differs the test fails. A note is added to the documentation to explain that the specified field now has a specific association.

Group:
check

checkTitle

public void checkTitle(java.lang.String expected)
Check that this object has the specified expected title. If title differs from the expected text the test fails. A note is added to the documentation to explain that this now has a specific title.

Group:
check

drag

public DragView drag()
Initiates a drag action, where this object is to be dragged and later dropped on a field or another object.

Group:
action

drag

public DragView drag(java.lang.String fieldName)
Initiates a drag action of the (only) object contained within the specified field. The dragged object will later be dropped on a field or another object.

Group:
action

drag

public DragView drag(java.lang.String fieldName,
                     java.lang.String title)
Initiates a drag action of the object, with the given title, contained within the specified multi-object field, i.e. a collection. The dragged object will later be dropped on a field or another object.

Group:
action

drop

public void drop(java.lang.String fieldName,
                 DragView draggedView)
Drop the specified view (object) into the specified field.

If the field already contains an object then, as an object cannot be dropped on a non-empty field, the test will fail.

Group:
action

drop

public View drop(DragView draggedView)
Drop the specified view (object) onto this object and invoke the corresponding action method. A new view representing the returned object, if any is returned, from the invoked action method is returned by this method.

Group:
action

fieldEntry

public void fieldEntry(java.lang.String name,
                       java.lang.String value)
Enters text into an editable field. Data entered here is parsed in exactly the same way as in GUI, and should therefore be given in the correct form and formatted correctly. For fields that normally use some other interaction, e.g. a checkbox, then the correct textual form must be used (for the checkbox this is 'TRUE' and 'FALSE').

Group:
action

objectString

public java.lang.String objectString(View view)

removeReference

public void removeReference(java.lang.String fieldName)
Removes an existing object reference from the specified field. Mirrors the 'Remove Reference' menu option that each object field offers by default.

Group:
action

removeReference

public void removeReference(java.lang.String fieldName,
                            java.lang.String title)
Removes the existing object reference, which has the specified title, from the specified multi-object field. Mirrors the 'Remove Reference' menu option that each collection field offers by default.

Group:
action

rightClick

public View rightClick(java.lang.String name)
Invokes this object's zero-parameter action method of the the given name. This mimicks the right-clicking on an object and subsequent selection of a menu item.

Group:
action

select

public final View select(java.lang.String title)
Returns the view, from within this collection, that has the specified title.


testField

public void testField(java.lang.String fieldName,
                      View expected)
Test the named field by calling fieldEntry with the set value and then check the value stored against the expected value.


testField

public void testField(java.lang.String fieldName,
                      java.lang.String expectedValue)
Test the named field by calling fieldEntry with the specifed value and then check the value stored is the same.


testField

public void testField(java.lang.String fieldName,
                      java.lang.String setValue,
                      java.lang.String expectedValue)
Test the named field by calling fieldEntry with the set value and then check the value stored against the expected value.