Last active
March 23, 2020 11:23
-
-
Save teguhteja/ad0f9e7152efae5671b09446e02c4753 to your computer and use it in GitHub Desktop.
Test of SimpleCopyApplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ttm.testswingmaven; | |
import org.assertj.swing.aut.getting_started.SimpleCopyApplication; | |
import org.assertj.swing.edt.FailOnThreadViolationRepaintManager; | |
import org.assertj.swing.edt.GuiActionRunner; | |
import org.assertj.swing.fixture.FrameFixture; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.BeforeClass; | |
import org.junit.Test; | |
public class SimpleCopyApplicationTest { | |
private FrameFixture window; | |
@BeforeClass | |
public static void setUpOnce() { | |
FailOnThreadViolationRepaintManager.install(); | |
} | |
@Before | |
public void setUp() { | |
SimpleCopyApplication frame = GuiActionRunner.execute(() -> new SimpleCopyApplication()); | |
window = new FrameFixture(frame); | |
window.show(); // shows the frame to test | |
} | |
@Test | |
public void shouldCopyTextInLabelWhenClickingButton() { | |
window.textBox("textToCopy").enterText("Some random text"); | |
window.button("copyButton").click(); | |
window.label("copiedText").requireText("Some random text"); | |
} | |
@After | |
public void tearDown() { | |
window.cleanUp(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment