diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2016-12-18 08:45:05 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2016-12-18 08:45:05 +0200 |
commit | 6b51788ee7c2a8b147744bc11d220fb3ed896672 (patch) | |
tree | 4f310c85f2e5d77179a6aa218c3740c29e3410f7 /test/spring-boot | |
parent | 52decf5e2b32116deb5de32b7706cda198c52347 (diff) | |
download | vaadin-framework-6b51788ee7c2a8b147744bc11d220fb3ed896672.tar.gz vaadin-framework-6b51788ee7c2a8b147744bc11d220fb3ed896672.zip |
Add CDI dependency version to vaadin-bom (#8020)
Unify test UIs and test code for Spring and CDI.
Diffstat (limited to 'test/spring-boot')
-rw-r--r-- | test/spring-boot/src/main/java/com/example/DemoApplication.java | 7 | ||||
-rw-r--r-- | test/spring-boot/src/main/java/com/example/ThankYouService.java | 13 | ||||
-rw-r--r-- | test/spring-boot/src/test/java/com/example/VaadinSpringBootSmokeIT.java (renamed from test/spring-boot/src/test/java/com/example/SpringBootSmokeTest.java) | 4 |
3 files changed, 20 insertions, 4 deletions
diff --git a/test/spring-boot/src/main/java/com/example/DemoApplication.java b/test/spring-boot/src/main/java/com/example/DemoApplication.java index 9a4edd8769..62e6a76a36 100644 --- a/test/spring-boot/src/main/java/com/example/DemoApplication.java +++ b/test/spring-boot/src/main/java/com/example/DemoApplication.java @@ -1,5 +1,6 @@ package com.example; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -19,11 +20,13 @@ public class DemoApplication { @SpringUI class MyUI extends UI { - public static final String NOTIFICATION_TEXT = "Thank you for clicking."; + + @Autowired + ThankYouService service; @Override protected void init(VaadinRequest request) { setContent(new Button("Click Me!", - e -> Notification.show(NOTIFICATION_TEXT))); + e -> Notification.show(service.getText()))); } } diff --git a/test/spring-boot/src/main/java/com/example/ThankYouService.java b/test/spring-boot/src/main/java/com/example/ThankYouService.java new file mode 100644 index 0000000000..b387046659 --- /dev/null +++ b/test/spring-boot/src/main/java/com/example/ThankYouService.java @@ -0,0 +1,13 @@ +package com.example; + +import org.springframework.stereotype.Service; + +@Service +public class ThankYouService { + + public static final String THANK_YOU_TEXT = "Thank you for clicking."; + + public String getText() { + return THANK_YOU_TEXT; + } +} diff --git a/test/spring-boot/src/test/java/com/example/SpringBootSmokeTest.java b/test/spring-boot/src/test/java/com/example/VaadinSpringBootSmokeIT.java index fe5357579b..2f1cb545d8 100644 --- a/test/spring-boot/src/test/java/com/example/SpringBootSmokeTest.java +++ b/test/spring-boot/src/test/java/com/example/VaadinSpringBootSmokeIT.java @@ -22,7 +22,7 @@ import com.vaadin.testbench.parallel.Browser; */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -public class SpringBootSmokeTest extends TestBenchTestCase { +public class VaadinSpringBootSmokeIT extends TestBenchTestCase { @LocalServerPort Integer port; @@ -38,7 +38,7 @@ public class SpringBootSmokeTest extends TestBenchTestCase { getDriver().navigate().to("http://localhost:" + port + ""); $(ButtonElement.class).first().click(); Assert.assertTrue($(NotificationElement.class).exists()); - Assert.assertEquals(MyUI.NOTIFICATION_TEXT, + Assert.assertEquals(ThankYouService.THANK_YOU_TEXT, $(NotificationElement.class).first().getText()); } } |