SlideShare uma empresa Scribd logo
1 de 163
Baixar para ler offline
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 2/164
Sven Ruppert
has been coding java since 1996
Fellow / Senior Manager
reply Group
Germany - Munich
@SvenRuppert
@SvenRuppert 3/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 3/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
@SvenRuppert 4/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 4/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
Since Java8...
.. JavaFX8 is part of the JDK
@SvenRuppert 5/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 5/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
Since Java8...
.. JavaFX8 is part of the JDK
.. you could use it with JDK7, but you have to add it by yourself.
@SvenRuppert 6/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 6/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
Since Java8...
.. JavaFX8 is part of the JDK
.. you could use it with JDK7, but you have to add it by yourself.
BUT:
The switch from JavaFX 2.2 to JavaFX8 could be a lot of work..
@SvenRuppert 7/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 7/164
JavaFX 8 - JumpStart
Intro
Swing was yesterday.... now JavaFX ;-)
Since Java8...
.. JavaFX8 is part of the JDK
.. you could use it with JDK7, but you have to add it by yourself.
BUT:
The switch from JavaFX 2.2 to JavaFX8 could be a lot of work..
for example: Builder-API is now deprecated and a lot of the constructors are
changed.
@SvenRuppert 8/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 8/164
JavaFX 8 - JumpStart
Hello World - only to remember
a simple example with a button and a service...
@SvenRuppert 9/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 9/164
JavaFX 8 - JumpStart
Hello World - only to remember
a simple example with a button and a service...
different ways to implement..
@SvenRuppert 10/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 10/164
JavaFX 8 - JumpStart
Hello World - only to remember
a simple example with a button and a service...
different ways to implement..
.. lets start without fxml
@SvenRuppert 11/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 11/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
public class JavaFXPlain extends Application {
public static void main(String[] args) { launch(args); }
@Override
public void start(Stage primaryStage) {
final AnchorPane rootNode = new AnchorPane();
HBox hBox = new HBox();
final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField();
final Button button = new Button();
button.setText("Ohhh press me..");
button.setOnAction(event -> {
String v1 = tf1.getText(); String v2 = tf2.getText();
int result = valueOf(v1) + valueOf(v2);
tfResult.setText(result+"");
});
hBox.getChildren().addAll(tf1, tf2, button, tfResult);
rootNode.getChildren().add(hBox);
final Scene scene = new Scene(rootNode, 640, 60);
primaryStage.setScene(scene);
primaryStage.show();
}
}
JAVA
12/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 12/164
JavaFX 8 - JumpStart
Hello World - only to remember
Application:
The main class from an JavaFX Application will extend
javafx.application.Application.
@SvenRuppert 13/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 13/164
JavaFX 8 - JumpStart
Hello World - only to remember
Application:
The main class from an JavaFX Application will extend
javafx.application.Application.
Method: start
The start() Method will be the main start-point of the application.
@SvenRuppert 14/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 14/164
JavaFX 8 - JumpStart
Hello World - only to remember
Application:
The main class from an JavaFX Application will extend
javafx.application.Application.
Method: start
The start() Method will be the main start-point of the application.
Stage:
This instance is the top level container for all JavaFX Components
@SvenRuppert 15/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 15/164
JavaFX 8 - JumpStart
Hello World - only to remember
Application:
The main class from an JavaFX Application will extend
javafx.application.Application.
Method: start
The start() Method will be the main start-point of the application.
Stage:
This instance is the top level container for all JavaFX Components
Scene:
This instance will be the container for the your content.
@SvenRuppert 16/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 16/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
public class JavaFXPlain extends Application {
public static void main(String[] args) { launch(args); }
@Override
public void start(Stage primaryStage) {
final AnchorPane rootNode = new AnchorPane();
HBox hBox = new HBox();
final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField();
final Button button = new Button();
button.setText("Ohhh press me..");
button.setOnAction(event -> {
String v1 = tf1.getText(); String v2 = tf2.getText();
int result = valueOf(v1) + valueOf(v2);
tfResult.setText(result+"");
});
hBox.getChildren().addAll(tf1, tf2, button, tfResult);
rootNode.getChildren().add(hBox);
final Scene scene = new Scene(rootNode, 640, 60);
primaryStage.setScene(scene);
primaryStage.show();
}
}
JAVA
17/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 17/164
JavaFX 8 - JumpStart
Hello World - only to remember
oh now..... how to test it ???
@SvenRuppert 18/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 18/164
JavaFX 8 - JumpStart
Hello World - only to remember
oh now..... how to test it ???
we will start with jUnit....
@SvenRuppert 19/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 19/164
JavaFX 8 - JumpStart
Hello World - only to remember
oh now..... how to test it ???
we will start with jUnit....
.. so we have to extract the logic
@SvenRuppert 20/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 20/164
JavaFX 8 - JumpStart
Hello World - only to remember
oh now..... how to test it ???
we will start with jUnit....
.. so we have to extract the logic
@SvenRuppert
publicclassAddService{
publicintadd(inta,intb){returna+b;}
}
JAVA
21/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 21/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
publicclassAddService{
publicintadd(inta,intb){returna+b;}
}
@TestpublicvoidtestAdd001()throwsException{
AddServiceservice=newAddService();
intr=service.add(0,0);
Assert.assertEquals(0,r);
}
JAVA
22/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 22/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
publicclassAddService{
publicintadd(inta,intb){returna+b;}
}
@TestpublicvoidtestAdd001()throwsException{
AddServiceservice=newAddService();
intr=service.add(0,0);
Assert.assertEquals(0,r);
}
publicclassString2Int{
publicintconvert(Strings){returnInteger.valueOf(s);}
}
JAVA
23/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 23/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
public class AddService {
public int add(int a, int b){ return a +b; }
}
@Test public void testAdd001() throws Exception {
AddService service = new AddService();
int r = service.add(0, 0);
Assert.assertEquals(0, r);
}
public class String2Int {
public int convert(String s){ return Integer.valueOf(s); }
}
@Test public void test001() throws Exception {
String2Int s = new String2Int();
int r = s.convert("0");
Assert.assertEquals(r, 0);
}
JAVA
24/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 24/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
@SvenRuppert 25/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 25/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
.. UI with less logic
@SvenRuppert 26/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 26/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
.. UI with less logic
.. we could test the logic with jUnit
@SvenRuppert 27/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 27/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
.. UI with less logic
.. we could test the logic with jUnit
.. we increased the code coverage
@SvenRuppert 28/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 28/164
JavaFX 8 - JumpStart
Hello World - only to remember
What is reached?
.. UI with less logic
.. we could test the logic with jUnit
.. we increased the code coverage
but how much?
@SvenRuppert 29/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 29/164
JavaFX 8 - JumpStart
Hello World - only to remember
@SvenRuppert
private AddService addService = new AddService();
private String2Int string2Int = new String2Int();
public void start(Stage primaryStage) {
final AnchorPane rootNode = new AnchorPane();
HBox hBox = new HBox();
final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField();
final Button button = new Button();
button.setText("Ohhh press me..");
button.setOnAction(event -> {
String v1 = tf1.getText(); String v2 = tf2.getText();
int intA = string2Int.convert(v1); int intB = string2Int.convert(v2);
int result = addService.add(intA, intB);
tfResult.setText(result+"");
});
hBox.getChildren().addAll(tf1, tf2, button, tfResult);
rootNode.getChildren().add(hBox);
final Scene scene = new Scene(rootNode, 640, 60);
primaryStage.setScene(scene);
primaryStage.show();
}
JAVA
30/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 30/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
@SvenRuppert 31/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 31/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
.. how fast are the services?
@SvenRuppert 32/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 32/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
.. how fast are the services?
.. start with microbenchmarks
@SvenRuppert 33/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 33/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
.. how fast are the services?
.. start with microbenchmarks
.. use JMH -> http://openjdk.java.net/projects/code-tools/jmh/
@SvenRuppert 34/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 34/164
JavaFX 8 - JumpStart
Hello World - only to remember
performance is part of TDD
.. how fast are the services?
.. start with microbenchmarks
.. use JMH -> http://openjdk.java.net/projects/code-tools/jmh/
show the code v003 ;-)
@SvenRuppert 35/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 35/164
JavaFX 8 - TestFX
testing - Basics : plain jUnit
@SvenRuppert 36/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 36/164
JavaFX 8 - TestFX
testing - Basics : plain jUnit
testing - Frameworks
@SvenRuppert 37/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 37/164
JavaFX 8 - TestFX
testing - Basics : plain jUnit
testing - Frameworks
testing - (C)DI
@SvenRuppert 38/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 38/164
JavaFX 8 - TestFX
integration tests - including UI ?
@SvenRuppert 39/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 39/164
JavaFX 8 - TestFX
integration tests - including UI ?
but....
@SvenRuppert 40/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 40/164
JavaFX 8 - TestFX
integration tests - including UI ?
but....
unit tests - how to test a UI component
@SvenRuppert 41/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 41/164
JavaFX 8 - TestFX
integration tests - including UI ?
but....
unit tests - how to test a UI component
system tests - how to test an UI workflow
@SvenRuppert 42/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 42/164
JavaFX 8 - TestFX
manual testing
a tester tests the complete app
@SvenRuppert 43/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 43/164
JavaFX 8 - TestFX
manual testing
a tester tests the complete app
create a test plan
@SvenRuppert 44/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 44/164
JavaFX 8 - TestFX
manual testing
a tester tests the complete app
create a test plan
update the test plan for each release
@SvenRuppert 45/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 45/164
JavaFX 8 - TestFX
manual testing
a tester tests the complete app
create a test plan
update the test plan for each release
test each release
@SvenRuppert 46/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 46/164
JavaFX 8 - TestFX
CI / CD
update the test plan for each commit
@SvenRuppert 47/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 47/164
JavaFX 8 - TestFX
CI / CD
update the test plan for each commit
test each commit
@SvenRuppert 48/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 48/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
@SvenRuppert 49/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 49/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
@SvenRuppert 50/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 50/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
developer licence costs around 1995 €
@SvenRuppert 51/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 51/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
developer licence costs around 1995 €
no JUnit approach
@SvenRuppert 52/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 52/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
developer licence costs around 1995 €
no JUnit approach
CI integration
@SvenRuppert 53/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 53/164
JavaFX 8 - TestFX
IDE based Tools like Selenium
QF-Test
commercial product
developer licence costs around 1995 €
no JUnit approach
CI integration
nearly the same as froglogic...
@SvenRuppert 54/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 54/164
JavaFX 8 - TestFX
JemmyFX
is for JavaFX 2.2
last commit is over 2 yearsago
looks like there is no development activity
@SvenRuppert 55/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 55/164
JavaFX 8 - TestFX
JemmyFX
is for JavaFX 2.2
last commit is over 2 yearsago
looks like there is no development activity
Don´t use it
@SvenRuppert 56/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 56/164
JavaFX 8 - TestFX
MarvinFX
https://github.com/guigarage/MarvinFX
Provides Supervisors for JavaFX Properties
@SvenRuppert 57/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 57/164
JavaFX 8 - TestFX
MarvinFX
https://github.com/guigarage/MarvinFX
Provides Supervisors for JavaFX Properties
we (Hendrik Ebbers and Sven) are merging into TestFX
@SvenRuppert 58/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 58/164
JavaFX 8 - TestFX
MarvinFX
https://github.com/guigarage/MarvinFX
Provides Supervisors for JavaFX Properties
we (Hendrik Ebbers and Sven) are merging into TestFX
Don´t use it
@SvenRuppert 59/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 59/164
JavaFX 8 - TestFX
MarvinFX
define
@SvenRuppert
PropertySupervisor<String>textSupervisor=
newPropertySupervisor<>(textfield.textProperty());
JAVA
60/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 60/164
JavaFX 8 - TestFX
MarvinFX
rules
@SvenRuppert
textPropertySupervisor.assertWillChange();
textPropertySupervisor.assertWillChangeByDefinedCount(3);
textPropertySupervisor.assertWillChangeThisWay("A","B","C");
JAVA
61/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 61/164
JavaFX 8 - TestFX
MarvinFX
interaction
//interact with UI by using TestFX
@SvenRuppert 62/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 62/164
JavaFX 8 - TestFX
MarvinFX
check
@SvenRuppert
textPropertySupervisor.confirm(); JAVA
63/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 63/164
JavaFX 8 - TestFX
finally TestFX
active development
LTS branch for Java7 is available
active branch JavaFX8 only
@SvenRuppert 64/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 64/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
@SvenRuppert 65/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 65/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
@SvenRuppert 66/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 66/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
fluent and clean API
@SvenRuppert 67/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 67/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
fluent and clean API
Supports Hamcrest Matchers and Lambda expressions.
@SvenRuppert 68/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 68/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
fluent and clean API
Supports Hamcrest Matchers and Lambda expressions.
Screenshots of failed tests.
@SvenRuppert 69/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 69/164
JavaFX 8 - TestFX
finally TestFX
verifying the behavior of JavaFX applications
API for interacting with JavaFX applications.
fluent and clean API
Supports Hamcrest Matchers and Lambda expressions.
Screenshots of failed tests.
internal used by Oracle for JavaFX
@SvenRuppert 70/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 70/164
JavaFX 8 - TestFX
finally TestFX
start with a Login Screen.
@SvenRuppert 71/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 71/164
JavaFX 8 - TestFX
finally TestFX
start with a Login Screen.
... TextField / Password-Field / Button
@SvenRuppert 72/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 72/164
JavaFX 8 - TestFX
finally TestFX
start with a Login Screen.
... TextField / Password-Field / Button
@SvenRuppert
click(".text-field").type("steve");
click(".password-field").type("duke4ever");
click(".button:default");
assertNodeExists(".dialog");
JAVA
73/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 73/164
JavaFX 8 - TestFX
finally TestFX
each test must extend the GUITest class
@SvenRuppert
publicclassMyTestextendsGuiTest{
@Test
publicvoidtestLogin(){...}
}
JAVA
74/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 74/164
JavaFX 8 - TestFX
finally TestFX
each test must extend the GUITest class
.. and provide the the root node
@SvenRuppert
publicclassMyTestextendsGuiTest{
protectedNodegetRootNode(){..}
@Test
publicvoidtestLogin(){...}
}
JAVA
75/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 75/164
JavaFX 8 - TestFX
finally TestFX
The GuiTest class provides a lot of functions that can be used to interact with
JavaFX
.. and provide the the root node
@SvenRuppert
publicclassMyTestextendsGuiTest{
protectedNodegetRootNode(){..}
@Test
publicvoidtestLogin(){
click(".text-field");
type("steve");
//...
}
}
JAVA
76/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 76/164
JavaFX 8 - TestFX
finally TestFX
ok, how we would do it ?
@SvenRuppert 77/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 77/164
JavaFX 8 - TestFX
finally TestFX
ok, how we would do it ?
..extract a component
@SvenRuppert 78/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 78/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class AddComponent extends HBox {
private Controller controller = new Controller();
final private TextField tf1 = new TextField();
final private TextField tf2 = new TextField();
final private TextField tfResult = new TextField();
final Button button = new Button();
{
tf1.setId("tf1");
tf2.setId("tf2");
tfResult.setId("tfResult");
button.setId("btnAdd");
button.setText("Ohhh press me..");
button.setOnAction(event -> {
String v1 = tf1.getText(); String v2 = tf2.getText();
String result = controller.add(v1, v2);
tfResult.setText(result);
});
this.getChildren().addAll(tf1, tf2, button, tfResult);
}
}
JAVA
79/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 79/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class JavaFXPlain extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
final AnchorPane rootNode = new AnchorPane();
rootNode.getChildren().add(new AddComponent());
final Scene scene = new Scene(rootNode, 640, 60);
primaryStage.setScene(scene);
primaryStage.show();
}
}
JAVA
80/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 80/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
@SvenRuppert 81/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 81/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
@SvenRuppert 82/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 82/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
@SvenRuppert 83/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 83/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
if the Button Action Event is tested -> code coverage is increased
@SvenRuppert 84/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 84/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
if the Button Action Event is tested -> code coverage is increased
.. extend from GUITest
@SvenRuppert 85/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 85/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
if the Button Action Event is tested -> code coverage is increased
.. extend from GUITest
.. create RootNode
@SvenRuppert 86/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 86/164
JavaFX 8 - TestFX
finally TestFX
Controller is tested !
the main class is nearly only pure JDK/JavaFX8
the component AddComponent needs to be tested at the Button Action Event
if the Button Action Event is tested -> code coverage is increased
.. extend from GUITest
.. create RootNode
.. write your tests
@SvenRuppert 87/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 87/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class AddComponentTest extends GuiTest {
@Override
protected Parent getRootNode() {
AddComponent addComponent = new AddComponent();
addComponent.setId("c");
return addComponent;
}
JAVA
88/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 88/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
@Test
public void test001() throws Exception {
Node c = find("#c");
Assert.assertNotNull(c);
TextField tf1 = find("#tf1", c);
TextField tf2 = find("#tf2", c);
clickOn(tf1).write("1");
clickOn(tf2).write("2");
clickOn((Button)find("#btnAdd")).clickOn();
TextField tfResult = find("#tfResult");
Assertions.verifyThat(tfResult, hasText("3"));
Thread.sleep(5_000);
}
JAVA
89/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 89/164
JavaFX 8 - TestFX
finally TestFX
.. and now code and running test -> v004
@SvenRuppert
@Test
public void test001() throws Exception {
Node c = find("#c");
Assert.assertNotNull(c);
TextField tf1 = find("#tf1", c);
TextField tf2 = find("#tf2", c);
clickOn(tf1).write("1");
clickOn(tf2).write("2");
clickOn((Button)find("#btnAdd")).clickOn();
TextField tfResult = find("#tfResult");
Assertions.verifyThat(tfResult, hasText("3"));
Thread.sleep(5_000);
}
JAVA
90/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 90/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
@SvenRuppert 91/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 91/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
@SvenRuppert 92/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 92/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
@SvenRuppert 93/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 93/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
@SvenRuppert 94/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 94/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
.. every Component will have
@SvenRuppert 95/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 95/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
.. every Component will have
.. .. a class called XYZPane
@SvenRuppert 96/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 96/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
.. every Component will have
.. .. a class called XYZPane
.. .. a class called XYZPaneController
@SvenRuppert 97/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 97/164
JavaFX 8 - TestFX
finally TestFX
Now... FXML
.. with FXML you could describe the UI
.. but how ?
Create Components... beginning from the top.
.. every Component will have
.. .. a class called XYZPane
.. .. a class called XYZPaneController
.. .. a file called XYZPane.fxml
@SvenRuppert 98/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 98/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
MainPane root = new MainPane();
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
JAVA
99/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 99/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class BasePane<T> extends AnchorPane {
public T controller;
public BasePane() {
final String fxmlFile = this.getClass().getSimpleName()+".fxml";
FXMLLoader loader = createFXMLLoader(fxmlFile);
controller = loader.getController();
AnchorPane.setBottomAnchor(this, 0.0);
AnchorPane.setTopAnchor(this, 0.0);
AnchorPane.setLeftAnchor(this, 0.0);
AnchorPane.setRightAnchor(this, 0.0);
}
private FXMLLoader createFXMLLoader(final String fxmlFile) {
URL resource = getClass().getResource(fxmlFile);
FXMLLoader loader = new FXMLLoader(resource);
loader.setRoot(this);
try { loader.load(); } catch (IOException e) { e.printStackTrace(); }
return loader;
}
}
JAVA
100/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 100/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class MainPane extends BasePane<MainPaneController> {
public MainPane(){ }
}
JAVA
101/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 101/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
public class MainPane extends BasePane<MainPaneController> {
public MainPane(){ }
}
public class MainPaneController {
@FXML Button btn;
@FXML EditPane editPane;
public MainPaneController() { System.out.println("MainPaneController = OK" ); }
private int counter = 0;
public void onDoSomething(ActionEvent actionEvent){
btn.setText("Main pressed " + counter);
counter = counter +1;
//label from Edit changing
editPane.setLabelText();
}
}
JAVA
102/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 102/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import org.rapidpm.demo.jdkio2015.v005.fx.main.edit.EditPane?>
<fx:root type="org.rapidpm.demo.jdkio2015.v005.fx.main.MainPane"
fx:controller="org.rapidpm.demo.jdkio2015.v005.fx.main.MainPaneController"
xmlns:fx="http://javafx.com/fxml"
fx:id="mainPane" >
<!--style="-fx-scale-x: 4; -fx-scale-y: 4"-->
<VBox>
<Label fx:id="lb" text="Hello World"/>
<Button fx:id="btn" onAction="#onDoSomething" text="Main Button"/>
<EditPane fx:id="editPane"/>
</VBox>
</fx:root>
JAVA
103/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 103/164
JavaFX 8 - TestFX
finally TestFX
@SvenRuppert
@Override
protected Parent getRootNode() {
return new MainPane();
}
@Test
public void testMainButton01() throws Exception {
final Label lbMain = find("#lb");
Assert.assertNotNull(lbMain);
Assertions.verifyThat(lbMain, hasText("Hello World"));
final Button btnMain = find("#btn");
Assert.assertNotNull(btnMain);
Assertions.verifyThat(btnMain, hasText("Main Button"));
final EditPane editPane = find("#editPane");
Assert.assertNotNull(editPane);
}
JAVA
104/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 104/164
Why CDI
why CDI ? ;-)
@SvenRuppert 105/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 105/164
Why CDI
we want to get rid of hard connections
@SvenRuppert 106/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 106/164
Why CDI
we want to get rid of hard connections
Have a look at the definition of a List. List will be the return value -> List.
@SvenRuppert
publicList<Data>execute(){...}; JAVA
107/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 107/164
Why CDI
the caller of the method dont know if it is an ArrayList or LinkedList... but
@SvenRuppert
importjava.util.List;
importjava.util.ArrayList;
publicList<Data>execute(){
finalList<Data>result=newArrayList<>();
//....
returnresult;
}
JAVA
108/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 108/164
Why CDI
the caller of the method dont know if it is an ArrayList or LinkedList... but
.. inside the method you will have a static ref to ArrayList
@SvenRuppert
importjava.util.List;
importjava.util.ArrayList;
publicList<Data>execute(){
finalList<Data>result=newArrayList<>();
//....
returnresult;
}
JAVA
109/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 109/164
Why CDI
if you are not using a special method from ArrayList ... -> trimToSize()
@SvenRuppert 110/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 110/164
Why CDI
if you are not using a special method from ArrayList ... -> trimToSize()
Why not get rid of the static ref ??
@SvenRuppert 111/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 111/164
Why CDI
if you are not using a special method from ArrayList ... -> trimToSize()
Why not get rid of the static ref ??
Maybe at runtime a LinkedList would be better.. we dont want to compile all
again..
@SvenRuppert 112/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 112/164
Why CDI
if you are not using a special method from ArrayList ... -> trimToSize()
Why not get rid of the static ref ??
Maybe at runtime a LinkedList would be better.. we dont want to compile all
again..
ok, we could use Factories..
@SvenRuppert 113/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 113/164
Why CDI
we are using plain SE
.. an example of a factory implementation
@SvenRuppert
importjava.util.ArrayList;
importjava.util.LinkedList;
importjava.util.List;
publicclassListFactory{
publicListcreateArrayList() {returnnewArrayList();}
publicListcreateLinkedList(){returnnewLinkedList();}
publicListcreateList() {returnnewArrayList();}
}
JAVA
114/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 114/164
Why CDI
Do we have something better reached?
@SvenRuppert 115/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 115/164
Why CDI
Do we have something better reached?
the developers in your project are using this factory...
@SvenRuppert 116/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 116/164
Why CDI
Do we have something better reached?
the developers in your project are using this factory... if they will know that there
is a factory ;-)
@SvenRuppert 117/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 117/164
Why CDI
@SvenRuppert
importjava.util.List;
importjava.util.ArrayList;
publicList<Data>execute(){
finalList<Data>result=newArrayList<>();
//....
returnresult;
}
JAVA
118/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 118/164
Why CDI
@SvenRuppert
importjava.util.List;
importjava.util.ArrayList;
publicList<Data>execute(){
finalList<Data>result=newArrayList<>();
//....
returnresult;
}
importjava.util.List;
importorg.rapidpm.demo.ListFactory;
publicList<Data>execute(){
finalListlist=newListFactory().createArrayList();
//....
returnresult;
}
JAVA
119/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 119/164
Why CDI
ok, no static ref to ArrayList..
@SvenRuppert 120/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 120/164
Why CDI
ok, no static ref to ArrayList..
but we have a static ref to the factory method
@SvenRuppert 121/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 121/164
Why CDI
ok, no static ref to ArrayList..
but we have a static ref to the factory method
The implementation of the ListFactory itself will have all ref to all
implementations
@SvenRuppert 122/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 122/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
@SvenRuppert 123/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 123/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
@SvenRuppert
importjava.util.ArrayList;
importjava.util.LinkedList;
importjava.util.List;
importorg.rapidpm.demo.cdi.commons.registry.ContextResolver;
publicclassListFactory{
publicListcreateList(finalContextResolvercontextResolver){
if(contextResolver==null){returncreateArrayList();}
else{
if(contextResolver.resolveContext()){returncreateArrayList();}
else{returncreateLinkedList();}
}
}
}
JAVA
124/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 124/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
the complexity is now -> ContextResolver
@SvenRuppert 125/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 125/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
the complexity is now -> ContextResolver
Added dep to the ContextResolver
@SvenRuppert 126/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 126/164
Solution Nr 1
based on Java SE
a little bit more dynamic..
the complexity is now -> ContextResolver
Added dep to the ContextResolver
you got: at runtime you could switch the implementation
@SvenRuppert 127/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 127/164
Solution Nr 1
based on Java SE
if you want to get rid of the deps inside the factory.. create a registry
@SvenRuppert 128/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 128/164
Solution Nr 1
based on Java SE
if you want to get rid of the deps inside the factory.. create a registry
at runtime you could register / unregister implemenattaions..
@SvenRuppert 129/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 129/164
Solution Nr 1
based on Java SE
if you want to get rid of the deps inside the factory.. create a registry
at runtime you could register / unregister implemenattaions..
CDI will help...
@SvenRuppert 130/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 130/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert 131/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 131/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@InjectListlist; JAVA
132/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 132/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@Inject@CDILegacyTestListlist; JAVA
133/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 133/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@Inject@CDILegacyTestListlist;
@Produces@CDILegacyTest
publicListcreateList(...){...}
JAVA
134/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 134/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@Inject@CDILegacyTestListlist;
@Produces@CDILegacyTest
publicListcreateList(InjectionPointinjectionPoint,
BeanManagerbeanManager,ContextResolvercontextResolver){
....
}
JAVA
135/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 135/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
@SvenRuppert
@Inject@CDILegacyTestListlist;
@Produces@CDILegacyTest
publicListcreateList(InjectionPointinjectionPoint,
BeanManagerbeanManager,ContextResolvercontextResolver){
booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen...
if(b){returnnewLinkedList();}else{returnnewArrayList();}
}
JAVA
136/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 136/164
finally CDI ;-)
based on Weld / WELD-SE
instances are given from the container via @Inject
the time to create the instance is to early..
@SvenRuppert
@Inject@CDILegacyTestListlist;
@Produces@CDILegacyTest
publicListcreateList(InjectionPointinjectionPoint,
BeanManagerbeanManager,ContextResolvercontextResolver){
booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen...
if(b){returnnewLinkedList();}else{returnnewArrayList();}
}
JAVA
137/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 137/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
@SvenRuppert 138/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 138/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
decide as late as possible
@SvenRuppert 139/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 139/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
decide as late as possible
@SvenRuppert
@Inject@CDILegacyTestInstance<List>listInstance; JAVA
140/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 140/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
decide as late as possible
@SvenRuppert
@Inject@CDILegacyTestInstance<List>listInstance;
//..später
finalListlist=listInstance.get();
JAVA
141/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 141/164
finally CDI ;-)
based on Weld / WELD-SE
but it could be done at runtime..
decide as late as possible
@SvenRuppert
@Inject@CDILegacyTestInstance<List>listInstance;
//..später
finalListlist=listInstance.get();
@Produces@CDILegacyTest
publicListcreateList(InjectionPointinjectionPoint,
BeanManagerbeanManager,ContextResolvercontextResolver){
booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen...
if(b){returnnewLinkedList();}else{returnnewArrayList();}
}
JAVA
142/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 142/164
finally CDI ;-)
based on Weld / WELD-SE
static bound via AnnotationsLiteral:
@SvenRuppert
@Inject@MyQualifierListliste; JAVA
143/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 143/164
finally CDI ;-)
based on Weld / WELD-SE
static bound via AnnotationsLiteral:
Generics are not well supported
@SvenRuppert
@Inject@MyQualifierListliste; JAVA
144/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 144/164
finally CDI ;-)
based on Weld / WELD-SE
static bound via AnnotationsLiteral:
Generics are not well supported
but still complex to use
@SvenRuppert
@Inject@MyQualifierListliste; JAVA
145/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 145/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
146/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 146/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
147/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 147/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
148/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 148/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
@Producer@CDILoggerLoggercreate(..){
AnnotationsLiteralprodAL=contextResolver.resolve(..);
};
JAVA
149/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 149/164
CDI explained by code
Qualifier und AnnotationsLiterale
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
@Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){
AnnotationsLiteralprodAL=contextResolver.resolve(..);
returncreator.getManagedInstance(Logger.class,annotationLiteral);
};
JAVA
150/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 150/164
CDI explained by code
Qualifier und AnnotationsLiterale
you will get a dynamic AnnotationLiteral
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
@Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){
AnnotationsLiteralprodAL=contextResolver.resolve(..);
returncreator.getManagedInstance(Logger.class,annotationLiteral);
};
JAVA
151/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 151/164
CDI explained by code
Qualifier und AnnotationsLiterale
you will get a dynamic AnnotationLiteral
AnnotationsLiteral and class -> select the Producers
@SvenRuppert
@Inject@CDILoggerLoggerlogger; JAVA
@Producer@CDILoggerLoggercreate(...); JAVA
@Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){
AnnotationsLiteralprodAL=contextResolver.resolve(..);
returncreator.getManagedInstance(Logger.class,annotationLiteral);
};
JAVA
152/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 152/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
@SvenRuppert 153/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 153/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
@SvenRuppert 154/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 154/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
@SvenRuppert 155/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 155/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
@SvenRuppert 156/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 156/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
@SvenRuppert 157/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 157/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
injection over a few steps is working
@SvenRuppert 158/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 158/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
injection over a few steps is working
postconstruct is working
@SvenRuppert 159/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 159/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
injection over a few steps is working
postconstruct is working
using existing CDI Services with Annotations (Scopes and so on) is not working with afterburner
@SvenRuppert 160/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 160/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner ...
apache licensed
as lean as possible: 3 classes, no external dependencies
combines: FXML, Convention over Configuration and JSR-330 / @Inject
integrated with maven 3
under active development
injection over a few steps is working
postconstruct is working
using existing CDI Services with Annotations (Scopes and so on) is not working with afterburner
no mixed mode with CDI and afterburner.fx
@SvenRuppert 161/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 161/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with afterburner.fx ... show the code ..
@SvenRuppert 162/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 162/164
CDI explained by code
Qualifier und AnnotationsLiterale
Now... JavaFX with CDI bootstrap ... code only..
@SvenRuppert 163/165
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 163/164
@SvenRuppert
http://www.rapidpm.org // http://www.codecentric.de
(privater) Tech - Newsletter -> Core Java, Reflection, IoT, uvm
Bei Interesse bitte bei mir eintragen -> plain old Zettel ;-)
g+: www.google.com/+SvenRuppert
github : github.com/svenruppert
20.10.2015 JavaFX8 - TestFX - CDI - JUG
http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 164/164
<Thank You!>
g+ www.google.com/+SvenRuppert
twitter @SvenRuppert
www www.rapidpm.org
github github.com/svenruppert

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Izumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala StackIzumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala Stack
 
Hyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkitHyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkit
 
ScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency InjectionScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency Injection
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 
Unit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma introUnit testing JavaScript: Jasmine & karma intro
Unit testing JavaScript: Jasmine & karma intro
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introduction
 
Testing React Applications
Testing React ApplicationsTesting React Applications
Testing React Applications
 
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
 
JavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and KarmaJavaScript TDD with Jasmine and Karma
JavaScript TDD with Jasmine and Karma
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmine
 
Unit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and KarmaUnit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and Karma
 
Jquery- One slide completing all JQuery
Jquery- One slide completing all JQueryJquery- One slide completing all JQuery
Jquery- One slide completing all JQuery
 
AngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and JasmineAngularJS Unit Testing w/Karma and Jasmine
AngularJS Unit Testing w/Karma and Jasmine
 
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma JavaScript Test-Driven Development with Jasmine 2.0 and Karma
JavaScript Test-Driven Development with Jasmine 2.0 and Karma
 
Intro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJSIntro to Unit Testing in AngularJS
Intro to Unit Testing in AngularJS
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 

Semelhante a JavaFX8 TestFX - CDI

02 servlet-basics
02 servlet-basics02 servlet-basics
02 servlet-basics
snopteck
 
Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1
rajivmordani
 
Introduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry PiIntroduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry Pi
Bruno Borges
 
Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011
Anton Arhipov
 

