assertj / assertj/assertj-swing

ClassCastException on JOptionPaneFixture.title()

Open
#220 1 comment 0 reactions 1 assignee Claimed by @croesch View on GitHub
bug invalid
Dominant language
Java
Stars
121
Forks
52
PR merge metrics
No merged PRs in 30d

Description

Hi!
I get `ClassCastException` when calling `JOptionPaneFixture.title()`.

My code:
`final JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().withTimeout(3000).using(robot);`
`final String title = optionPane.title();`

Error i get:
`java.lang.ClassCastException: javax.swing.JInternalFrame cannot be cast to java.awt.Dialog`

Im using java 8 `javax.swing.JOptionPane` in my gui.
Ofc it works if i cast it to `JInternalFrame`.
`final String title = ((JInternalFrame) optionPane.target().getRootPane().getParent()).getTitle();`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.