concept page object in category java

This is an excerpt from Manning's book Testing Java Microservices: Using Arquillian, Hoverfly, AssertJ, JUnit, Selenium, and Mockito.
The WebDriver could be injected directly into your test using the @Drone annotation. A better way is to create page objects for all browser-related tests. Page objects are nothing more than virtual wrappers designed to represent a single viewable page or element of your UI application. They should only encapsulate logic specific to the page or element at hand.
Once you’ve defined a page object, you inject it into your test using the @Page annotation as shown next (code/web/src/test/javahttps://livebook.manning.com/book/web/EndToEndTest.java). This can then be used to operate on the testing browser to perform tests.
Listing 7.17. Injecting a page object
@Page @OperateOnDeployment("gamerweb") private Index page; #1 @Test @InSequence(7) public void testTheUI() throws Exception { System.out.println("gameaggregatorservice = " + gameaggregatorservice.get().toExternalForm()); page.navigateTo(gamerweb.get().toExternalForm()); #2 List list = page.searchFor("Zelda"); Assert.assertEquals("", "Zelda", page.getSearchText()); Assert.assertThat(list.getResults(), hasItems("The Legend of Zelda: Breath of the Wild")); Detail detail = list.getDetail(0); Assert.assertTrue(detail.getImageURL().startsWith("http")); if (null != System.getProperty("dev.hack")) { #3 new ServerSocket(9999).accept(); } }