├── assertj-swing-junit └── src │ ├── main │ ├── resources │ │ └── assertjjunittasks │ └── java │ │ └── org │ │ └── assertj │ │ └── swing │ │ └── junit │ │ ├── ant │ │ ├── CommonConstants.java │ │ ├── HostNameReader.java │ │ ├── StandardOutputStreams.java │ │ ├── StackTraceFilter.java │ │ └── TimestampFormatter.java │ │ ├── testcase │ │ └── package.html │ │ └── xml │ │ └── package.html │ └── test │ └── java │ └── org │ └── assertj │ └── swing │ └── junit │ ├── ant │ ├── SomeTestFake.java │ ├── XmlOutputWriter_TestCase.java │ └── XmlJUnitResultFormatter_startTest_Test.java │ └── xml │ ├── XmlNode_target_Test.java │ ├── XmlNode_name_Test.java │ ├── XmlNode_text_Test.java │ ├── XmlNode_toString_Test.java │ ├── XmlNode_size_Test.java │ ├── XmlAttribute_equals_hashCode_Test.java │ ├── XmlAttributes_equals_hashCode_Test.java │ └── XmlNode_parentNode_Test.java ├── assertj-swing └── src │ ├── test │ ├── resources │ │ ├── keyboard-mapping.txt │ │ └── red.png │ └── java │ │ └── org │ │ └── assertj │ │ ├── swing │ │ ├── test │ │ │ ├── ErrorMessages.java │ │ │ ├── data │ │ │ │ ├── ZeroAndNegativeProvider.java │ │ │ │ └── BooleanProvider.java │ │ │ ├── core │ │ │ │ └── EDTSafeTestCase.java │ │ │ └── swing │ │ │ │ └── LookAndFeel.java │ │ ├── driver │ │ │ ├── Jedi.java │ │ │ ├── BasicJListCellReader_constructor_Test.java │ │ │ ├── BasicJComboBoxCellReader_constructor_Test.java │ │ │ ├── JProgressBarDriver_textOf_Test.java │ │ │ ├── JTableCancelCellEditingTask_cancelEditing_withEditor_Test.java │ │ │ ├── JScrollBarDriver_scrollToMinimum_Test.java │ │ │ ├── JListDriver_cellReader_Test.java │ │ │ ├── JTableDriver_cellWriter_Test.java │ │ │ ├── AbstractButtonDriver_textOf_Test.java │ │ │ ├── JComboBoxDriver_cellReader_Test.java │ │ │ ├── JMenuItemMatcher_toString_Test.java │ │ │ ├── JTableDriver_tableHeaderOf_Test.java │ │ │ ├── JTableDriver_validate_Test.java │ │ │ ├── BasicJTableCellWriter_startCellEditing_Test.java │ │ │ ├── JFileChooserDriver_selectFile_withInvalidInput_Test.java │ │ │ ├── JScrollBarDriver_scrollToMaximum_Test.java │ │ │ ├── WaitForComponentToShowCondition_untilIsShowing_Test.java │ │ │ ├── WindowDriver_showWithSize_Test.java │ │ │ ├── JSpinnerDriver_editor_Test.java │ │ │ ├── JTableCheckBoxEditorCellWriter_startCellEditing_Test.java │ │ │ ├── JTreeDriver_validateRow_Test.java │ │ │ ├── WindowDriver_close_Test.java │ │ │ ├── JTabbedPaneDriver_tabTitles_Test.java │ │ │ ├── JOptionPaneMessageTypes_messageTypeAsText_withInvalidType_Test.java │ │ │ ├── JTableCellWriter_startCellEditing_TestCase.java │ │ │ ├── JTableClearSelectionTask.java │ │ │ ├── JTableDriver_rowCountOf_Test.java │ │ │ ├── FEST137_SelectAllOnDoubleClickInJTextComponent_Test.java │ │ │ ├── JComboBoxDriver_value_Test.java │ │ │ ├── JAppletDriver_appletResize_Test.java │ │ │ ├── JInternalFrameDriver_moveToBack_Test.java │ │ │ └── JInternalFrameDriver_moveToFront_Test.java │ │ ├── fixture │ │ │ ├── ColorHexCodes.java │ │ │ ├── FontFixture_constructor_Test.java │ │ │ └── ColorFixture_constructor_Test.java │ │ ├── monitor │ │ │ ├── TestContexts.java │ │ │ ├── Windows_markAsClosed_Test.java │ │ │ ├── Windows_markAsHidden_Test.java │ │ │ ├── Context_removeContextFor_Test.java │ │ │ ├── Context_addContextFor_Test.java │ │ │ └── ComponentWithCustomEventQueue.java │ │ ├── core │ │ │ ├── TestRobotFixture.java │ │ │ ├── TypeMatcher_constructorWithType_Test.java │ │ │ ├── ReflectionBasedFocusOwnerFinder_Test.java │ │ │ ├── HierarchyBasedFocusOwnerFinder_UI_Test.java │ │ │ ├── BasicRobot_ClickTestCase.java │ │ │ ├── NameMatcher_constructorWithNameAndType_Test.java │ │ │ ├── LabelMatcher_constructorWithLabelAndType_Test.java │ │ │ ├── MouseButton_lookup_withInvalidValue_Test.java │ │ │ ├── SingleComponentHierarchy_root_Test.java │ │ │ ├── TestComponentHierarchies.java │ │ │ ├── SingleComponentHierarchy_roots_Test.java │ │ │ ├── MouseButton_mask_Test.java │ │ │ ├── RobotEventGenerator_rotateWheel_Test.java │ │ │ ├── RobotEventGenerator_mouseMove_Test.java │ │ │ ├── AbstractComponentMatcher_constructor_Test.java │ │ │ ├── NameMatcher_constructorWithName_Test.java │ │ │ ├── MouseButton_lookup_Test.java │ │ │ ├── RobotEventGenerator_pressMouse_Test.java │ │ │ ├── LabelMatcher_constructorWithLabel_Test.java │ │ │ ├── LabelMatcher_toString_Test.java │ │ │ ├── NameMatcher_toString_Test.java │ │ │ ├── RobotEventGenerator_pressKey_Test.java │ │ │ ├── matcher │ │ │ │ └── NamedComponentMatcherTemplate_ANY_toString_Test.java │ │ │ └── ConcreteComponentMatcher.java │ │ ├── util │ │ │ ├── TestRobotFactories.java │ │ │ └── Platform_osFamily_Test.java │ │ ├── data │ │ │ ├── Index_equals_hashCode_Test.java │ │ │ ├── TableCell_equals_hashCode_Test.java │ │ │ ├── TableCellInRowByValue_rowWithValue_Test.java │ │ │ ├── Index_toString_Test.java │ │ │ └── TableCell_toString_Test.java │ │ ├── timing │ │ │ ├── Timeout_timeout_Test.java │ │ │ ├── RuntimeExceptionCondition.java │ │ │ ├── NeverSatisfiedCondition.java │ │ │ └── Timeout_timeout_long_Test.java │ │ ├── applet │ │ │ ├── BasicAppletContext_constructor_Test.java │ │ │ ├── BasicAppletStub_isActive_Test.java │ │ │ ├── AppletViewer_reloadApplet_Test.java │ │ │ ├── BasicAppletStub_getCodeBase_Test.java │ │ │ ├── BasicAppletContext_getImage_Test.java │ │ │ ├── BasicAppletStub_getAppletContext_Test.java │ │ │ ├── BasicAppletStub_getDocumentBase_Test.java │ │ │ ├── BasicAppletContext_getAudioClip_Test.java │ │ │ ├── BasicAppletContext_showStatus_Test.java │ │ │ ├── BasicAppletContext_getAppletByName_Test.java │ │ │ ├── BasicAppletContext_TestCase.java │ │ │ └── BasicAppletStub_appletResize_Test.java │ │ ├── image │ │ │ └── RandomFileNameCreator.java │ │ ├── edt │ │ │ ├── GuiTask_run_Test.java │ │ │ ├── FailOnThreadViolationRepaintManager_uninstall_Test.java │ │ │ └── GuiQuery_run_Test.java │ │ ├── hierarchy │ │ │ └── ExistingHierarchy_TestCase.java │ │ ├── launcher │ │ │ ├── AppletLauncher_appletWithApplet_Test.java │ │ │ └── AppletParameterBuilder_value_Test.java │ │ ├── text │ │ │ ├── JListTextReader_supportedComponent_Test.java │ │ │ └── JLabelTextReader_supportedComponent_Test.java │ │ ├── input │ │ │ └── DragAwareEventQueue_dispatchEvent_Test.java │ │ └── exception │ │ │ └── UnexpectedException_unexpected_withCause_Test.java │ │ └── core │ │ └── api │ │ └── AssertionInternalData.java │ ├── site │ ├── resources │ │ └── images │ │ │ └── fest-swing.png │ ├── xdoc │ │ └── index.xml │ └── site.xml │ └── main │ └── java │ └── org │ └── assertj │ └── swing │ ├── data │ └── package-info.java │ ├── exception │ ├── package-info.java │ └── WaitTimedOutError.java │ ├── testing │ └── package-info.java │ ├── util │ ├── package-info.java │ ├── SystemPropertyReader.java │ ├── SystemPropertyWriter.java │ └── OSFamily.java │ ├── awt │ └── package-info.java │ ├── timing │ └── package-info.java │ ├── image │ ├── package-info.java │ └── ImageFileExtensions.java │ ├── security │ ├── package-info.java │ ├── StackTraces.java │ └── ExitException.java │ ├── applet │ ├── package-info.java │ └── StatusDisplay.java │ ├── annotation │ ├── package-info.java │ ├── RunsInEDT.java │ └── ThreadSafeAction.java │ ├── launcher │ └── package-info.java │ ├── edt │ ├── GuiActionRunnable.java │ └── package-info.java │ ├── query │ └── package-info.java │ ├── text │ └── package-info.java │ ├── core │ ├── matcher │ │ └── package-info.java │ ├── FocusOwnerFinderStrategy.java │ ├── ThreadsSource.java │ ├── package-info.java │ ├── ResettableComponentMatcher.java │ ├── ReflectionBasedFocusOwnerFinder.java │ ├── HierarchyRootsSource.java │ └── FrameDisposer.java │ ├── cell │ └── package-info.java │ ├── lock │ └── package-info.java │ ├── listener │ └── package-info.java │ ├── input │ ├── package-info.java │ └── NativeDndIdentifier.java │ ├── hierarchy │ └── package-info.java │ ├── monitor │ └── package-info.java │ ├── keystroke │ ├── package-info.java │ └── KeyStrokeMappingProvider.java │ ├── internal │ └── annotation │ │ └── InternalApi.java │ └── driver │ ├── package-info.java │ ├── JInternalFrameAction.java │ └── JScrollBarSetValueTask.java ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── .gitignore ├── CONTRIBUTING.md ├── licence-header.txt ├── assertj-swing-jide ├── licence-header.txt └── src │ └── main │ └── java │ └── org │ └── assertj │ └── swing │ └── jide │ ├── action │ └── driver │ │ └── CommandBarDriver.java │ └── grids │ ├── ExtendedItemGroupFixture.java │ └── ExtendedTableFixture.java └── assertj-swing-testng └── src └── main └── java └── org └── assertj └── swing └── testng ├── package.html ├── testcase └── package.html └── ScreenshotOnFailureListener.java /assertj-swing-junit/src/main/resources/assertjjunittasks: -------------------------------------------------------------------------------- 1 | assertjreport=org.assertj.swing.junit.ant.JUnitReportTask -------------------------------------------------------------------------------- /assertj-swing/src/test/resources/keyboard-mapping.txt: -------------------------------------------------------------------------------- 1 | a, A, NO_MASK 2 | A, A, SHIFT_MASK 3 | COMMA, COMMA, NO_MASK 4 | -------------------------------------------------------------------------------- /assertj-swing/src/test/resources/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PortSwigger/assertj-swing/main/assertj-swing/src/test/resources/red.png -------------------------------------------------------------------------------- /assertj-swing/src/site/resources/images/fest-swing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PortSwigger/assertj-swing/main/assertj-swing/src/site/resources/images/fest-swing.png -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Maven build result directory 2 | target/ 3 | # IntelliJ project files 4 | /.idea 5 | *.iml 6 | # Eclipse project files 7 | .settings/ 8 | .classpath 9 | .project 10 | # Other 11 | /clover.license 12 | /actual.txt 13 | /expected.txt 14 | # jEnv configuration 15 | .java-version 16 | .mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /assertj-swing/src/site/xdoc/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Welcome 6 | 7 | 8 | 9 | 10 |

