Implement Status Message Menu Action Tests

This commit is contained in:
Marcus Rockwell 2024-09-04 18:04:09 -04:00
parent 2579eaf87b
commit ac9ff8419e
2 changed files with 36 additions and 0 deletions

View File

@ -83,6 +83,7 @@ public class StubbedSimControlApplication extends SimControlApplication {
@Override @Override
public void clearStatusMsgs() { public void clearStatusMsgs() {
ActionRecord.push(ActionID.CLEAR_STATUS); ActionRecord.push(ActionID.CLEAR_STATUS);
super.clearStatusMsgs();
} }
@Override @Override

View File

@ -289,6 +289,41 @@ public class StubbedSimControlTests extends AssertJSwingJUnitTestCase {
assertThat(actualFont).isEqualTo(expFont); assertThat(actualFont).isEqualTo(expFont);
} }
@Test
public void testSaveStatusMessage() {
// ARRANGE
ActionID action;
JMenuItemFixture saveMsg = getJMenuItemByName(mainFrame, "saveStatusMsgsMenuItem");
assumeThat(saveMsg).isNotNull();
// ACT
saveMsg.click();
action = StubbedSimControlApplication.ActionRecord.peek();
// ASSERT
assertThat(action).isEqualTo(ActionID.SAVE_STATUS);
}
@Test
public void testClearStatusMessage() {
// ARRANGE
ActionID action;
JMenuItemFixture clearMsg = getJMenuItemByName(mainFrame, "clearStatusMsgsMenuItem");
editorFixture.enterText("MOOSE MOOSE MOOSE");
assumeThat(clearMsg).isNotNull();
// ACT
clearMsg.click();
action = StubbedSimControlApplication.ActionRecord.peek();
// ASSERT
assertThat(action).isEqualTo(ActionID.CLEAR_STATUS);
assertThat(editorFixture.text()).isEqualTo("");
}
//-------------------- //--------------------
// Helper Methods // Helper Methods
//-------------------- //--------------------