Semelhante a JavaFX8 TestFX - CDI (20)

Java11 New Features
Java11 New FeaturesJava11 New Features
Java11 New Features
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
Pimp My Java LavaJUG
Pimp My Java LavaJUGPimp My Java LavaJUG
Pimp My Java LavaJUG
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Java7
Java7Java7
Java7
 
02 servlet-basics
02 servlet-basics02 servlet-basics
02 servlet-basics
 
JavaFX Overview
JavaFX OverviewJavaFX Overview
JavaFX Overview
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Introduction to JavaFX
Introduction to JavaFXIntroduction to JavaFX
Introduction to JavaFX
 
Java util concurrent
Java util concurrentJava util concurrent
Java util concurrent
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1
 
Building non-blocking JavaFX 8 applications with JacpFX [CON1823]
Building non-blocking JavaFX 8 applications with JacpFX [CON1823]Building non-blocking JavaFX 8 applications with JacpFX [CON1823]
Building non-blocking JavaFX 8 applications with JacpFX [CON1823]
 
Rcp by example
Rcp by exampleRcp by example
Rcp by example
 
Java 12 - New features in action
Java 12 -   New features in actionJava 12 -   New features in action
Java 12 - New features in action
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
Introduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry PiIntroduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry Pi
 
Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011Java Bytecode For Discriminating Developers - GeeCON 2011
Java Bytecode For Discriminating Developers - GeeCON 2011
 