11 | You are being redirected to the wiki page. 12 |

13 | 14 |
-------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | Thank you for your interest in contributing to AssertJ-Swing! 5 | 6 | Issues 7 | ------ 8 | 9 | To make sure we and others understand you, please file tickets in English. No more rules :-) 10 | 11 | Code 12 | ---- 13 | 14 | We appreciate your effort and to make sure that your pull request is easy to review, we ask you to make note of the **[assertj-core guidelines](https://github.com/joel-costigliola/assertj-core/blob/master/CONTRIBUTING.md)**. 15 | -------------------------------------------------------------------------------- /licence-header.txt: -------------------------------------------------------------------------------- 1 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 2 | the License. You may obtain a copy of the License at 3 | 4 | http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 7 | an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 8 | specific language governing permissions and limitations under the License. 9 | 10 | Copyright ${inceptionYear}-${currentYear} the original author or authors. 11 | -------------------------------------------------------------------------------- /assertj-swing-jide/licence-header.txt: -------------------------------------------------------------------------------- 1 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 2 | the License. You may obtain a copy of the License at 3 | 4 | http://www.apache.org/licenses/LICENSE-2.0 5 | 6 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 7 | an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 8 | specific language governing permissions and limitations under the License. 9 | 10 | Copyright ${inceptionYear}-${currentYear} the original author or authors. 11 | -------------------------------------------------------------------------------- /assertj-swing/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | org.easytesting 5 | fest-site-skin 6 | 1.0 7 | 8 | 9 | FEST-Swing 10 | /images/fest-swing.png 11 | index.php 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/data/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Data structures. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.data; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/exception/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Exceptions. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.exception; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/testing/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Base test classes. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.testing; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Miscellaneous utilities. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.util; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/awt/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Utility methods related to AWT. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.awt; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/timing/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Utilities related to timing. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.timing; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/image/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Utility methods related to images. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.image; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/security/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Utilities related to security. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.security; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/applet/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Provides support for testing {@code Applet}s. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.applet; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/annotation/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Annotations and related utility methods. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.annotation; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/launcher/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Java applications and {@code Applet}s launcher. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.launcher; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/edt/GuiActionRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.edt; 14 | 15 | @FunctionalInterface 16 | public interface GuiActionRunnable { 17 | void run() throws Exception; 18 | } 19 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/query/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Common-use implementations of {@link org.assertj.swing.edt.GuiQuery}. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.query; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/edt/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Ensure that {@code Component} access is done in the event dispatch thread (EDT). 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.edt; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/text/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Utilities for reading the text displayed in AWT or Swing {@code Component}s. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.text; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/core/matcher/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Common-use implementations of {@link org.assertj.swing.core.GenericTypeMatcher}. 15 | * 16 | * @author Alex Ruiz 17 | */ 18 | package org.assertj.swing.core.matcher; -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/test/ErrorMessages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.test; 14 | 15 | public class ErrorMessages { 16 | 17 | public static String offsetIsNull() { 18 | return "The given offset should not be null"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/cell/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Support for reading from and writing to cells in {@code JComponent}s (for example: {@code JList}s, {@code JTable}s, 15 | * etc). 16 | * 17 | * @author Alex Ruiz 18 | */ 19 | package org.assertj.swing.cell; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/lock/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Utilities that ensure that GUI tests are executed sequentially, preventing multiple applications from being displayed 15 | * simultaneously. 16 | * 17 | * @author Alex Ruiz 18 | */ 19 | package org.assertj.swing.lock; -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/core/api/AssertionInternalData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.core.api; 14 | 15 | public class AssertionInternalData { 16 | public static , A> A getActual(AbstractAssert assertion) { 17 | return assertion.actual; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/Jedi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | /** 16 | * @author Alex Ruiz 17 | */ 18 | class Jedi { 19 | private final String name; 20 | 21 | public Jedi(String name) { 22 | this.name = name; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return name; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/core/FocusOwnerFinderStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import java.awt.Component; 16 | 17 | import javax.annotation.Nullable; 18 | 19 | /** 20 | * Finds the current focus owner. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | interface FocusOwnerFinderStrategy { 25 | @Nullable 26 | Component focusOwner(); 27 | } -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/image/ImageFileExtensions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.image; 14 | 15 | /** 16 | * Common image file extensions. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | public final class ImageFileExtensions { 21 | /** PNG file extension */ 22 | public static final String PNG = "png"; 23 | 24 | private ImageFileExtensions() { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/security/StackTraces.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.security; 14 | 15 | /** 16 | * @author Alex Ruiz 17 | */ 18 | class StackTraces { 19 | /** 20 | * @return the stack trace for the current thread. 21 | */ 22 | StackTraceElement[] stackTraceInCurrentThread() { 23 | return Thread.currentThread().getStackTrace(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/test/data/ZeroAndNegativeProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.test.data; 14 | 15 | /** 16 | * A provider of zero and a negative number. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | public class ZeroAndNegativeProvider { 21 | public static Object[][] zeroAndNegative() { 22 | return new Object[][] { { 0 }, { -1 } }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/fixture/ColorHexCodes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.fixture; 14 | 15 | /** 16 | * Hexadecimal values that represent colors. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | final class ColorHexCodes { 21 | static final String BLUE_HEX_CODE = "0000FF"; 22 | static final String BLACK_HEX_CODE = "000000"; 23 | 24 | private ColorHexCodes() { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/util/SystemPropertyReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.util; 14 | 15 | import javax.annotation.Nonnull; 16 | import javax.annotation.Nullable; 17 | 18 | /** 19 | * @author Alex Ruiz 20 | */ 21 | class SystemPropertyReader { 22 | @Nullable 23 | String systemProperty(@Nonnull String propertyName) { 24 | return System.getProperty(propertyName); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/test/data/BooleanProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.test.data; 14 | 15 | import javax.annotation.Nonnull; 16 | 17 | /** 18 | * A provider of {@code boolean} values. 19 | * 20 | * @author Yvonne Wang 21 | */ 22 | public class BooleanProvider { 23 | @Nonnull public static Object[][] booleans() { 24 | return new Object[][] { { true }, { false } }; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/main/java/org/assertj/swing/junit/ant/CommonConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.ant; 14 | 15 | /** 16 | * Understands common constants used in this package. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | final class CommonConstants { 21 | 22 | static final String UNKNOWN = "unknown"; 23 | 24 | static final String UTF_8 = "UTF-8"; 25 | 26 | private CommonConstants() { 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/listener/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | *

15 | * Event listeners. 16 | *

17 | * 18 | *

19 | * Most of the classes of in this packages were adapted from Abbot. Many thanks to Timothy Wall for allowing us to use them. 21 | *

22 | * 23 | * @author Alex Ruiz 24 | */ 25 | package org.assertj.swing.listener; -------------------------------------------------------------------------------- /assertj-swing-testng/src/main/java/org/assertj/swing/testng/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 20 |

21 | Classes in this package are deprecated and will be removed in version 2.0. 22 |

23 | 24 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/core/ThreadsSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import javax.annotation.Nonnull; 16 | 17 | /** 18 | * Utility methods related to threads. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | class ThreadsSource { 23 | @Nonnull 24 | Thread[] allThreads() { 25 | Thread[] all = new Thread[Thread.activeCount()]; 26 | Thread.enumerate(all); 27 | return all; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/input/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | *

15 | * Monitors of different input events. 16 | *

17 | * 18 | *

19 | * Most of the classes of in this packages were adapted from Abbot. Many thanks to Timothy Wall for allowing us to use them. 21 | *

22 | * 23 | * @author Alex Ruiz 24 | */ 25 | package org.assertj.swing.input; -------------------------------------------------------------------------------- /assertj-swing-junit/src/main/java/org/assertj/swing/junit/testcase/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 20 |

21 | Provides a template for test cases that use AssertJ Swing and JUnit. 22 |

23 | 24 | 25 | -------------------------------------------------------------------------------- /assertj-swing-testng/src/main/java/org/assertj/swing/testng/testcase/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 20 |

21 | Provides a template for test cases that use AssertJ Swing and TestNG. 22 |

23 | 24 | 25 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/ant/SomeTestFake.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.ant; 14 | 15 | import org.assertj.swing.annotation.GUITest; 16 | 17 | /** 18 | * Understands a test case with GUI tests and regular non-GUI tests. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class SomeTestFake { 23 | 24 | @GUITest 25 | public void guiTest() { 26 | } 27 | 28 | public void nonGuiTest() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/hierarchy/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | *

15 | * Scoped {@code Component} hierarchies. 16 | *

17 | * 18 | *

19 | * Most of the classes of in this packages were adapted from Abbot. Many thanks to Timothy Wall for allowing us to use them. 21 | *

22 | * 23 | * @author Alex Ruiz 24 | */ 25 | package org.assertj.swing.hierarchy; -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/util/SystemPropertyWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.util; 14 | 15 | import javax.annotation.Nonnull; 16 | import javax.annotation.Nullable; 17 | 18 | /** 19 | * @author Alex Ruiz 20 | */ 21 | class SystemPropertyWriter { 22 | @Nullable 23 | String updateSystemProperty(@Nonnull String propertyName, @Nullable String value) { 24 | return System.setProperty(propertyName, value); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/main/java/org/assertj/swing/junit/xml/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 20 |

21 | Wrappers for DOM classes that provide a more compact and intuitive API. Internal use only. 22 |

23 | 24 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/monitor/TestContexts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.monitor; 14 | 15 | import static org.mockito.Mockito.mock; 16 | 17 | /** 18 | * Implementations of {@link Context} to be used for testing. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public final class TestContexts { 23 | public static Context newMockContext() { 24 | return mock(Context.class); 25 | } 26 | 27 | private TestContexts() { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/main/java/org/assertj/swing/junit/ant/HostNameReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.ant; 14 | 15 | import java.net.InetAddress; 16 | import java.net.UnknownHostException; 17 | 18 | /** 19 | * Obtains the name of the local host. 20 | * 21 | * @author Alex Ruiz 22 | */ 23 | class HostNameReader { 24 | 25 | String localHostName() throws UnknownHostException { 26 | return InetAddress.getLocalHost().getHostName(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/applet/StatusDisplay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import javax.annotation.Nonnull; 16 | 17 | /** 18 | * Displays the state of an {@code Applet}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public interface StatusDisplay { 23 | /** 24 | * Displays the given status message. 25 | * 26 | * @param status the status to display. 27 | */ 28 | void showStatus(@Nonnull String status); 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/core/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | * Low-level components that enable functional testing of AWT and Swing {@code Component}s. 15 | * 16 | *

17 | * Most of the classes of in this packages were adapted from Abbot. Many thanks to Timothy Wall for allowing us to use them. 19 | *

20 | * 21 | * @author Alex Ruiz 22 | */ 23 | package org.assertj.swing.core; -------------------------------------------------------------------------------- /assertj-swing-junit/src/main/java/org/assertj/swing/junit/ant/StandardOutputStreams.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.ant; 14 | 15 | import java.io.OutputStream; 16 | 17 | /** 18 | * Understands utility methods related to {@link OutputStream}s. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | class StandardOutputStreams { 23 | 24 | boolean isStandardOutOrErr(OutputStream out) { 25 | return out == System.out || out == System.err; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/monitor/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | *

15 | * Monitors that track the state of AWT and Swing {@code Component}s. 16 | *

17 | * 18 | *

19 | * Most of the classes of in this packages were adapted from Abbot. Many thanks to Timothy Wall for allowing us to use them. 21 | *

22 | * 23 | * @author Alex Ruiz 24 | */ 25 | package org.assertj.swing.monitor; -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/TestRobotFixture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import org.assertj.swing.hierarchy.ComponentHierarchy; 16 | 17 | /** 18 | * A {@link BasicRobot} to be used for testing. 19 | * 20 | * @author Alex Ruiz 21 | * @author Yvonne Wang 22 | */ 23 | public class TestRobotFixture extends BasicRobot { 24 | public TestRobotFixture(ComponentHierarchy hierarchy) { 25 | super(new Object(), hierarchy); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/TypeMatcher_constructorWithType_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link TypeMatcher#TypeMatcher(Class)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class TypeMatcher_constructorWithType_Test { 23 | @Test(expected = NullPointerException.class) 24 | public void should_Throw_Error_If_Type_Is_Null() { 25 | new TypeMatcher(null); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/ant/XmlOutputWriter_TestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.ant; 14 | 15 | import org.junit.Before; 16 | 17 | /** 18 | * Base test case for {@link XmlOutputWriter}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public abstract class XmlOutputWriter_TestCase { 23 | 24 | XmlOutputWriter writer; 25 | 26 | @Before 27 | public final void setUp() { 28 | writer = new XmlOutputWriter(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/util/TestRobotFactories.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.util; 14 | 15 | import static org.mockito.Mockito.mock; 16 | 17 | /** 18 | * Instances of {@link RobotFactory} to be used for testing. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public final class TestRobotFactories { 23 | public static RobotFactory newRobotFactoryMock() { 24 | return mock(RobotFactory.class); 25 | } 26 | 27 | private TestRobotFactories() { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/keystroke/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | *

15 | * Mappings of characters to key strokes, supporting multiple languages and platforms. 16 | *

17 | * 18 | *

19 | * Most of the classes of in this packages were adapted from Abbot. Many thanks to Timothy Wall for allowing us to use them. 21 | *

22 | * 23 | * @author Alex Ruiz 24 | */ 25 | package org.assertj.swing.keystroke; -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/ReflectionBasedFocusOwnerFinder_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | /** 16 | * Tests for {@link ReflectionBasedFocusOwnerFinder}. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | public class ReflectionBasedFocusOwnerFinder_Test extends FocusOwnerFinderStrategy_focusOwner_TestCase { 21 | @Override 22 | protected FocusOwnerFinderStrategy createStrategyToTest() { 23 | return new ReflectionBasedFocusOwnerFinder(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/fixture/FontFixture_constructor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.fixture; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link FontFixture#FontFixture(Font)}. 19 | * 20 | * @author Yvonne Wang 21 | * @author Alex Ruiz 22 | */ 23 | public class FontFixture_constructor_Test { 24 | @Test(expected = NullPointerException.class) 25 | public void should_Throw_Error_If_Font_Is_Null() { 26 | new FontFixture(null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/HierarchyBasedFocusOwnerFinder_UI_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | /** 16 | * GUI Tests for {@link HierarchyBasedFocusOwnerFinder}. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | public class HierarchyBasedFocusOwnerFinder_UI_Test extends FocusOwnerFinderStrategy_focusOwner_TestCase { 21 | @Override 22 | protected FocusOwnerFinderStrategy createStrategyToTest() { 23 | return new HierarchyBasedFocusOwnerFinder(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/BasicRobot_ClickTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import org.assertj.swing.test.recorder.ClickRecorderManager; 16 | import org.junit.Rule; 17 | 18 | /** 19 | * Base case for tests for {@link BasicRobot} that test clicks. 20 | * 21 | * @author Christian Rösch 22 | */ 23 | public class BasicRobot_ClickTestCase extends BasicRobot_TestCase { 24 | @Rule 25 | public ClickRecorderManager clickRecorder = new ClickRecorderManager(); 26 | } 27 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/util/Platform_osFamily_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.util; 14 | 15 | import static org.mockito.Mockito.verify; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link Platform#osFamily()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class Platform_osFamily_Test extends Platform_TestCase { 25 | @Test 26 | public void should_Return_OsFamily() { 27 | Platform.osFamily(); 28 | verify(osIdentifier).osFamily(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/main/java/org/assertj/swing/junit/ant/StackTraceFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.ant; 14 | 15 | import static org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.getFilteredTrace; 16 | 17 | /** 18 | * Understands how to filter a stack trace (by removing all junit.runner.BaseTestRunner). 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | class StackTraceFilter { 23 | 24 | String filter(Throwable error) { 25 | return getFilteredTrace(error); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/NameMatcher_constructorWithNameAndType_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link NameMatcher#NameMatcher(String, Class)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class NameMatcher_constructorWithNameAndType_Test { 23 | @Test(expected = NullPointerException.class) 24 | public void should_Throw_Error_If_Type_Is_Null() { 25 | new NameMatcher("label", null); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/data/Index_equals_hashCode_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.data; 14 | 15 | import nl.jqno.equalsverifier.EqualsVerifier; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link Index#equals(Object)} and {@link Index#hashCode()}. 21 | * 22 | * @author Christian Rösch 23 | */ 24 | public class Index_equals_hashCode_Test { 25 | 26 | @Test 27 | public void should_Be_Correct() { 28 | EqualsVerifier.forClass(Index.class).verify(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/fixture/ColorFixture_constructor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.fixture; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link ColorFixture#ColorFixture(java.awt.Color)}. 19 | * 20 | * @author Alex Ruiz 21 | * @author Yvonne Wang 22 | */ 23 | public class ColorFixture_constructor_Test { 24 | @Test(expected = NullPointerException.class) 25 | public void should_Throw_Error_If_Color_Is_Null() { 26 | new ColorFixture(null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing-jide/src/main/java/org/assertj/swing/jide/action/driver/CommandBarDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.jide.action.driver; 14 | 15 | import org.assertj.swing.core.Robot; 16 | import org.assertj.swing.driver.JComponentDriver; 17 | 18 | /** 19 | * A Driver for the Jide {@link com.jidesoft.action.CommandBar} class. 20 | * 21 | * @author Peter Murray 22 | */ 23 | public class CommandBarDriver extends JComponentDriver { 24 | 25 | public CommandBarDriver(Robot robot) { 26 | super(robot); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/LabelMatcher_constructorWithLabelAndType_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link LabelMatcher#LabelMatcher(String, Class)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class LabelMatcher_constructorWithLabelAndType_Test { 23 | @Test(expected = NullPointerException.class) 24 | public void should_Throw_Error_If_Type_Is_Null() { 25 | new LabelMatcher("label", null); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/security/ExitException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.security; 14 | 15 | /** 16 | * Exception thrown when an application under tests tries to terminate the current JVM. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | public class ExitException extends RuntimeException { 21 | /** 22 | * Creates a new {@link ExitException}. 23 | * 24 | * @param message the detail message. 25 | */ 26 | public ExitException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/xml/XmlNode_target_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.xml; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link XmlNode#target()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class XmlNode_target_Test extends XmlNode_TestCase { 25 | 26 | @Test 27 | public void should_Return_Target() { 28 | assertThat(node.target()).isSameAs(target); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/core/ResettableComponentMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | /** 16 | * {@link ComponentMatcher} whose internal state can be reset. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | public interface ResettableComponentMatcher extends ComponentMatcher { 21 | /** 22 | * Resets the internal state of this matcher. 23 | * 24 | * @param matchFound indicates whether a match has been found before resetting. 25 | */ 26 | void reset(boolean matchFound); 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/input/NativeDndIdentifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.input; 14 | 15 | import java.awt.AWTEvent; 16 | import java.awt.event.MouseEvent; 17 | 18 | import javax.annotation.Nonnull; 19 | 20 | /** 21 | * Detects native drag 'n drop events. 22 | * 23 | * @author Alex Ruiz 24 | */ 25 | class NativeDndIdentifier { 26 | boolean isNativeDragAndDrop(@Nonnull AWTEvent e) { 27 | return (e instanceof MouseEvent) && e.getClass().getName().contains("SunDropTargetEvent"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/MouseButton_lookup_withInvalidValue_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link MouseButton#lookup(int)} with illegal arguments. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class MouseButton_lookup_withInvalidValue_Test { 23 | @Test(expected = IllegalArgumentException.class) 24 | public void shouldThrowErrorInLookupIfMaskIsInvalid() { 25 | MouseButton.lookup(Integer.MIN_VALUE); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/xml/XmlNode_name_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.xml; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link XmlNode#toString()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class XmlNode_name_Test extends XmlNode_TestCase { 25 | 26 | @Test 27 | public void should_Return_Node_Name() { 28 | assertThat(node.name()).isEqualTo("person"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/data/TableCell_equals_hashCode_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.data; 14 | 15 | import nl.jqno.equalsverifier.EqualsVerifier; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link TableCell#equals(Object)} and {@link TableCell#hashCode()}. 21 | * 22 | * @author Christian Rösch 23 | */ 24 | public class TableCell_equals_hashCode_Test { 25 | 26 | @Test 27 | public void should_Be_Correct() { 28 | EqualsVerifier.forClass(TableCell.class).verify(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/monitor/Windows_markAsClosed_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.monitor; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link Windows#markAsClosed(java.awt.Window)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class Windows_markAsClosed_Test extends Windows_TestCase { 23 | @Test 24 | public void should_Mark_Window_As_Closed() { 25 | windows.markAsClosed(window); 26 | windowState().isClosed().isNotHidden().isNotOpen().isNotPending(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/monitor/Windows_markAsHidden_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.monitor; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link Windows#markAsHidden(java.awt.Window)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class Windows_markAsHidden_Test extends Windows_TestCase { 23 | @Test 24 | public void should_Mark_Window_As_Hidden() { 25 | windows.markAsHidden(window); 26 | windowState().isNotClosed().isHidden().isNotOpen().isNotPending(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing-jide/src/main/java/org/assertj/swing/jide/grids/ExtendedItemGroupFixture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.jide.grids; 14 | 15 | import org.assertj.swing.fixture.ItemGroupFixture; 16 | 17 | /** 18 | * A Fixture that provides extra methods that can be performed on an item group. 19 | * 20 | * @author Peter Murray 21 | */ 22 | public interface ExtendedItemGroupFixture extends ItemGroupFixture { 23 | 24 | ExtendedItemGroupFixture requireSelection(Object o); 25 | 26 | ExtendedItemGroupFixture selectItem(Object o); 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/timing/Timeout_timeout_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.timing; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link Timeout#timeout()}. 21 | * 22 | * @author Christian Rösch 23 | */ 24 | public class Timeout_timeout_Test { 25 | @Test 26 | public void shouldReturn30000AsDuration() { 27 | Timeout timeout = Timeout.timeout(); 28 | assertThat(timeout.duration()).isEqualTo(30000); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/BasicJListCellReader_constructor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link BasicJListCellReader#BasicJListCellReader(CellRendererReader)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class BasicJListCellReader_constructor_Test { 23 | @Test(expected = NullPointerException.class) 24 | public void should_Throw_Error_If_CellRendererReader_Is_Null() { 25 | new BasicJComboBoxCellReader(null); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletContext_constructor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link BasicAppletContext#BasicAppletContext(StatusDisplay)}. 19 | * 20 | * @author Alex Ruiz 21 | * @author Yvonne Wang 22 | */ 23 | public class BasicAppletContext_constructor_Test { 24 | @Test(expected = NullPointerException.class) 25 | public void should_Throw_Error_If_StatusDisplay_Is_Null() { 26 | new BasicAppletContext(null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/test/core/EDTSafeTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.test.core; 14 | 15 | import org.assertj.swing.edt.FailOnThreadViolationRepaintManager; 16 | import org.junit.BeforeClass; 17 | 18 | /** 19 | * Base test case that ensures that Swing components are created and accessed in the EDT. 20 | * 21 | * @author Alex Ruiz 22 | */ 23 | public abstract class EDTSafeTestCase { 24 | @BeforeClass 25 | public static void setUpOnce() { 26 | FailOnThreadViolationRepaintManager.install(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/xml/XmlNode_text_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.xml; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link XmlNode#text()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class XmlNode_text_Test extends XmlNode_TestCase { 25 | 26 | @Test 27 | public void should_Return_Text() { 28 | node.addText("Hello"); 29 | assertThat(node.text()).isEqualTo("Hello"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/image/RandomFileNameCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.image; 14 | 15 | import static org.assertj.core.util.Strings.concat; 16 | 17 | import java.util.UUID; 18 | 19 | /** 20 | * Factory of file names based of random UUIDs. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | final class RandomFileNameCreator { 25 | static String randomFileName() { 26 | UUID uuid = UUID.randomUUID(); 27 | return concat(uuid.toString(), ".png"); 28 | } 29 | 30 | private RandomFileNameCreator() { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/timing/RuntimeExceptionCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.timing; 14 | 15 | /** 16 | * A {@link Condition} that is never satisfied. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | class RuntimeExceptionCondition extends Condition { 21 | private RuntimeException exception; 22 | 23 | public RuntimeExceptionCondition(RuntimeException ex) { 24 | super("Never satisfied"); 25 | this.exception = ex; 26 | } 27 | 28 | @Override 29 | public boolean test() { 30 | throw exception; 31 | } 32 | } -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/BasicJComboBoxCellReader_constructor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link BasicJComboBoxCellReader#BasicJComboBoxCellReader(CellRendererReader)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class BasicJComboBoxCellReader_constructor_Test { 23 | @Test(expected = NullPointerException.class) 24 | public void should_Throw_Error_If_CellRendererReader_Is_Null() { 25 | new BasicJComboBoxCellReader(null); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing-jide/src/main/java/org/assertj/swing/jide/grids/ExtendedTableFixture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.jide.grids; 14 | 15 | /** 16 | * An interface for defining advanced table fixture methods that will be useful for 17 | * driving table like components in AssertJ-Swing tests. 18 | * 19 | * @author Peter Murray 20 | */ 21 | public interface ExtendedTableFixture { 22 | 23 | int rows(); 24 | 25 | int columns(); 26 | 27 | int selectedRow(); 28 | 29 | int[] selectedRows(); 30 | 31 | ExtendedTableFixture requireSelection(int... rows); 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletStub_isActive_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletStub#isActive()}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class BasicAppletStub_isActive_Test extends BasicAppletStub_TestCase { 26 | @Test 27 | public void should_Always_Be_Active() { 28 | assertThat(stub.isActive()).isTrue(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/SingleComponentHierarchy_root_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link SingleComponentHierarchy#root()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class SingleComponentHierarchy_root_Test extends SingleComponentHierarchy_TestCase { 25 | @Test 26 | public void should_Return_Hierarchy_Root() { 27 | assertThat(hierarchy.root()).isSameAs(root); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JProgressBarDriver_textOf_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link JProgressBarDriver#textOf(JProgressBar)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class JProgressBarDriver_textOf_Test extends JProgressBarDriver_TestCase { 25 | @Test 26 | public void should_Return_Text() { 27 | assertThat(driver.textOf(progressBar)).isEqualTo("60%"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/xml/XmlNode_toString_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.xml; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link XmlNode#toString()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class XmlNode_toString_Test extends XmlNode_TestCase { 25 | 26 | @Test 27 | public void should_Implement_ToString() { 28 | assertThat(node.toString()).isEqualTo("XmlNode[target=[person: null]]"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/data/TableCellInRowByValue_rowWithValue_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.data; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link TableCellInRowByValue#rowWithValue(String...)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class TableCellInRowByValue_rowWithValue_Test { 23 | @Test(expected = NullPointerException.class) 24 | public void should_Throw_Error_If_Array_Of_Values_Is_Null() { 25 | String[] values = null; 26 | TableCellInRowByValue.rowWithValue(values); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTableCancelCellEditingTask_cancelEditing_withEditor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JTableCancelCellEditingTask#cancelEditing(javax.swing.table.TableCellEditor)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class JTableCancelCellEditingTask_cancelEditing_withEditor_Test { 23 | @Test 24 | public void should_Not_Throw_Error_If_Cell_Editor_Is_Null() { 25 | JTableCancelCellEditingTask.cancelEditing(null); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/test/swing/LookAndFeel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.test.swing; 14 | 15 | import javax.swing.UIManager; 16 | 17 | /** 18 | * Sets the look and feel of the windows used in the test suite in this project. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class LookAndFeel { 23 | public static void applySystemLookAndFeel() { 24 | try { 25 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 26 | } catch (Exception ignored) { 27 | ignored.printStackTrace(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/AppletViewer_reloadApplet_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link AppletViewer#reloadApplet()}. 19 | * 20 | * @author Alex Ruiz 21 | * @author Yvonne Wang 22 | */ 23 | public class AppletViewer_reloadApplet_Test extends AppletViewer_TestCase { 24 | @Test 25 | public void should_Reload_Applet() { 26 | viewer.reloadApplet(); 27 | assertThatAppletIsStoppedAndDestroyed(); 28 | assertThatAppletIsShowingAndViewerIsLoaded(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JScrollBarDriver_scrollToMinimum_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JScrollBarDriver#scrollToMinimum(javax.swing.JScrollBar)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class JScrollBarDriver_scrollToMinimum_Test extends JScrollBarDriver_TestCase { 23 | @Test 24 | public void should_Scroll_To_Minimum() { 25 | showWindow(); 26 | driver.scrollToMinimum(scrollBar); 27 | assertThatScrollBarValueIs(MINIMUM); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/edt/GuiTask_run_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.edt; 14 | 15 | import org.assertj.swing.exception.ActionFailedException; 16 | import org.junit.Test; 17 | 18 | /** 19 | * Tests for {@link GuiTask#run()}. 20 | * 21 | * @author Alex Ruiz 22 | */ 23 | public class GuiTask_run_Test { 24 | @Test(expected = ActionFailedException.class) 25 | public void should_Throw_Error_If_Not_Called_In_EDT() { 26 | new GuiTask() { 27 | @Override 28 | protected void executeInEDT() { 29 | } 30 | }.run(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing-testng/src/main/java/org/assertj/swing/testng/ScreenshotOnFailureListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.testng; 14 | 15 | /** 16 | * Understands a TestNG listener that takes a screenshot when a GUI test 17 | * fails. 18 | * 19 | * @deprecated Use {@link org.assertj.swing.testng.listener.ScreenshotOnFailureListener} instead. 20 | * 21 | * @author Alex Ruiz 22 | */ 23 | @Deprecated 24 | public class ScreenshotOnFailureListener extends org.assertj.swing.testng.listener.ScreenshotOnFailureListener { 25 | } 26 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletStub_getCodeBase_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletStub#getCodeBase()}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class BasicAppletStub_getCodeBase_Test extends BasicAppletStub_TestCase { 26 | @Test 27 | public void should_Return_NonNull_CodeBase() { 28 | assertThat(stub.getCodeBase()).isNotNull(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/hierarchy/ExistingHierarchy_TestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.hierarchy; 14 | 15 | import org.assertj.swing.test.core.EDTSafeTestCase; 16 | import org.junit.Before; 17 | 18 | /** 19 | * Base test case for {@link ExistingHierarchy}. 20 | * 21 | * @author Alex Ruiz 22 | * @author Yvonne Wang 23 | */ 24 | public abstract class ExistingHierarchy_TestCase extends EDTSafeTestCase { 25 | ExistingHierarchy hierarchy; 26 | 27 | @Before 28 | public final void setUp() { 29 | hierarchy = new ExistingHierarchy(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/xml/XmlNode_size_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.xml; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link XmlNode#size()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class XmlNode_size_Test extends XmlNode_TestCase { 25 | 26 | @Test 27 | public void should_Return_Child_Count() { 28 | node.addNewNode("one"); 29 | node.addNewNode("two"); 30 | assertThat(node.size()).isEqualTo(2); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JListDriver_cellReader_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JListDriver#replaceCellReader(org.assertj.swing.cell.JListCellReader)}. 19 | * 20 | * @author Alex Ruiz 21 | * @author Yvonne Wang 22 | */ 23 | public class JListDriver_cellReader_Test extends JListDriver_withMocks_TestCase { 24 | @Test(expected = NullPointerException.class) 25 | public void should_Throw_Error_If_CellReader_Is_Null() { 26 | driver.replaceCellReader(null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/monitor/Context_removeContextFor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.monitor; 14 | 15 | import static org.mockito.Mockito.verify; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link Context#removeContextFor(java.awt.Component)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class Context_removeContextFor_Test extends Context_TestCase { 25 | @Test 26 | public void should_Remove_Context() { 27 | context.removeContextFor(window); 28 | verify(windowEventQueueMapping).removeMappingFor(window); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletContext_getImage_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletContext#getImage(java.net.URL)}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class BasicAppletContext_getImage_Test extends BasicAppletContext_TestCase { 26 | @Test 27 | public void should_Always_Return_Null() { 28 | assertThat(context.getImage(null)).isNull(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTableDriver_cellWriter_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JTableDriver#replaceCellWriter(org.assertj.swing.cell.JTableCellWriter)}. 19 | * 20 | * @author Alex Ruiz 21 | * @author Yvonne Wang 22 | */ 23 | public class JTableDriver_cellWriter_Test extends JTableDriver_withMocks_TestCase { 24 | @Test(expected = NullPointerException.class) 25 | public void should_Throw_Error_If_CellWriter_Is_Null() { 26 | driver.replaceCellWriter(null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletStub_getAppletContext_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletStub#getAppletContext()}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class BasicAppletStub_getAppletContext_Test extends BasicAppletStub_TestCase { 26 | @Test 27 | public void should_Return_Context() { 28 | assertThat(stub.getAppletContext()).isSameAs(context); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/TestComponentHierarchies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.mockito.Mockito.mock; 16 | 17 | import org.assertj.swing.hierarchy.ComponentHierarchy; 18 | 19 | /** 20 | * Implementations of {@link ComponentHierarchy} to be used for testing. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public final class TestComponentHierarchies { 25 | public static ComponentHierarchy newComponentHierarchyMock() { 26 | return mock(ComponentHierarchy.class); 27 | } 28 | 29 | private TestComponentHierarchies() { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/AbstractButtonDriver_textOf_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link AbstractButtonDriver#textOf(javax.swing.AbstractButton)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class AbstractButtonDriver_textOf_Test extends AbstractButtonDriver_TestCase { 25 | @Test 26 | public void should_Return_Text_Of_Button() { 27 | assertThat(driver.textOf(checkBox)).isEqualTo("Hello"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JComboBoxDriver_cellReader_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JComboBoxDriver#replaceCellReader(org.assertj.swing.cell.JComboBoxCellReader)}. 19 | * 20 | * @author Alex Ruiz 21 | * @author Yvonne Wang 22 | */ 23 | public class JComboBoxDriver_cellReader_Test extends JComboBoxDriver_TestCase { 24 | @Test(expected = NullPointerException.class) 25 | public void should_Throw_Error_If_CellReader_Is_Null() { 26 | driver.replaceCellReader(null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/internal/annotation/InternalApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.internal.annotation; 14 | 15 | import java.lang.annotation.Documented; 16 | import java.lang.annotation.ElementType; 17 | import java.lang.annotation.Target; 18 | 19 | /** 20 | * Indicates that a type, method or constructor are meant for internal use only. There are no guarantees of backwards 21 | * compatibility. 22 | * 23 | * @author Alex Ruiz 24 | */ 25 | @Target({ ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.TYPE }) 26 | @Documented 27 | public @interface InternalApi { 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletStub_getDocumentBase_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletStub#getDocumentBase()}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class BasicAppletStub_getDocumentBase_Test extends BasicAppletStub_TestCase { 26 | @Test 27 | public void should_Return_NonNull_DocumentBase() { 28 | assertThat(stub.getDocumentBase()).isNotNull(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JMenuItemMatcher_toString_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link JMenuItemMatcher#toString()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class JMenuItemMatcher_toString_Test { 25 | @Test 26 | public void should_Show_Path_In_ToString() { 27 | JMenuItemMatcher matcher = new JMenuItemMatcher("File", "New"); 28 | assertThat(matcher.toString()).contains("label='File|New'"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/xml/XmlAttribute_equals_hashCode_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.xml; 14 | 15 | import nl.jqno.equalsverifier.EqualsVerifier; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link XmlAttribute#equals(Object)} and {@link XmlAttribute#hashCode()}. 21 | * 22 | * @author Christian Rösch 23 | */ 24 | public class XmlAttribute_equals_hashCode_Test { 25 | 26 | @Test 27 | public void should_Be_Correct() { 28 | EqualsVerifier.forClass(XmlAttribute.class).usingGetClass().verify(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/util/OSFamily.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.util; 14 | 15 | import javax.annotation.Nonnull; 16 | 17 | /** 18 | * Operating System families. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public enum OSFamily { 23 | WINDOWS("win"), MAC("mac"), LINUX("linux"), UNIX("unix"); 24 | 25 | private final String key; 26 | 27 | private OSFamily(@Nonnull String key) { 28 | this.key = key; 29 | } 30 | 31 | /** 32 | * @return the key (or abbreviation) of this OS family. 33 | */ 34 | @Nonnull public String key() { 35 | return key; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletContext_getAudioClip_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletContext#getAudioClip(java.net.URL)}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class BasicAppletContext_getAudioClip_Test extends BasicAppletContext_TestCase { 26 | @Test 27 | public void should_Always_Return_Null() { 28 | assertThat(context.getAudioClip(null)).isNull(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletContext_showStatus_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.mockito.Mockito.verify; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletContext#showStatus(String)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class BasicAppletContext_showStatus_Test extends BasicAppletContext_TestCase { 25 | @Test 26 | public void should_Show_Status() { 27 | String status = "Hi"; 28 | context.showStatus(status); 29 | verify(statusDisplay).showStatus(status); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/launcher/AppletLauncher_appletWithApplet_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.launcher; 14 | 15 | import java.applet.Applet; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link AppletLauncher#launcherFor(java.applet.Applet)}. 21 | * 22 | * @author Yvonne Wang 23 | */ 24 | public class AppletLauncher_appletWithApplet_Test extends AppletLauncher_TestCase { 25 | @Test(expected = NullPointerException.class) 26 | public void should_Throw_Error_If_Applet_To_Launch_Is_Null() { 27 | AppletLauncher.launcherFor((Applet) null); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/xml/XmlAttributes_equals_hashCode_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.xml; 14 | 15 | import nl.jqno.equalsverifier.EqualsVerifier; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link XmlAttributes#equals(Object)} and {@link XmlAttributes#hashCode()}. 21 | * 22 | * @author Christian Rösch 23 | */ 24 | public class XmlAttributes_equals_hashCode_Test { 25 | 26 | @Test 27 | public void should_Be_Correct() { 28 | EqualsVerifier.forClass(XmlAttributes.class).usingGetClass().verify(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/SingleComponentHierarchy_roots_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link SingleComponentHierarchy#roots()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class SingleComponentHierarchy_roots_Test extends SingleComponentHierarchy_TestCase { 25 | @Test 26 | public void should_Return_Collection_Of_Roots_That_Contains_Single_Hierarchy_Root() { 27 | assertThat(hierarchy.roots()).containsOnly(root); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTableDriver_tableHeaderOf_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link JTableDriver#tableHeaderOf(javax.swing.JTable)}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class JTableDriver_tableHeaderOf_Test extends JTableDriver_TestCase { 26 | @Test 27 | public void shouldReturnJTableHeader() { 28 | assertThat(driver.tableHeaderOf(table)).isSameAs(window.tableHeader); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/driver/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | /** 14 | *

15 | * {@code Component}-specific test drivers. Classes in this package are not part of the API. Use the classes in 16 | * {@link org.assertj.swing.fixture} in your tests. 17 | *

18 | * 19 | *

20 | * A test driver is capable of: 21 | *

22 | *
    23 | *
  • Simulate user input on a {@code Component}
  • 24 | *
  • Verify the state of a {@code Component}
  • 25 | *
  • Safely expose the state of a {@code Component}
  • 26 | *
27 | * 28 | * @author Alex Ruiz 29 | */ 30 | package org.assertj.swing.driver; -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/MouseButton_mask_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link MouseButton#mask}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class MouseButton_mask_Test extends MouseButton_TestCase { 25 | public MouseButton_mask_Test(MouseButton button, int mask) { 26 | super(button, mask); 27 | } 28 | 29 | @Test 30 | public void should_Contain_Correct_Mask() { 31 | assertThat(button.mask).isEqualTo(mask); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/RobotEventGenerator_rotateWheel_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.mockito.Mockito.verify; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link RobotEventGenerator#rotateMouseWheel(int)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class RobotEventGenerator_rotateWheel_Test extends RobotEventGenerator_TestCase { 25 | @Test 26 | public void should_Rotate_Mouse_Wheel() { 27 | int amount = 8; 28 | eventGenerator.rotateMouseWheel(amount); 29 | verify(robot).mouseWheel(amount); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTableDriver_validate_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JTableDriver#checkCellIndicesInBounds(javax.swing.JTable, org.assertj.swing.data.TableCell)}. 19 | * 20 | * @author Alex Ruiz 21 | * @author Yvonne Wang 22 | */ 23 | public class JTableDriver_validate_Test extends JTableDriver_withMocks_TestCase { 24 | @Test(expected = NullPointerException.class) 25 | public void shouldThrowErrorIfCellToValidateIsNull() { 26 | driver.checkCellIndicesInBounds(table, null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/driver/JInternalFrameAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import javax.annotation.Nonnull; 16 | 17 | /** 18 | * Action to execute on a {@code JInternalFrame}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | enum JInternalFrameAction { 23 | MAXIMIZE("Maximize", true), NORMALIZE("Normalize", false), ICONIFY("Iconify", true), DEICONIFY("Deiconify", false); 24 | 25 | final String name; 26 | final boolean value; 27 | 28 | private JInternalFrameAction(@Nonnull String name, boolean value) { 29 | this.name = name; 30 | this.value = value; 31 | } 32 | } -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/BasicJTableCellWriter_startCellEditing_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.assertj.swing.cell.JTableCellWriter; 16 | 17 | /** 18 | * Test case for implementations of {@link JTableCellWriter#startCellEditing(javax.swing.JTable, int, int)}. 19 | * 20 | * @author Yvonne Wang 21 | * @author Alex Ruiz 22 | */ 23 | public class BasicJTableCellWriter_startCellEditing_Test extends JTableCellWriter_startCellEditing_TestCase { 24 | @Override 25 | JTableCellWriter createWriter() { 26 | return new BasicJTableCellWriter(robot); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/main/java/org/assertj/swing/junit/ant/TimestampFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.ant; 14 | 15 | import static org.apache.tools.ant.util.DateUtils.ISO8601_DATETIME_PATTERN; 16 | 17 | import java.util.Date; 18 | 19 | import org.apache.tools.ant.util.DateUtils; 20 | 21 | /** 22 | * Understands formatting a date using ISO8601-like pattern: yyyy-MM-ddTHH:mm:ss. It does not support timezone. 23 | * 24 | * @author Alex Ruiz 25 | */ 26 | class TimestampFormatter { 27 | 28 | String format(Date date) { 29 | return DateUtils.format(date, ISO8601_DATETIME_PATTERN); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletContext_getAppletByName_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletContext#getApplet(String)}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class BasicAppletContext_getAppletByName_Test extends BasicAppletContext_TestCase { 26 | @Test 27 | public void should_Always_Return_Null_For_Any_Given_Name() { 28 | assertThat(context.getApplet("aName")).isNull(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/RobotEventGenerator_mouseMove_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.mockito.Mockito.verify; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link RobotEventGenerator#moveMouse(int, int)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class RobotEventGenerator_mouseMove_Test extends RobotEventGenerator_TestCase { 25 | @Test 26 | public void should_Move_Mouse_To_Given_Coordinates() { 27 | int x = 6; 28 | int y = 8; 29 | eventGenerator.moveMouse(x, y); 30 | verify(robot).mouseMove(x, y); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JFileChooserDriver_selectFile_withInvalidInput_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JFileChooserDriver#selectFile(JFileChooser, java.io.File)}. 19 | * 20 | * @author Yvonne Wang 21 | * @author Alex Ruiz 22 | */ 23 | public class JFileChooserDriver_selectFile_withInvalidInput_Test extends JFileChooserDriver_withMocks_TestCase { 24 | @Test(expected = NullPointerException.class) 25 | public void should_Throw_Error_If_File_Is_Null() { 26 | driver.selectFile(fileChooser, null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JScrollBarDriver_scrollToMaximum_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JScrollBarDriver#scrollToMaximum(javax.swing.JScrollBar)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class JScrollBarDriver_scrollToMaximum_Test extends JScrollBarDriver_TestCase { 23 | @Test 24 | public void should_Scroll_To_Maximum() { 25 | showWindow(); 26 | driver.scrollToMaximum(scrollBar); 27 | assertThatScrollBarValueIs(MAXIMUM - EXTENT); // JScrollBar value cannot go to maximum 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/monitor/Context_addContextFor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.monitor; 14 | 15 | import static org.mockito.Mockito.verify; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link Context#addContextFor(java.awt.Component)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class Context_addContextFor_Test extends Context_TestCase { 25 | @Test 26 | public void should_Add_Context() { 27 | context.addContextFor(window); 28 | verify(windowEventQueueMapping).addQueueFor(window); 29 | verify(eventQueueMapping).addQueueFor(window); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/ant/XmlJUnitResultFormatter_startTest_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.ant; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link XmlJUnitResultFormatter#startTest(junit.framework.Test)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class XmlJUnitResultFormatter_startTest_Test extends XmlJUnitResultFormatter_TestCase { 23 | 24 | @Test 25 | public void should_Add_Test_When_Test_Started() { 26 | junit.framework.Test test = mockTest(); 27 | formatter.startTest(test); 28 | assertThatTestWasStarted(test); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/annotation/RunsInEDT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.annotation; 14 | 15 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 16 | import static java.lang.annotation.ElementType.METHOD; 17 | import static java.lang.annotation.ElementType.TYPE; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.Target; 21 | 22 | /** 23 | * Indicates that a method is accessing GUI components in the event dispatch thread (EDT). 24 | * 25 | * @author Alex Ruiz 26 | */ 27 | @Target({ METHOD, CONSTRUCTOR, TYPE }) 28 | @Documented 29 | public @interface RunsInEDT { 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/WaitForComponentToShowCondition_untilIsShowing_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.assertj.swing.test.core.EDTSafeTestCase; 16 | import org.junit.Test; 17 | 18 | /** 19 | * Tests for {@link WaitForComponentToShowCondition#test()}. 20 | * 21 | * @author Yvonne Wang 22 | */ 23 | public class WaitForComponentToShowCondition_untilIsShowing_Test extends EDTSafeTestCase { 24 | @Test(expected = NullPointerException.class) 25 | public void shouldThrowError_If_Component_Is_Null() { 26 | WaitForComponentToShowCondition.untilIsShowing(null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/annotation/ThreadSafeAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.annotation; 14 | 15 | import static java.lang.annotation.ElementType.CONSTRUCTOR; 16 | import static java.lang.annotation.ElementType.METHOD; 17 | 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.Target; 20 | 21 | /** 22 | * Indicates that a method is thread-safe. To document that a class is thread-safe, use 23 | * {@code javax.annotation.concurrent.ThreadSafe}. 24 | * 25 | * @author Alex Ruiz 26 | */ 27 | @Target({ METHOD, CONSTRUCTOR }) 28 | @Documented 29 | public @interface ThreadSafeAction { 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/AbstractComponentMatcher_constructor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link AbstractComponentMatcher#AbstractComponentMatcher()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class AbstractComponentMatcher_constructor_Test { 25 | @Test 26 | public void should_Not_Require_Showing_By_Default() { 27 | AbstractComponentMatcher matcher = new ConcreteComponentMatcher(); 28 | assertThat(matcher.requireShowing()).isFalse(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/NameMatcher_constructorWithName_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link NameMatcher#NameMatcher(String)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class NameMatcher_constructorWithName_Test { 23 | @Test(expected = NullPointerException.class) 24 | public void should_Throw_Error_If_Name_Is_Null() { 25 | new NameMatcher(null); 26 | } 27 | 28 | @Test(expected = IllegalArgumentException.class) 29 | public void should_Throw_Error_If_Name_Is_Empty() { 30 | new NameMatcher(""); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/WindowDriver_showWithSize_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | import static org.assertj.swing.query.ComponentVisibleQuery.isVisible; 17 | 18 | import org.junit.Test; 19 | 20 | /** 21 | * Tests for {@link WindowDriver#show(java.awt.Window)}. 22 | * 23 | * @author Alex Ruiz 24 | */ 25 | public class WindowDriver_showWithSize_Test extends WindowDriver_TestCase { 26 | @Test 27 | public void should_Show_Window() { 28 | driver.show(window); 29 | assertThat(isVisible(window)).isTrue(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletContext_TestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.mockito.Mockito.mock; 16 | 17 | import org.junit.Before; 18 | 19 | /** 20 | * Base class for tests for {@link BasicAppletContext}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public abstract class BasicAppletContext_TestCase { 26 | BasicAppletContext context; 27 | StatusDisplay statusDisplay; 28 | 29 | @Before 30 | public void setUp() { 31 | statusDisplay = mock(StatusDisplay.class); 32 | context = new BasicAppletContext(statusDisplay); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/MouseButton_lookup_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link MouseButton#lookup(int)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class MouseButton_lookup_Test extends MouseButton_TestCase { 25 | public MouseButton_lookup_Test(MouseButton button, int mask) { 26 | super(button, mask); 27 | } 28 | 29 | @Test 30 | public void shouldLookupButtonGivenMask() { 31 | assertThat(MouseButton.lookup(mask)).isEqualTo(button); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/RobotEventGenerator_pressMouse_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | /** 16 | * Tests for {@link RobotEventGenerator#pressMouse(java.awt.Point, int)} and 17 | * {@link RobotEventGenerator#releaseMouse(int)}. 18 | * 19 | * @author Alex Ruiz 20 | */ 21 | public class RobotEventGenerator_pressMouse_Test extends InputEventGenerator_pressMouse_TestCase { 22 | public RobotEventGenerator_pressMouse_Test(MouseButton button) { 23 | super(button); 24 | } 25 | 26 | @Override 27 | InputEventGenerator eventGenerator() { 28 | return new RobotEventGenerator(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/text/JListTextReader_supportedComponent_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.text; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import javax.swing.JList; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * Tests for {@link JListTextReader#supportedComponent()}. 23 | * 24 | * @author Alex Ruiz 25 | */ 26 | public class JListTextReader_supportedComponent_Test { 27 | @Test 28 | public void should_Return_JList_Class() { 29 | JListTextReader reader = new JListTextReader(); 30 | assertThat(reader.supportedComponent()).isEqualTo(JList.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/applet/BasicAppletStub_appletResize_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.applet; 14 | 15 | import static org.mockito.Mockito.verify; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link BasicAppletStub#appletResize(int, int)}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class BasicAppletStub_appletResize_Test extends BasicAppletStub_TestCase { 26 | @Test 27 | public void should_Resize_Viewer_When_Applet_Is_Resized() { 28 | int w = 800; 29 | int h = 600; 30 | stub.appletResize(w, h); 31 | verify(viewer).setSize(w, h); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/LabelMatcher_constructorWithLabel_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link LabelMatcher#LabelMatcher(String)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class LabelMatcher_constructorWithLabel_Test { 23 | @Test(expected = NullPointerException.class) 24 | public void should_Throw_Error_If_Label_Is_Null() { 25 | new LabelMatcher(null); 26 | } 27 | 28 | @Test(expected = IllegalArgumentException.class) 29 | public void should_Throw_Error_If_Label_Is_Empty() { 30 | new LabelMatcher(""); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/LabelMatcher_toString_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link LabelMatcher#toString()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class LabelMatcher_toString_Test { 25 | @Test 26 | public void should_Implement_ToString() { 27 | LabelMatcher matcher = new LabelMatcher("Hello"); 28 | assertThat(matcher.toString()).contains("label='Hello'").contains("type=java.awt.Component") 29 | .contains("requireShowing=false"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/NameMatcher_toString_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link NameMatcher#toString()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class NameMatcher_toString_Test { 25 | @Test 26 | public void should_Implement_ToString() { 27 | NameMatcher matcher = new NameMatcher("my button"); 28 | assertThat(matcher.toString()).contains("name='my button'").contains("type=java.awt.Component") 29 | .contains("requireShowing=false"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/RobotEventGenerator_pressKey_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | /** 16 | * Tests for {@link RobotEventGenerator#pressKey(int, char)} and {@link RobotEventGenerator#releaseKey(int)}. 17 | * 18 | * @author Alex Ruiz 19 | */ 20 | public class RobotEventGenerator_pressKey_Test extends InputEventGenerator_pressKey_TestCase { 21 | public RobotEventGenerator_pressKey_Test(int keyToPress, String expectedText) { 22 | super(keyToPress, expectedText); 23 | } 24 | 25 | @Override 26 | InputEventGenerator eventGenerator() { 27 | return new RobotEventGenerator(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JSpinnerDriver_editor_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.assertj.swing.exception.ComponentLookupException; 16 | import org.junit.Test; 17 | 18 | /** 19 | * Tests for {@link JSpinnerDriver#editor(javax.swing.JSpinner)}. 20 | * 21 | * @author Alex Ruiz 22 | */ 23 | public class JSpinnerDriver_editor_Test extends JSpinnerDriver_TestCase { 24 | @Test(expected = ComponentLookupException.class) 25 | public void should_Throw_Error_If_JTextComponentEditor_Not_Found() { 26 | setJLabelAsEditor(); 27 | showWindow(); 28 | driver.editor(spinner); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTableCheckBoxEditorCellWriter_startCellEditing_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.assertj.swing.cell.JTableCellWriter; 16 | 17 | /** 18 | * Tests for {@link JTableCheckBoxEditorCellWriter#startCellEditing(javax.swing.JTable, int, int)}. 19 | * 20 | * @author Yvonne Wang 21 | * @author Alex Ruiz 22 | */ 23 | public class JTableCheckBoxEditorCellWriter_startCellEditing_Test extends JTableCellWriter_startCellEditing_TestCase { 24 | @Override 25 | protected JTableCellWriter createWriter() { 26 | return new JTableCheckBoxEditorCellWriter(robot); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/keystroke/KeyStrokeMappingProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.keystroke; 14 | 15 | import java.util.Collection; 16 | 17 | import javax.annotation.Nonnull; 18 | 19 | /** 20 | * Provides a mapping between characters and {@code KeyStroke}s. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public interface KeyStrokeMappingProvider { 25 | /** Value to use when a key stroke is not using modifiers. */ 26 | int NO_MASK = 0; 27 | 28 | /** 29 | * @return the {@code KeyStrokeMapping}s to be used by {@link KeyStrokeMap}. 30 | */ 31 | @Nonnull 32 | Collection keyStrokeMappings(); 33 | } 34 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTreeDriver_validateRow_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Tests for {@link JTreeDriver#checkRowInBounds(JTree, int)}. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class JTreeDriver_validateRow_Test extends JTreeDriver_TestCase { 23 | @Test 24 | public void should_Pass_If_Index_Is_Valid() { 25 | driver.checkRowInBounds(tree, 1); 26 | } 27 | 28 | @Test(expected = IndexOutOfBoundsException.class) 29 | public void should_Throw_Error_If_Index_Is_Out_Of_Bounds() { 30 | driver.checkRowInBounds(tree, -1); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/text/JLabelTextReader_supportedComponent_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.text; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import javax.swing.JLabel; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * Tests for {@link JLabelTextReader#supportedComponent()}. 23 | * 24 | * @author Alex Ruiz 25 | */ 26 | public class JLabelTextReader_supportedComponent_Test { 27 | @Test 28 | public void should_Return_JLabel_Class() { 29 | JLabelTextReader reader = new JLabelTextReader(); 30 | assertThat(reader.supportedComponent()).isEqualTo(JLabel.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/WindowDriver_close_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | import static org.assertj.swing.query.ComponentVisibleQuery.isVisible; 17 | 18 | import org.junit.Test; 19 | 20 | /** 21 | * Tests for {@link WindowDriver#moveToBack(java.awt.Window)}. 22 | * 23 | * @author Alex Ruiz 24 | */ 25 | public class WindowDriver_close_Test extends WindowDriver_TestCase { 26 | @Test 27 | public void should_Close_Window() { 28 | showWindow(); 29 | driver.close(window); 30 | assertThat(isVisible(window)).isFalse(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/edt/FailOnThreadViolationRepaintManager_uninstall_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.edt; 14 | 15 | import javax.swing.JTextField; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link FailOnThreadViolationRepaintManager#uninstall()}. 21 | * 22 | * @author Christian Rösch 23 | */ 24 | public class FailOnThreadViolationRepaintManager_uninstall_Test { 25 | @Test 26 | public void should_Not_Throw_Error_In_Case_Of_EDT_Access_Violation() { 27 | FailOnThreadViolationRepaintManager.install(); 28 | FailOnThreadViolationRepaintManager.uninstall(); 29 | new JTextField(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/edt/GuiQuery_run_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.edt; 14 | 15 | import org.assertj.swing.exception.ActionFailedException; 16 | import org.junit.Test; 17 | 18 | /** 19 | * Tests for {@link GuiQuery#run()}. 20 | * 21 | * @author Yvonne Wang 22 | * @author Alex Ruiz 23 | */ 24 | public class GuiQuery_run_Test { 25 | @Test(expected = ActionFailedException.class) 26 | public void should_Throw_Error_If_Not_Called_In_EDT() { 27 | new GuiQuery() { 28 | @Override 29 | protected Integer executeInEDT() throws Throwable { 30 | return null; 31 | } 32 | }.run(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/matcher/NamedComponentMatcherTemplate_ANY_toString_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core.matcher; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@code toString} in {@link NamedComponentMatcherTemplate#ANY}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class NamedComponentMatcherTemplate_ANY_toString_Test extends NamedComponentMatcherTemplate_TestCase { 25 | @Test 26 | public void should_Implement_ToString() { 27 | assertThat(NamedComponentMatcherTemplate.anyValue().toString()).isEqualTo(""); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/data/Index_toString_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.data; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Before; 18 | import org.junit.Test; 19 | 20 | /** 21 | * Tests for {@link Index#toString()}. 22 | * 23 | * @author Alex Ruiz 24 | */ 25 | public class Index_toString_Test { 26 | private Index index; 27 | 28 | @Before 29 | public void setUp() { 30 | index = Index.atIndex(8); 31 | } 32 | 33 | @Test 34 | public void should_Implement_ToString() { 35 | assertThat(index.toString()).isEqualTo("org.assertj.swing.data.Index[value=8]"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTabbedPaneDriver_tabTitles_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | import static org.assertj.core.util.Arrays.array; 17 | 18 | import org.junit.Test; 19 | 20 | /** 21 | * Tests for {@link JTabbedPaneDriver#tabTitles(javax.swing.JTabbedPane)}. 22 | * 23 | * @author Alex Ruiz 24 | */ 25 | public class JTabbedPaneDriver_tabTitles_Test extends JTabbedPaneDriver_TestCase { 26 | @Test 27 | public void should_Return_Tab_Titles() { 28 | assertThat(driver.tabTitles(tabbedPane)).isEqualTo(array("One", "Two", "Three")); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/data/TableCell_toString_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.data; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Before; 18 | import org.junit.Test; 19 | 20 | /** 21 | * Tests for {@link TableCell#toString()}. 22 | * 23 | * @author Alex Ruiz 24 | */ 25 | public class TableCell_toString_Test { 26 | private TableCell cell; 27 | 28 | @Before 29 | public void setUp() { 30 | cell = TableCell.row(6).column(8); 31 | } 32 | 33 | @Test 34 | public void should_Implement_ToString() { 35 | assertThat(cell.toString()).isEqualTo("[row=6, column=8]"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JOptionPaneMessageTypes_messageTypeAsText_withInvalidType_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.assertj.swing.exception.ActionFailedException; 16 | import org.junit.Test; 17 | 18 | /** 19 | * Tests for {@link JOptionPaneMessageTypes#messageTypeAsText(int)}. 20 | * 21 | * @author Alex Ruiz 22 | */ 23 | public class JOptionPaneMessageTypes_messageTypeAsText_withInvalidType_Test { 24 | @Test(expected = ActionFailedException.class) 25 | public void should_Throw_Error_If_Message_Type_Value_Is_Invalid() { 26 | JOptionPaneMessageTypes.messageTypeAsText(Integer.MIN_VALUE); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTableCellWriter_startCellEditing_TestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Test case for implementations of {@link JTableCellWriter}. 19 | * 20 | * @author Yvonne Wang 21 | * @author Alex Ruiz 22 | */ 23 | public abstract class JTableCellWriter_startCellEditing_TestCase extends JTableCellWriter_TestCase { 24 | @Test 25 | public void should_Throw_Error_If_Editor_Component_Cannot_Be_Handled() { 26 | assertActionFailedExceptionWithMessageIndicatingWriterWasUnableToActivateEditor(); 27 | writer.startCellEditing(window.table, 0, 1); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/monitor/ComponentWithCustomEventQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.monitor; 14 | 15 | import java.awt.Toolkit; 16 | 17 | import javax.swing.JComponent; 18 | 19 | /** 20 | * A {@code JComponent} stub that can be configured to use a custom {@code Toolkit}. 21 | * 22 | * @author Yvonne Wang 23 | * @author Alex Ruiz 24 | */ 25 | class ComponentWithCustomEventQueue extends JComponent { 26 | private final Toolkit toolkit; 27 | 28 | ComponentWithCustomEventQueue(Toolkit toolkit) { 29 | this.toolkit = toolkit; 30 | } 31 | 32 | @Override 33 | public Toolkit getToolkit() { 34 | return toolkit; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/core/ConcreteComponentMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import java.awt.Component; 16 | 17 | import javax.annotation.Nullable; 18 | 19 | /** 20 | * Implementation of {@link AbstractComponentMatcher} for testing. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | class ConcreteComponentMatcher extends AbstractComponentMatcher { 25 | public ConcreteComponentMatcher() { 26 | super(); 27 | } 28 | 29 | public ConcreteComponentMatcher(boolean requireShowing) { 30 | super(requireShowing); 31 | } 32 | 33 | @Override 34 | public boolean matches(@Nullable Component c) { 35 | return false; 36 | } 37 | } -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTableClearSelectionTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.swing.edt.GuiActionRunner.execute; 16 | 17 | import javax.swing.JTable; 18 | 19 | import org.assertj.swing.annotation.RunsInEDT; 20 | 21 | /** 22 | * Clears the selection in a {@code JTable}. This task is executed in the event dispatch thread (EDT). 23 | * 24 | * @author Alex Ruiz 25 | */ 26 | final class JTableClearSelectionTask { 27 | @RunsInEDT 28 | static void clearSelectionOf(final JTable table) { 29 | execute(() -> table.clearSelection()); 30 | } 31 | 32 | private JTableClearSelectionTask() { 33 | } 34 | } -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JTableDriver_rowCountOf_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | import static org.assertj.swing.driver.JTableDriver_TestCase.MyWindow.ROW_COUNT; 17 | 18 | import org.junit.Test; 19 | 20 | /** 21 | * Tests for {@link JTableDriver#rowCountOf(javax.swing.JTable)}. 22 | * 23 | * @author Alex Ruiz 24 | * @author Yvonne Wang 25 | */ 26 | public class JTableDriver_rowCountOf_Test extends JTableDriver_TestCase { 27 | @Test 28 | public void shouldReturnRowCount() { 29 | assertThat(driver.rowCountOf(table)).isEqualTo(ROW_COUNT); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/core/ReflectionBasedFocusOwnerFinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.fest.reflect.core.Reflection.field; 16 | 17 | import java.awt.Component; 18 | import java.awt.KeyboardFocusManager; 19 | 20 | import javax.annotation.Nullable; 21 | 22 | /** 23 | * Finds the current focus owner using Java reflection. 24 | * 25 | * @author Alex Ruiz 26 | */ 27 | class ReflectionBasedFocusOwnerFinder implements FocusOwnerFinderStrategy { 28 | @Override 29 | @Nullable public Component focusOwner() { 30 | return field("focusOwner").ofType(Component.class).in(KeyboardFocusManager.class).get(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/FEST137_SelectAllOnDoubleClickInJTextComponent_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import org.junit.Test; 16 | 17 | /** 18 | * Test case for bug FEST-137 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | public class FEST137_SelectAllOnDoubleClickInJTextComponent_Test extends JTextComponentDriver_TestCase { 23 | @Test 24 | public void should_Select_All_Text_On_Double_Click() { 25 | setTextFieldText("Hello"); 26 | showWindow(); 27 | driver.doubleClick(textField); 28 | requireSelectedTextInTextField("Hello"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JComboBoxDriver_value_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link JComboBoxDriver#value(javax.swing.JComboBox, int)}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class JComboBoxDriver_value_Test extends JComboBoxDriver_TestCase { 26 | @Test 27 | public void should_Return_Value_As_Text_Of_Item() { 28 | String value = driver.value(comboBox, 2); 29 | assertThat(value).isEqualTo("third"); 30 | assertThatCellReaderWasCalled(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/launcher/AppletParameterBuilder_value_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.launcher; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link AppletParameterBuilder#value(String)}. 21 | * 22 | * @author Yvonne Wang 23 | */ 24 | public class AppletParameterBuilder_value_Test { 25 | @Test 26 | public void should_Create_AppletParameter() { 27 | AppletParameter parameter = AppletParameter.name("bgcolor").value("blue"); 28 | assertThat(parameter.name).isEqualTo("bgcolor"); 29 | assertThat(parameter.value).isEqualTo("blue"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/core/HierarchyRootsSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import java.awt.Container; 16 | import java.util.Collection; 17 | 18 | import javax.annotation.Nonnull; 19 | 20 | import org.assertj.swing.hierarchy.ExistingHierarchy; 21 | 22 | /** 23 | * Obtains all the root AWT and Swing {@code Container}s of an {@link ExistingHierarchy}. 24 | * 25 | * @author Alex Ruiz 26 | */ 27 | class HierarchyRootsSource { 28 | @Nonnull 29 | Container[] existingHierarchyRoots() { 30 | Collection roots = new ExistingHierarchy().roots(); 31 | return roots.toArray(new Container[roots.size()]); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JAppletDriver_appletResize_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link JAppletDriver#appletResize(javax.swing.JApplet, int, int)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class JAppletDriver_appletResize_Test extends JAppletDriver_TestCase { 25 | @Test 26 | public void should_Resize_JApplet() { 27 | int w = 10; 28 | int h = 20; 29 | driver().appletResize(applet(), w, h); 30 | assertThat(applet().wasMethodCalledInEDT("resize(10, 20)")).isTrue(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JInternalFrameDriver_moveToBack_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link JInternalFrameDriver#moveToBack(javax.swing.JInternalFrame)}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class JInternalFrameDriver_moveToBack_Test extends JInternalFrameDriver_TestCase { 26 | @Test 27 | public void should_Move_JInternalFrame_To_Back() { 28 | showWindow(); 29 | driver.moveToBack(internalFrame); 30 | assertThat(zOrder()).isEqualTo(1); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/timing/NeverSatisfiedCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.timing; 14 | 15 | import java.util.concurrent.atomic.AtomicInteger; 16 | 17 | /** 18 | * A {@link Condition} that is never satisfied. 19 | * 20 | * @author Alex Ruiz 21 | */ 22 | class NeverSatisfiedCondition extends Condition { 23 | private AtomicInteger count; 24 | public NeverSatisfiedCondition() { 25 | super("Never satisfied"); 26 | count = new AtomicInteger(0); 27 | } 28 | 29 | @Override 30 | public boolean test() { 31 | count.incrementAndGet(); 32 | return false; 33 | } 34 | 35 | public int getCount() { 36 | return count.get(); 37 | } 38 | } -------------------------------------------------------------------------------- /assertj-swing-junit/src/test/java/org/assertj/swing/junit/xml/XmlNode_parentNode_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.junit.xml; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link XmlNode#parentNode()}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class XmlNode_parentNode_Test extends XmlNode_TestCase { 25 | 26 | @Test 27 | public void should_Return_Parent_Node() { 28 | XmlNode newNode = node.addNewNode("new"); 29 | XmlNode parent = newNode.parentNode(); 30 | assertThat(parent).isEqualTo(node); 31 | assertThat(parent.target()).isSameAs(target); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/driver/JScrollBarSetValueTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.swing.edt.GuiActionRunner.execute; 16 | 17 | import javax.annotation.Nonnull; 18 | import javax.swing.JScrollBar; 19 | 20 | /** 21 | * Sets the value of a {@code JScrollBar}. This task is executed in the event dispatch thread (EDT). 22 | * 23 | * @author Alex Ruiz 24 | * @author Yvonne Wang 25 | */ 26 | final class JScrollBarSetValueTask { 27 | static void setValue(final @Nonnull JScrollBar scrollBar, final int value) { 28 | execute(() -> scrollBar.setValue(value)); 29 | } 30 | 31 | private JScrollBarSetValueTask() { 32 | } 33 | } -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/exception/WaitTimedOutError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.exception; 14 | 15 | import javax.annotation.Nonnull; 16 | 17 | /** 18 | * Error thrown when a wait (for some condition) times out. 19 | * 20 | * @author Yvonne Wang 21 | */ 22 | public final class WaitTimedOutError extends RuntimeException { 23 | /** Generated serial version UID. */ 24 | private static final long serialVersionUID = 4272325985481493108L; 25 | 26 | /** 27 | * Creates a new {@link WaitTimedOutError}. 28 | * 29 | * @param message the detail message. 30 | */ 31 | public WaitTimedOutError(@Nonnull String message) { 32 | super(message); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/driver/JInternalFrameDriver_moveToFront_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.driver; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link JInternalFrameDriver#moveToFront(javax.swing.JInternalFrame)}. 21 | * 22 | * @author Alex Ruiz 23 | * @author Yvonne Wang 24 | */ 25 | public class JInternalFrameDriver_moveToFront_Test extends JInternalFrameDriver_TestCase { 26 | @Test 27 | public void should_Move_JInternalFrame_To_Front() { 28 | showWindow(); 29 | driver.moveToFront(internalFrame); 30 | assertThat(zOrder()).isEqualTo(0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/input/DragAwareEventQueue_dispatchEvent_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.input; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link DragAwareEventQueue#dispatchEvent(java.awt.AWTEvent)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class DragAwareEventQueue_dispatchEvent_Test extends DragAwareEventQueue_TestCase { 25 | @Test 26 | public void should_Dispatch_Event_If_Event_Is_Not_Native_Drag_And_Drop() { 27 | MyEvent event = new MyEvent(); 28 | queue.dispatchEvent(event); 29 | assertThat(event.dispatched).isTrue(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/timing/Timeout_timeout_long_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.timing; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link Timeout#timeout(long)}. 21 | * 22 | * @author Yvonne Wang 23 | * @author Alex Ruiz 24 | */ 25 | public class Timeout_timeout_long_Test { 26 | @Test 27 | public void shouldReturnDurationPassedWhenCreated() { 28 | Timeout timeout = Timeout.timeout(2000); 29 | assertThat(timeout.duration()).isEqualTo(2000); 30 | 31 | timeout = Timeout.timeout(1000); 32 | assertThat(timeout.duration()).isEqualTo(1000); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /assertj-swing/src/main/java/org/assertj/swing/core/FrameDisposer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.core; 14 | 15 | import static org.assertj.swing.edt.GuiActionRunner.execute; 16 | 17 | import java.awt.Frame; 18 | 19 | import org.assertj.swing.annotation.RunsInEDT; 20 | 21 | /** 22 | * Disposes all available AWT or Swing {@code Frame}s. 23 | * 24 | * @author Alex Ruiz 25 | */ 26 | class FrameDisposer { 27 | @RunsInEDT 28 | void disposeFrames() { 29 | doDisposeFrames(); 30 | } 31 | 32 | @RunsInEDT 33 | private static void doDisposeFrames() { 34 | execute(() -> { 35 | for (Frame f : Frame.getFrames()) { 36 | f.dispose(); 37 | } 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /assertj-swing/src/test/java/org/assertj/swing/exception/UnexpectedException_unexpected_withCause_Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 3 | * the License. You may obtain a copy of the License at 4 | * 5 | * http://www.apache.org/licenses/LICENSE-2.0 6 | * 7 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 8 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 9 | * specific language governing permissions and limitations under the License. 10 | * 11 | * Copyright 2012-2018 the original author or authors. 12 | */ 13 | package org.assertj.swing.exception; 14 | 15 | import static org.assertj.core.api.Assertions.assertThat; 16 | 17 | import org.junit.Test; 18 | 19 | /** 20 | * Tests for {@link UnexpectedException#unexpected(Throwable)}. 21 | * 22 | * @author Alex Ruiz 23 | */ 24 | public class UnexpectedException_unexpected_withCause_Test { 25 | @Test 26 | public void should_Create_Error_With_Cause() { 27 | Exception cause = new Exception(); 28 | UnexpectedException unexpected = UnexpectedException.unexpected(cause); 29 | assertThat(unexpected.getCause()).isSameAs(cause); 30 | } 31 | } 32 | --------------------------------------------------------------------------------