Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
todo-list-example
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IT1901
todo-list-example
Commits
c6c46465
Commit
c6c46465
authored
3 years ago
by
George Adrian Stoica
Browse files
Options
Downloads
Patches
Plain Diff
changes waitForNode to use asserttion
closes #24
parent
d270623e
No related branches found
No related tags found
1 merge request
!4
changes waitForNode to use assertion
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
todolist/fxui/src/test/java/todolist/ui/TodoListControllerTest.java
+8
-8
8 additions, 8 deletions
...xui/src/test/java/todolist/ui/TodoListControllerTest.java
with
8 additions
and
8 deletions
todolist/fxui/src/test/java/todolist/ui/TodoListControllerTest.java
+
8
−
8
View file @
c6c46465
...
@@ -6,6 +6,7 @@ import java.util.Iterator;
...
@@ -6,6 +6,7 @@ import java.util.Iterator;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.TimeoutException
;
import
java.util.function.Predicate
;
import
java.util.function.Predicate
;
import
static
java
.
time
.
Duration
.
ofSeconds
;
import
javafx.fxml.FXMLLoader
;
import
javafx.fxml.FXMLLoader
;
import
javafx.scene.Node
;
import
javafx.scene.Node
;
import
javafx.scene.Parent
;
import
javafx.scene.Parent
;
...
@@ -14,13 +15,13 @@ import javafx.scene.control.ListView;
...
@@ -14,13 +15,13 @@ import javafx.scene.control.ListView;
import
javafx.stage.Stage
;
import
javafx.stage.Stage
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTimeoutPreemptively
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
fail
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
fail
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable
;
import
org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable
;
import
org.junit.jupiter.api.condition.DisabledIfSystemProperty
;
import
org.testfx.framework.junit5.ApplicationTest
;
import
org.testfx.framework.junit5.ApplicationTest
;
import
org.testfx.util.WaitForAsyncUtils
;
import
org.testfx.util.WaitForAsyncUtils
;
import
todolist.core.AbstractTodoList
;
import
todolist.core.AbstractTodoList
;
...
@@ -157,8 +158,9 @@ public class TodoListControllerTest extends ApplicationTest {
...
@@ -157,8 +158,9 @@ public class TodoListControllerTest extends ApplicationTest {
private
Node
waitForNode
(
Predicate
<
Node
>
nodeTest
,
int
num
)
{
private
Node
waitForNode
(
Predicate
<
Node
>
nodeTest
,
int
num
)
{
WaitForAsyncUtils
.
waitForFxEvents
();
WaitForAsyncUtils
.
waitForFxEvents
();
Node
[]
nodes
=
new
Node
[
1
];
Node
[]
nodes
=
new
Node
[
1
];
try
{
boolean
nodeFound
;
WaitForAsyncUtils
.
waitFor
(
2000
,
TimeUnit
.
MILLISECONDS
,
nodeFound
=
assertTimeoutPreemptively
(
ofSeconds
(
2
),
()
->
{
()
->
{
while
(
true
)
{
while
(
true
)
{
if
((
nodes
[
0
]
=
findNode
(
nodeTest
,
num
))
!=
null
)
{
if
((
nodes
[
0
]
=
findNode
(
nodeTest
,
num
))
!=
null
)
{
...
@@ -166,11 +168,9 @@ public class TodoListControllerTest extends ApplicationTest {
...
@@ -166,11 +168,9 @@ public class TodoListControllerTest extends ApplicationTest {
}
}
Thread
.
sleep
(
100
);
Thread
.
sleep
(
100
);
}
}
}
},
"No appropriate node available"
);
);
}
catch
(
TimeoutException
e
)
{
fail
(
"No appropriate node available"
);
}
return
nodes
[
0
];
return
nodes
[
0
];
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment