assertIsOfType

Asserts that the matched node is an R, and returns this interaction typed as R so the assertions and properties after it are written against R:

onNodeWithText("Save").assertIsOfType<JButton>().assertProperty(true) { isDefaultButton }

The failure names the query, the node's actual class and the expected type, e.g. Node 'hasText("Save")' is a JLabel, expected a JButton.

Throws

if the query has no single target, or if the target is not an R.


Asserts that the matched window is an R, and returns this interaction typed as R so the assertions and properties after it are written against R:

onWindowWithTitle("Settings").assertIsOfType<JFrame>().assertProperty(false) { isUndecorated }

The failure names the query, the window's actual class and the expected type, e.g. Window 'hasTitle("Settings")' is a JDialog, expected a JFrame.

Throws

if the query has no single target, or if the target is not an R.