Mais de Sven Ruppert

Mais de Sven Ruppert (16)

JUnit5 Custom TestEngines intro - version 2020-06
JUnit5 Custom TestEngines intro - version 2020-06JUnit5 Custom TestEngines intro - version 2020-06
JUnit5 Custom TestEngines intro - version 2020-06
 
Hidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-PersistenceHidden pearls for High-Performance-Persistence
Hidden pearls for High-Performance-Persistence
 
Vaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java DevsVaadin Flow - How to start - a short intro for Java Devs
Vaadin Flow - How to start - a short intro for Java Devs
 
Functional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed MelbourneFunctional Reactive With Core Java - Voxxed Melbourne
Functional Reactive With Core Java - Voxxed Melbourne
 
Functional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - SlidesFunctional Reactive with Core Java - Workshop - Slides
Functional Reactive with Core Java - Workshop - Slides
 
Functional reactive-talk 20170301-001
Functional reactive-talk 20170301-001Functional reactive-talk 20170301-001
Functional reactive-talk 20170301-001
 
From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017
 
From Jurassic Park to Microservices
From Jurassic Park to MicroservicesFrom Jurassic Park to Microservices
From Jurassic Park to Microservices
 
From jUnit to Mutationtesting
From jUnit to MutationtestingFrom jUnit to Mutationtesting
From jUnit to Mutationtesting
 
DI Frameworks - hidden pearls
DI Frameworks - hidden pearlsDI Frameworks - hidden pearls
DI Frameworks - hidden pearls
 
Warum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi steheWarum ich so auf das c von cdi stehe
Warum ich so auf das c von cdi stehe
 
Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001
 
Java8 ready for the future
Java8 ready for the futureJava8 ready for the future
Java8 ready for the future
 
Java FX8 JumpStart - JUG ch - zürich
Java FX8   JumpStart - JUG ch - zürichJava FX8   JumpStart - JUG ch - zürich
Java FX8 JumpStart - JUG ch - zürich
 
Proxy Deep Dive JUG Saxony Day 2015-10-02
Proxy Deep Dive JUG Saxony Day 2015-10-02Proxy Deep Dive JUG Saxony Day 2015-10-02
Proxy Deep Dive JUG Saxony Day 2015-10-02
 
Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015Proxy Deep Dive Voxxed Belgrad 2015
Proxy Deep Dive Voxxed Belgrad 2015
 

Último

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Último (20)

%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 

