├── 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 |
11 | You are being redirected to the wiki page.
12 | , 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 alljunit.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 | *{@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{@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 |
--------------------------------------------------------------------------------