KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm working on a new project, where I want to display some data on the screen. I set myself to using TDD which is new for me, but I love the idea and get along quite OK so far. I set up a JFrame, add a Textarea and put text there, but how can I properly test this? Or is this wrong thinking in the TDD context on my side? I want to be sure (in the TDD way), that the data gets displayed correctly! The creation of the text that gets displayed is properly covered with tests, but the displaying is not. Here is a completely simplified example: public class MyTextDisplay { public static void main(String[] args) { JFrame my_frame = new JFrame("DisplaySomeText"); my_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextArea textArea = new JTextArea(5, 20); textArea.setEditable(false); my_frame.add(textArea); my_frame.setVisible(true); //this would be in a separate method textArea.append("Hello World"); } }
Tags (comma-separated)
Save Edits
Cancel