JavaFX8 TestFX - CDI

  • 1. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 2/164 Sven Ruppert has been coding java since 1996 Fellow / Senior Manager reply Group Germany - Munich @SvenRuppert @SvenRuppert 3/165
  • 2. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 3/164 JavaFX 8 - JumpStart Intro Swing was yesterday.... now JavaFX ;-) @SvenRuppert 4/165
  • 3. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 4/164 JavaFX 8 - JumpStart Intro Swing was yesterday.... now JavaFX ;-) Since Java8... .. JavaFX8 is part of the JDK @SvenRuppert 5/165
  • 4. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 5/164 JavaFX 8 - JumpStart Intro Swing was yesterday.... now JavaFX ;-) Since Java8... .. JavaFX8 is part of the JDK .. you could use it with JDK7, but you have to add it by yourself. @SvenRuppert 6/165
  • 5. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 6/164 JavaFX 8 - JumpStart Intro Swing was yesterday.... now JavaFX ;-) Since Java8... .. JavaFX8 is part of the JDK .. you could use it with JDK7, but you have to add it by yourself. BUT: The switch from JavaFX 2.2 to JavaFX8 could be a lot of work.. @SvenRuppert 7/165
  • 6. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 7/164 JavaFX 8 - JumpStart Intro Swing was yesterday.... now JavaFX ;-) Since Java8... .. JavaFX8 is part of the JDK .. you could use it with JDK7, but you have to add it by yourself. BUT: The switch from JavaFX 2.2 to JavaFX8 could be a lot of work.. for example: Builder-API is now deprecated and a lot of the constructors are changed. @SvenRuppert 8/165
  • 7. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 8/164 JavaFX 8 - JumpStart Hello World - only to remember a simple example with a button and a service... @SvenRuppert 9/165
  • 8. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 9/164 JavaFX 8 - JumpStart Hello World - only to remember a simple example with a button and a service... different ways to implement.. @SvenRuppert 10/165
  • 9. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 10/164 JavaFX 8 - JumpStart Hello World - only to remember a simple example with a button and a service... different ways to implement.. .. lets start without fxml @SvenRuppert 11/165
  • 10. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 11/164 JavaFX 8 - JumpStart Hello World - only to remember @SvenRuppert public class JavaFXPlain extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { final AnchorPane rootNode = new AnchorPane(); HBox hBox = new HBox(); final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField(); final Button button = new Button(); button.setText("Ohhh press me.."); button.setOnAction(event -> { String v1 = tf1.getText(); String v2 = tf2.getText(); int result = valueOf(v1) + valueOf(v2); tfResult.setText(result+""); }); hBox.getChildren().addAll(tf1, tf2, button, tfResult); rootNode.getChildren().add(hBox); final Scene scene = new Scene(rootNode, 640, 60); primaryStage.setScene(scene); primaryStage.show(); } } JAVA 12/165
  • 11. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 12/164 JavaFX 8 - JumpStart Hello World - only to remember Application: The main class from an JavaFX Application will extend javafx.application.Application. @SvenRuppert 13/165
  • 12. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 13/164 JavaFX 8 - JumpStart Hello World - only to remember Application: The main class from an JavaFX Application will extend javafx.application.Application. Method: start The start() Method will be the main start-point of the application. @SvenRuppert 14/165
  • 13. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 14/164 JavaFX 8 - JumpStart Hello World - only to remember Application: The main class from an JavaFX Application will extend javafx.application.Application. Method: start The start() Method will be the main start-point of the application. Stage: This instance is the top level container for all JavaFX Components @SvenRuppert 15/165
  • 14. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 15/164 JavaFX 8 - JumpStart Hello World - only to remember Application: The main class from an JavaFX Application will extend javafx.application.Application. Method: start The start() Method will be the main start-point of the application. Stage: This instance is the top level container for all JavaFX Components Scene: This instance will be the container for the your content. @SvenRuppert 16/165
  • 15. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 16/164 JavaFX 8 - JumpStart Hello World - only to remember @SvenRuppert public class JavaFXPlain extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { final AnchorPane rootNode = new AnchorPane(); HBox hBox = new HBox(); final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField(); final Button button = new Button(); button.setText("Ohhh press me.."); button.setOnAction(event -> { String v1 = tf1.getText(); String v2 = tf2.getText(); int result = valueOf(v1) + valueOf(v2); tfResult.setText(result+""); }); hBox.getChildren().addAll(tf1, tf2, button, tfResult); rootNode.getChildren().add(hBox); final Scene scene = new Scene(rootNode, 640, 60); primaryStage.setScene(scene); primaryStage.show(); } } JAVA 17/165
  • 16. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 17/164 JavaFX 8 - JumpStart Hello World - only to remember oh now..... how to test it ??? @SvenRuppert 18/165
  • 17. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 18/164 JavaFX 8 - JumpStart Hello World - only to remember oh now..... how to test it ??? we will start with jUnit.... @SvenRuppert 19/165
  • 18. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 19/164 JavaFX 8 - JumpStart Hello World - only to remember oh now..... how to test it ??? we will start with jUnit.... .. so we have to extract the logic @SvenRuppert 20/165
  • 19. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 20/164 JavaFX 8 - JumpStart Hello World - only to remember oh now..... how to test it ??? we will start with jUnit.... .. so we have to extract the logic @SvenRuppert publicclassAddService{ publicintadd(inta,intb){returna+b;} } JAVA 21/165
  • 20. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 21/164 JavaFX 8 - JumpStart Hello World - only to remember @SvenRuppert publicclassAddService{ publicintadd(inta,intb){returna+b;} } @TestpublicvoidtestAdd001()throwsException{ AddServiceservice=newAddService(); intr=service.add(0,0); Assert.assertEquals(0,r); } JAVA 22/165
  • 21. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 22/164 JavaFX 8 - JumpStart Hello World - only to remember @SvenRuppert publicclassAddService{ publicintadd(inta,intb){returna+b;} } @TestpublicvoidtestAdd001()throwsException{ AddServiceservice=newAddService(); intr=service.add(0,0); Assert.assertEquals(0,r); } publicclassString2Int{ publicintconvert(Strings){returnInteger.valueOf(s);} } JAVA 23/165
  • 22. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 23/164 JavaFX 8 - JumpStart Hello World - only to remember @SvenRuppert public class AddService { public int add(int a, int b){ return a +b; } } @Test public void testAdd001() throws Exception { AddService service = new AddService(); int r = service.add(0, 0); Assert.assertEquals(0, r); } public class String2Int { public int convert(String s){ return Integer.valueOf(s); } } @Test public void test001() throws Exception { String2Int s = new String2Int(); int r = s.convert("0"); Assert.assertEquals(r, 0); } JAVA 24/165
  • 23. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 24/164 JavaFX 8 - JumpStart Hello World - only to remember What is reached? @SvenRuppert 25/165
  • 24. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 25/164 JavaFX 8 - JumpStart Hello World - only to remember What is reached? .. UI with less logic @SvenRuppert 26/165
  • 25. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 26/164 JavaFX 8 - JumpStart Hello World - only to remember What is reached? .. UI with less logic .. we could test the logic with jUnit @SvenRuppert 27/165
  • 26. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 27/164 JavaFX 8 - JumpStart Hello World - only to remember What is reached? .. UI with less logic .. we could test the logic with jUnit .. we increased the code coverage @SvenRuppert 28/165
  • 27. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 28/164 JavaFX 8 - JumpStart Hello World - only to remember What is reached? .. UI with less logic .. we could test the logic with jUnit .. we increased the code coverage but how much? @SvenRuppert 29/165
  • 28. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 29/164 JavaFX 8 - JumpStart Hello World - only to remember @SvenRuppert private AddService addService = new AddService(); private String2Int string2Int = new String2Int(); public void start(Stage primaryStage) { final AnchorPane rootNode = new AnchorPane(); HBox hBox = new HBox(); final TextField tf1 = new TextField(), tf2 = new TextField(), tfResult = new TextField(); final Button button = new Button(); button.setText("Ohhh press me.."); button.setOnAction(event -> { String v1 = tf1.getText(); String v2 = tf2.getText(); int intA = string2Int.convert(v1); int intB = string2Int.convert(v2); int result = addService.add(intA, intB); tfResult.setText(result+""); }); hBox.getChildren().addAll(tf1, tf2, button, tfResult); rootNode.getChildren().add(hBox); final Scene scene = new Scene(rootNode, 640, 60); primaryStage.setScene(scene); primaryStage.show(); } JAVA 30/165
  • 29. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 30/164 JavaFX 8 - JumpStart Hello World - only to remember performance is part of TDD @SvenRuppert 31/165
  • 30. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 31/164 JavaFX 8 - JumpStart Hello World - only to remember performance is part of TDD .. how fast are the services? @SvenRuppert 32/165
  • 31. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 32/164 JavaFX 8 - JumpStart Hello World - only to remember performance is part of TDD .. how fast are the services? .. start with microbenchmarks @SvenRuppert 33/165
  • 32. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 33/164 JavaFX 8 - JumpStart Hello World - only to remember performance is part of TDD .. how fast are the services? .. start with microbenchmarks .. use JMH -> http://openjdk.java.net/projects/code-tools/jmh/ @SvenRuppert 34/165
  • 33. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 34/164 JavaFX 8 - JumpStart Hello World - only to remember performance is part of TDD .. how fast are the services? .. start with microbenchmarks .. use JMH -> http://openjdk.java.net/projects/code-tools/jmh/ show the code v003 ;-) @SvenRuppert 35/165
  • 34. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 35/164 JavaFX 8 - TestFX testing - Basics : plain jUnit @SvenRuppert 36/165
  • 35. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 36/164 JavaFX 8 - TestFX testing - Basics : plain jUnit testing - Frameworks @SvenRuppert 37/165
  • 36. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 37/164 JavaFX 8 - TestFX testing - Basics : plain jUnit testing - Frameworks testing - (C)DI @SvenRuppert 38/165
  • 37. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 38/164 JavaFX 8 - TestFX integration tests - including UI ? @SvenRuppert 39/165
  • 38. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 39/164 JavaFX 8 - TestFX integration tests - including UI ? but.... @SvenRuppert 40/165
  • 39. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 40/164 JavaFX 8 - TestFX integration tests - including UI ? but.... unit tests - how to test a UI component @SvenRuppert 41/165
  • 40. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 41/164 JavaFX 8 - TestFX integration tests - including UI ? but.... unit tests - how to test a UI component system tests - how to test an UI workflow @SvenRuppert 42/165
  • 41. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 42/164 JavaFX 8 - TestFX manual testing a tester tests the complete app @SvenRuppert 43/165
  • 42. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 43/164 JavaFX 8 - TestFX manual testing a tester tests the complete app create a test plan @SvenRuppert 44/165
  • 43. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 44/164 JavaFX 8 - TestFX manual testing a tester tests the complete app create a test plan update the test plan for each release @SvenRuppert 45/165
  • 44. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 45/164 JavaFX 8 - TestFX manual testing a tester tests the complete app create a test plan update the test plan for each release test each release @SvenRuppert 46/165
  • 45. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 46/164 JavaFX 8 - TestFX CI / CD update the test plan for each commit @SvenRuppert 47/165
  • 46. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 47/164 JavaFX 8 - TestFX CI / CD update the test plan for each commit test each commit @SvenRuppert 48/165
  • 47. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 48/164 JavaFX 8 - TestFX IDE based Tools like Selenium QF-Test @SvenRuppert 49/165
  • 48. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 49/164 JavaFX 8 - TestFX IDE based Tools like Selenium QF-Test commercial product @SvenRuppert 50/165
  • 49. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 50/164 JavaFX 8 - TestFX IDE based Tools like Selenium QF-Test commercial product developer licence costs around 1995 € @SvenRuppert 51/165
  • 50. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 51/164 JavaFX 8 - TestFX IDE based Tools like Selenium QF-Test commercial product developer licence costs around 1995 € no JUnit approach @SvenRuppert 52/165
  • 51. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 52/164 JavaFX 8 - TestFX IDE based Tools like Selenium QF-Test commercial product developer licence costs around 1995 € no JUnit approach CI integration @SvenRuppert 53/165
  • 52. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 53/164 JavaFX 8 - TestFX IDE based Tools like Selenium QF-Test commercial product developer licence costs around 1995 € no JUnit approach CI integration nearly the same as froglogic... @SvenRuppert 54/165
  • 53. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 54/164 JavaFX 8 - TestFX JemmyFX is for JavaFX 2.2 last commit is over 2 yearsago looks like there is no development activity @SvenRuppert 55/165
  • 54. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 55/164 JavaFX 8 - TestFX JemmyFX is for JavaFX 2.2 last commit is over 2 yearsago looks like there is no development activity Don´t use it @SvenRuppert 56/165
  • 55. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 56/164 JavaFX 8 - TestFX MarvinFX https://github.com/guigarage/MarvinFX Provides Supervisors for JavaFX Properties @SvenRuppert 57/165
  • 56. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 57/164 JavaFX 8 - TestFX MarvinFX https://github.com/guigarage/MarvinFX Provides Supervisors for JavaFX Properties we (Hendrik Ebbers and Sven) are merging into TestFX @SvenRuppert 58/165
  • 57. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 58/164 JavaFX 8 - TestFX MarvinFX https://github.com/guigarage/MarvinFX Provides Supervisors for JavaFX Properties we (Hendrik Ebbers and Sven) are merging into TestFX Don´t use it @SvenRuppert 59/165
  • 58. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 59/164 JavaFX 8 - TestFX MarvinFX define @SvenRuppert PropertySupervisor<String>textSupervisor= newPropertySupervisor<>(textfield.textProperty()); JAVA 60/165
  • 59. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 60/164 JavaFX 8 - TestFX MarvinFX rules @SvenRuppert textPropertySupervisor.assertWillChange(); textPropertySupervisor.assertWillChangeByDefinedCount(3); textPropertySupervisor.assertWillChangeThisWay("A","B","C"); JAVA 61/165
  • 60. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 61/164 JavaFX 8 - TestFX MarvinFX interaction //interact with UI by using TestFX @SvenRuppert 62/165
  • 61. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 62/164 JavaFX 8 - TestFX MarvinFX check @SvenRuppert textPropertySupervisor.confirm(); JAVA 63/165
  • 62. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 63/164 JavaFX 8 - TestFX finally TestFX active development LTS branch for Java7 is available active branch JavaFX8 only @SvenRuppert 64/165
  • 63. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 64/164 JavaFX 8 - TestFX finally TestFX verifying the behavior of JavaFX applications @SvenRuppert 65/165
  • 64. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 65/164 JavaFX 8 - TestFX finally TestFX verifying the behavior of JavaFX applications API for interacting with JavaFX applications. @SvenRuppert 66/165
  • 65. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 66/164 JavaFX 8 - TestFX finally TestFX verifying the behavior of JavaFX applications API for interacting with JavaFX applications. fluent and clean API @SvenRuppert 67/165
  • 66. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 67/164 JavaFX 8 - TestFX finally TestFX verifying the behavior of JavaFX applications API for interacting with JavaFX applications. fluent and clean API Supports Hamcrest Matchers and Lambda expressions. @SvenRuppert 68/165
  • 67. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 68/164 JavaFX 8 - TestFX finally TestFX verifying the behavior of JavaFX applications API for interacting with JavaFX applications. fluent and clean API Supports Hamcrest Matchers and Lambda expressions. Screenshots of failed tests. @SvenRuppert 69/165
  • 68. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 69/164 JavaFX 8 - TestFX finally TestFX verifying the behavior of JavaFX applications API for interacting with JavaFX applications. fluent and clean API Supports Hamcrest Matchers and Lambda expressions. Screenshots of failed tests. internal used by Oracle for JavaFX @SvenRuppert 70/165
  • 69. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 70/164 JavaFX 8 - TestFX finally TestFX start with a Login Screen. @SvenRuppert 71/165
  • 70. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 71/164 JavaFX 8 - TestFX finally TestFX start with a Login Screen. ... TextField / Password-Field / Button @SvenRuppert 72/165
  • 71. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 72/164 JavaFX 8 - TestFX finally TestFX start with a Login Screen. ... TextField / Password-Field / Button @SvenRuppert click(".text-field").type("steve"); click(".password-field").type("duke4ever"); click(".button:default"); assertNodeExists(".dialog"); JAVA 73/165
  • 72. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 73/164 JavaFX 8 - TestFX finally TestFX each test must extend the GUITest class @SvenRuppert publicclassMyTestextendsGuiTest{ @Test publicvoidtestLogin(){...} } JAVA 74/165
  • 73. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 74/164 JavaFX 8 - TestFX finally TestFX each test must extend the GUITest class .. and provide the the root node @SvenRuppert publicclassMyTestextendsGuiTest{ protectedNodegetRootNode(){..} @Test publicvoidtestLogin(){...} } JAVA 75/165
  • 74. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 75/164 JavaFX 8 - TestFX finally TestFX The GuiTest class provides a lot of functions that can be used to interact with JavaFX .. and provide the the root node @SvenRuppert publicclassMyTestextendsGuiTest{ protectedNodegetRootNode(){..} @Test publicvoidtestLogin(){ click(".text-field"); type("steve"); //... } } JAVA 76/165
  • 75. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 76/164 JavaFX 8 - TestFX finally TestFX ok, how we would do it ? @SvenRuppert 77/165
  • 76. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 77/164 JavaFX 8 - TestFX finally TestFX ok, how we would do it ? ..extract a component @SvenRuppert 78/165
  • 77. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 78/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert public class AddComponent extends HBox { private Controller controller = new Controller(); final private TextField tf1 = new TextField(); final private TextField tf2 = new TextField(); final private TextField tfResult = new TextField(); final Button button = new Button(); { tf1.setId("tf1"); tf2.setId("tf2"); tfResult.setId("tfResult"); button.setId("btnAdd"); button.setText("Ohhh press me.."); button.setOnAction(event -> { String v1 = tf1.getText(); String v2 = tf2.getText(); String result = controller.add(v1, v2); tfResult.setText(result); }); this.getChildren().addAll(tf1, tf2, button, tfResult); } } JAVA 79/165
  • 78. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 79/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert public class JavaFXPlain extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { final AnchorPane rootNode = new AnchorPane(); rootNode.getChildren().add(new AddComponent()); final Scene scene = new Scene(rootNode, 640, 60); primaryStage.setScene(scene); primaryStage.show(); } } JAVA 80/165
  • 79. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 80/164 JavaFX 8 - TestFX finally TestFX Controller is tested ! @SvenRuppert 81/165
  • 80. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 81/164 JavaFX 8 - TestFX finally TestFX Controller is tested ! the main class is nearly only pure JDK/JavaFX8 @SvenRuppert 82/165
  • 81. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 82/164 JavaFX 8 - TestFX finally TestFX Controller is tested ! the main class is nearly only pure JDK/JavaFX8 the component AddComponent needs to be tested at the Button Action Event @SvenRuppert 83/165
  • 82. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 83/164 JavaFX 8 - TestFX finally TestFX Controller is tested ! the main class is nearly only pure JDK/JavaFX8 the component AddComponent needs to be tested at the Button Action Event if the Button Action Event is tested -> code coverage is increased @SvenRuppert 84/165
  • 83. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 84/164 JavaFX 8 - TestFX finally TestFX Controller is tested ! the main class is nearly only pure JDK/JavaFX8 the component AddComponent needs to be tested at the Button Action Event if the Button Action Event is tested -> code coverage is increased .. extend from GUITest @SvenRuppert 85/165
  • 84. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 85/164 JavaFX 8 - TestFX finally TestFX Controller is tested ! the main class is nearly only pure JDK/JavaFX8 the component AddComponent needs to be tested at the Button Action Event if the Button Action Event is tested -> code coverage is increased .. extend from GUITest .. create RootNode @SvenRuppert 86/165
  • 85. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 86/164 JavaFX 8 - TestFX finally TestFX Controller is tested ! the main class is nearly only pure JDK/JavaFX8 the component AddComponent needs to be tested at the Button Action Event if the Button Action Event is tested -> code coverage is increased .. extend from GUITest .. create RootNode .. write your tests @SvenRuppert 87/165
  • 86. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 87/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert public class AddComponentTest extends GuiTest { @Override protected Parent getRootNode() { AddComponent addComponent = new AddComponent(); addComponent.setId("c"); return addComponent; } JAVA 88/165
  • 87. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 88/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert @Test public void test001() throws Exception { Node c = find("#c"); Assert.assertNotNull(c); TextField tf1 = find("#tf1", c); TextField tf2 = find("#tf2", c); clickOn(tf1).write("1"); clickOn(tf2).write("2"); clickOn((Button)find("#btnAdd")).clickOn(); TextField tfResult = find("#tfResult"); Assertions.verifyThat(tfResult, hasText("3")); Thread.sleep(5_000); } JAVA 89/165
  • 88. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 89/164 JavaFX 8 - TestFX finally TestFX .. and now code and running test -> v004 @SvenRuppert @Test public void test001() throws Exception { Node c = find("#c"); Assert.assertNotNull(c); TextField tf1 = find("#tf1", c); TextField tf2 = find("#tf2", c); clickOn(tf1).write("1"); clickOn(tf2).write("2"); clickOn((Button)find("#btnAdd")).clickOn(); TextField tfResult = find("#tfResult"); Assertions.verifyThat(tfResult, hasText("3")); Thread.sleep(5_000); } JAVA 90/165
  • 89. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 90/164 JavaFX 8 - TestFX finally TestFX Now... FXML @SvenRuppert 91/165
  • 90. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 91/164 JavaFX 8 - TestFX finally TestFX Now... FXML .. with FXML you could describe the UI @SvenRuppert 92/165
  • 91. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 92/164 JavaFX 8 - TestFX finally TestFX Now... FXML .. with FXML you could describe the UI .. but how ? @SvenRuppert 93/165
  • 92. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 93/164 JavaFX 8 - TestFX finally TestFX Now... FXML .. with FXML you could describe the UI .. but how ? Create Components... beginning from the top. @SvenRuppert 94/165
  • 93. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 94/164 JavaFX 8 - TestFX finally TestFX Now... FXML .. with FXML you could describe the UI .. but how ? Create Components... beginning from the top. .. every Component will have @SvenRuppert 95/165
  • 94. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 95/164 JavaFX 8 - TestFX finally TestFX Now... FXML .. with FXML you could describe the UI .. but how ? Create Components... beginning from the top. .. every Component will have .. .. a class called XYZPane @SvenRuppert 96/165
  • 95. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 96/164 JavaFX 8 - TestFX finally TestFX Now... FXML .. with FXML you could describe the UI .. but how ? Create Components... beginning from the top. .. every Component will have .. .. a class called XYZPane .. .. a class called XYZPaneController @SvenRuppert 97/165
  • 96. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 97/164 JavaFX 8 - TestFX finally TestFX Now... FXML .. with FXML you could describe the UI .. but how ? Create Components... beginning from the top. .. every Component will have .. .. a class called XYZPane .. .. a class called XYZPaneController .. .. a file called XYZPane.fxml @SvenRuppert 98/165
  • 97. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 98/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { MainPane root = new MainPane(); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root, 300, 275)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } JAVA 99/165
  • 98. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 99/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert public class BasePane<T> extends AnchorPane { public T controller; public BasePane() { final String fxmlFile = this.getClass().getSimpleName()+".fxml"; FXMLLoader loader = createFXMLLoader(fxmlFile); controller = loader.getController(); AnchorPane.setBottomAnchor(this, 0.0); AnchorPane.setTopAnchor(this, 0.0); AnchorPane.setLeftAnchor(this, 0.0); AnchorPane.setRightAnchor(this, 0.0); } private FXMLLoader createFXMLLoader(final String fxmlFile) { URL resource = getClass().getResource(fxmlFile); FXMLLoader loader = new FXMLLoader(resource); loader.setRoot(this); try { loader.load(); } catch (IOException e) { e.printStackTrace(); } return loader; } } JAVA 100/165
  • 99. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 100/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert public class MainPane extends BasePane<MainPaneController> { public MainPane(){ } } JAVA 101/165
  • 100. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 101/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert public class MainPane extends BasePane<MainPaneController> { public MainPane(){ } } public class MainPaneController { @FXML Button btn; @FXML EditPane editPane; public MainPaneController() { System.out.println("MainPaneController = OK" ); } private int counter = 0; public void onDoSomething(ActionEvent actionEvent){ btn.setText("Main pressed " + counter); counter = counter +1; //label from Edit changing editPane.setLabelText(); } } JAVA 102/165
  • 101. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 102/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert <?import javafx.scene.control.Button?> <?import javafx.scene.control.Label?> <?import javafx.scene.layout.VBox?> <?import org.rapidpm.demo.jdkio2015.v005.fx.main.edit.EditPane?> <fx:root type="org.rapidpm.demo.jdkio2015.v005.fx.main.MainPane" fx:controller="org.rapidpm.demo.jdkio2015.v005.fx.main.MainPaneController" xmlns:fx="http://javafx.com/fxml" fx:id="mainPane" > <!--style="-fx-scale-x: 4; -fx-scale-y: 4"--> <VBox> <Label fx:id="lb" text="Hello World"/> <Button fx:id="btn" onAction="#onDoSomething" text="Main Button"/> <EditPane fx:id="editPane"/> </VBox> </fx:root> JAVA 103/165
  • 102. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 103/164 JavaFX 8 - TestFX finally TestFX @SvenRuppert @Override protected Parent getRootNode() { return new MainPane(); } @Test public void testMainButton01() throws Exception { final Label lbMain = find("#lb"); Assert.assertNotNull(lbMain); Assertions.verifyThat(lbMain, hasText("Hello World")); final Button btnMain = find("#btn"); Assert.assertNotNull(btnMain); Assertions.verifyThat(btnMain, hasText("Main Button")); final EditPane editPane = find("#editPane"); Assert.assertNotNull(editPane); } JAVA 104/165
  • 103. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 104/164 Why CDI why CDI ? ;-) @SvenRuppert 105/165
  • 104. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 105/164 Why CDI we want to get rid of hard connections @SvenRuppert 106/165
  • 105. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 106/164 Why CDI we want to get rid of hard connections Have a look at the definition of a List. List will be the return value -> List. @SvenRuppert publicList<Data>execute(){...}; JAVA 107/165
  • 106. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 107/164 Why CDI the caller of the method dont know if it is an ArrayList or LinkedList... but @SvenRuppert importjava.util.List; importjava.util.ArrayList; publicList<Data>execute(){ finalList<Data>result=newArrayList<>(); //.... returnresult; } JAVA 108/165
  • 107. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 108/164 Why CDI the caller of the method dont know if it is an ArrayList or LinkedList... but .. inside the method you will have a static ref to ArrayList @SvenRuppert importjava.util.List; importjava.util.ArrayList; publicList<Data>execute(){ finalList<Data>result=newArrayList<>(); //.... returnresult; } JAVA 109/165
  • 108. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 109/164 Why CDI if you are not using a special method from ArrayList ... -> trimToSize() @SvenRuppert 110/165
  • 109. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 110/164 Why CDI if you are not using a special method from ArrayList ... -> trimToSize() Why not get rid of the static ref ?? @SvenRuppert 111/165
  • 110. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 111/164 Why CDI if you are not using a special method from ArrayList ... -> trimToSize() Why not get rid of the static ref ?? Maybe at runtime a LinkedList would be better.. we dont want to compile all again.. @SvenRuppert 112/165
  • 111. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 112/164 Why CDI if you are not using a special method from ArrayList ... -> trimToSize() Why not get rid of the static ref ?? Maybe at runtime a LinkedList would be better.. we dont want to compile all again.. ok, we could use Factories.. @SvenRuppert 113/165
  • 112. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 113/164 Why CDI we are using plain SE .. an example of a factory implementation @SvenRuppert importjava.util.ArrayList; importjava.util.LinkedList; importjava.util.List; publicclassListFactory{ publicListcreateArrayList() {returnnewArrayList();} publicListcreateLinkedList(){returnnewLinkedList();} publicListcreateList() {returnnewArrayList();} } JAVA 114/165
  • 113. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 114/164 Why CDI Do we have something better reached? @SvenRuppert 115/165
  • 114. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 115/164 Why CDI Do we have something better reached? the developers in your project are using this factory... @SvenRuppert 116/165
  • 115. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 116/164 Why CDI Do we have something better reached? the developers in your project are using this factory... if they will know that there is a factory ;-) @SvenRuppert 117/165
  • 116. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 117/164 Why CDI @SvenRuppert importjava.util.List; importjava.util.ArrayList; publicList<Data>execute(){ finalList<Data>result=newArrayList<>(); //.... returnresult; } JAVA 118/165
  • 117. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 118/164 Why CDI @SvenRuppert importjava.util.List; importjava.util.ArrayList; publicList<Data>execute(){ finalList<Data>result=newArrayList<>(); //.... returnresult; } importjava.util.List; importorg.rapidpm.demo.ListFactory; publicList<Data>execute(){ finalListlist=newListFactory().createArrayList(); //.... returnresult; } JAVA 119/165
  • 118. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 119/164 Why CDI ok, no static ref to ArrayList.. @SvenRuppert 120/165
  • 119. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 120/164 Why CDI ok, no static ref to ArrayList.. but we have a static ref to the factory method @SvenRuppert 121/165
  • 120. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 121/164 Why CDI ok, no static ref to ArrayList.. but we have a static ref to the factory method The implementation of the ListFactory itself will have all ref to all implementations @SvenRuppert 122/165
  • 121. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 122/164 Solution Nr 1 based on Java SE a little bit more dynamic.. @SvenRuppert 123/165
  • 122. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 123/164 Solution Nr 1 based on Java SE a little bit more dynamic.. @SvenRuppert importjava.util.ArrayList; importjava.util.LinkedList; importjava.util.List; importorg.rapidpm.demo.cdi.commons.registry.ContextResolver; publicclassListFactory{ publicListcreateList(finalContextResolvercontextResolver){ if(contextResolver==null){returncreateArrayList();} else{ if(contextResolver.resolveContext()){returncreateArrayList();} else{returncreateLinkedList();} } } } JAVA 124/165
  • 123. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 124/164 Solution Nr 1 based on Java SE a little bit more dynamic.. the complexity is now -> ContextResolver @SvenRuppert 125/165
  • 124. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 125/164 Solution Nr 1 based on Java SE a little bit more dynamic.. the complexity is now -> ContextResolver Added dep to the ContextResolver @SvenRuppert 126/165
  • 125. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 126/164 Solution Nr 1 based on Java SE a little bit more dynamic.. the complexity is now -> ContextResolver Added dep to the ContextResolver you got: at runtime you could switch the implementation @SvenRuppert 127/165
  • 126. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 127/164 Solution Nr 1 based on Java SE if you want to get rid of the deps inside the factory.. create a registry @SvenRuppert 128/165
  • 127. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 128/164 Solution Nr 1 based on Java SE if you want to get rid of the deps inside the factory.. create a registry at runtime you could register / unregister implemenattaions.. @SvenRuppert 129/165
  • 128. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 129/164 Solution Nr 1 based on Java SE if you want to get rid of the deps inside the factory.. create a registry at runtime you could register / unregister implemenattaions.. CDI will help... @SvenRuppert 130/165
  • 129. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 130/164 finally CDI ;-) based on Weld / WELD-SE instances are given from the container via @Inject @SvenRuppert 131/165
  • 130. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 131/164 finally CDI ;-) based on Weld / WELD-SE instances are given from the container via @Inject @SvenRuppert @InjectListlist; JAVA 132/165
  • 131. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 132/164 finally CDI ;-) based on Weld / WELD-SE instances are given from the container via @Inject @SvenRuppert @Inject@CDILegacyTestListlist; JAVA 133/165
  • 132. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 133/164 finally CDI ;-) based on Weld / WELD-SE instances are given from the container via @Inject @SvenRuppert @Inject@CDILegacyTestListlist; @Produces@CDILegacyTest publicListcreateList(...){...} JAVA 134/165
  • 133. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 134/164 finally CDI ;-) based on Weld / WELD-SE instances are given from the container via @Inject @SvenRuppert @Inject@CDILegacyTestListlist; @Produces@CDILegacyTest publicListcreateList(InjectionPointinjectionPoint, BeanManagerbeanManager,ContextResolvercontextResolver){ .... } JAVA 135/165
  • 134. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 135/164 finally CDI ;-) based on Weld / WELD-SE instances are given from the container via @Inject @SvenRuppert @Inject@CDILegacyTestListlist; @Produces@CDILegacyTest publicListcreateList(InjectionPointinjectionPoint, BeanManagerbeanManager,ContextResolvercontextResolver){ booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen... if(b){returnnewLinkedList();}else{returnnewArrayList();} } JAVA 136/165
  • 135. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 136/164 finally CDI ;-) based on Weld / WELD-SE instances are given from the container via @Inject the time to create the instance is to early.. @SvenRuppert @Inject@CDILegacyTestListlist; @Produces@CDILegacyTest publicListcreateList(InjectionPointinjectionPoint, BeanManagerbeanManager,ContextResolvercontextResolver){ booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen... if(b){returnnewLinkedList();}else{returnnewArrayList();} } JAVA 137/165
  • 136. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 137/164 finally CDI ;-) based on Weld / WELD-SE but it could be done at runtime.. @SvenRuppert 138/165
  • 137. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 138/164 finally CDI ;-) based on Weld / WELD-SE but it could be done at runtime.. decide as late as possible @SvenRuppert 139/165
  • 138. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 139/164 finally CDI ;-) based on Weld / WELD-SE but it could be done at runtime.. decide as late as possible @SvenRuppert @Inject@CDILegacyTestInstance<List>listInstance; JAVA 140/165
  • 139. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 140/164 finally CDI ;-) based on Weld / WELD-SE but it could be done at runtime.. decide as late as possible @SvenRuppert @Inject@CDILegacyTestInstance<List>listInstance; //..später finalListlist=listInstance.get(); JAVA 141/165
  • 140. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 141/164 finally CDI ;-) based on Weld / WELD-SE but it could be done at runtime.. decide as late as possible @SvenRuppert @Inject@CDILegacyTestInstance<List>listInstance; //..später finalListlist=listInstance.get(); @Produces@CDILegacyTest publicListcreateList(InjectionPointinjectionPoint, BeanManagerbeanManager,ContextResolvercontextResolver){ booleanb=contextResolver.resolveContext(...); //treffenderEntscheidungen... if(b){returnnewLinkedList();}else{returnnewArrayList();} } JAVA 142/165
  • 141. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 142/164 finally CDI ;-) based on Weld / WELD-SE static bound via AnnotationsLiteral: @SvenRuppert @Inject@MyQualifierListliste; JAVA 143/165
  • 142. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 143/164 finally CDI ;-) based on Weld / WELD-SE static bound via AnnotationsLiteral: Generics are not well supported @SvenRuppert @Inject@MyQualifierListliste; JAVA 144/165
  • 143. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 144/164 finally CDI ;-) based on Weld / WELD-SE static bound via AnnotationsLiteral: Generics are not well supported but still complex to use @SvenRuppert @Inject@MyQualifierListliste; JAVA 145/165
  • 144. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 145/164 CDI explained by code Qualifier und AnnotationsLiterale @SvenRuppert @Inject@CDILoggerLoggerlogger; JAVA 146/165
  • 145. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 146/164 CDI explained by code Qualifier und AnnotationsLiterale @SvenRuppert @Inject@CDILoggerLoggerlogger; JAVA 147/165
  • 146. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 147/164 CDI explained by code Qualifier und AnnotationsLiterale @SvenRuppert @Inject@CDILoggerLoggerlogger; JAVA @Producer@CDILoggerLoggercreate(...); JAVA 148/165
  • 147. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 148/164 CDI explained by code Qualifier und AnnotationsLiterale @SvenRuppert @Inject@CDILoggerLoggerlogger; JAVA @Producer@CDILoggerLoggercreate(...); JAVA @Producer@CDILoggerLoggercreate(..){ AnnotationsLiteralprodAL=contextResolver.resolve(..); }; JAVA 149/165
  • 148. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 149/164 CDI explained by code Qualifier und AnnotationsLiterale @SvenRuppert @Inject@CDILoggerLoggerlogger; JAVA @Producer@CDILoggerLoggercreate(...); JAVA @Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){ AnnotationsLiteralprodAL=contextResolver.resolve(..); returncreator.getManagedInstance(Logger.class,annotationLiteral); }; JAVA 150/165
  • 149. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 150/164 CDI explained by code Qualifier und AnnotationsLiterale you will get a dynamic AnnotationLiteral @SvenRuppert @Inject@CDILoggerLoggerlogger; JAVA @Producer@CDILoggerLoggercreate(...); JAVA @Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){ AnnotationsLiteralprodAL=contextResolver.resolve(..); returncreator.getManagedInstance(Logger.class,annotationLiteral); }; JAVA 151/165
  • 150. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 151/164 CDI explained by code Qualifier und AnnotationsLiterale you will get a dynamic AnnotationLiteral AnnotationsLiteral and class -> select the Producers @SvenRuppert @Inject@CDILoggerLoggerlogger; JAVA @Producer@CDILoggerLoggercreate(...); JAVA @Producer@CDILoggerLoggercreate(BeanManagerbm,ContextResolvercr){ AnnotationsLiteralprodAL=contextResolver.resolve(..); returncreator.getManagedInstance(Logger.class,annotationLiteral); }; JAVA 152/165
  • 151. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 152/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... @SvenRuppert 153/165
  • 152. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 153/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... apache licensed @SvenRuppert 154/165
  • 153. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 154/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... apache licensed as lean as possible: 3 classes, no external dependencies @SvenRuppert 155/165
  • 154. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 155/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... apache licensed as lean as possible: 3 classes, no external dependencies combines: FXML, Convention over Configuration and JSR-330 / @Inject integrated with maven 3 @SvenRuppert 156/165
  • 155. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 156/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... apache licensed as lean as possible: 3 classes, no external dependencies combines: FXML, Convention over Configuration and JSR-330 / @Inject integrated with maven 3 under active development @SvenRuppert 157/165
  • 156. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 157/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... apache licensed as lean as possible: 3 classes, no external dependencies combines: FXML, Convention over Configuration and JSR-330 / @Inject integrated with maven 3 under active development injection over a few steps is working @SvenRuppert 158/165
  • 157. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 158/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... apache licensed as lean as possible: 3 classes, no external dependencies combines: FXML, Convention over Configuration and JSR-330 / @Inject integrated with maven 3 under active development injection over a few steps is working postconstruct is working @SvenRuppert 159/165
  • 158. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 159/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... apache licensed as lean as possible: 3 classes, no external dependencies combines: FXML, Convention over Configuration and JSR-330 / @Inject integrated with maven 3 under active development injection over a few steps is working postconstruct is working using existing CDI Services with Annotations (Scopes and so on) is not working with afterburner @SvenRuppert 160/165
  • 159. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 160/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner ... apache licensed as lean as possible: 3 classes, no external dependencies combines: FXML, Convention over Configuration and JSR-330 / @Inject integrated with maven 3 under active development injection over a few steps is working postconstruct is working using existing CDI Services with Annotations (Scopes and so on) is not working with afterburner no mixed mode with CDI and afterburner.fx @SvenRuppert 161/165
  • 160. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 161/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with afterburner.fx ... show the code .. @SvenRuppert 162/165
  • 161. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 162/164 CDI explained by code Qualifier und AnnotationsLiterale Now... JavaFX with CDI bootstrap ... code only.. @SvenRuppert 163/165
  • 162. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 163/164 @SvenRuppert http://www.rapidpm.org // http://www.codecentric.de (privater) Tech - Newsletter -> Core Java, Reflection, IoT, uvm Bei Interesse bitte bei mir eintragen -> plain old Zettel ;-) g+: www.google.com/+SvenRuppert github : github.com/svenruppert
  • 163. 20.10.2015 JavaFX8 - TestFX - CDI - JUG http://localhost:63342/java-courses/doc/javafx-testfx-tdd.html#1 164/164 <Thank You!> g+ www.google.com/+SvenRuppert twitter @SvenRuppert www www.rapidpm.org github github.com/svenruppert