package tk.puncha.integration.webapp;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestDatabase;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@AutoConfigureTestDatabase
@TestPropertySource(locations = {"/test.properties", "/integration-test.properties"})
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ControllerTests {

  @Value("${local.server.port}")
  private String PORT;
  private static final String SERVER = "http://localhost";
  private WebClient webClient;

  void createWebClient() {
    webClient = new WebClient();
    webClient.getOptions().setJavaScriptEnabled(false);
    webClient.getOptions().setCssEnabled(false);
  }

  void setInput(HtmlPage page, String elementId, String value) {
    ((HtmlTextInput) page.getElementById(elementId)).setValueAttribute(value);
  }

  void setDateInput(HtmlPage page, String elementId, String value) {
    ((HtmlDateInput) page.getElementById(elementId)).setValueAttribute(value);
  }

  void selectItem(HtmlPage page, String elementId, String itemToSelect) {
    HtmlSelect select = (HtmlSelect) page.getElementById(elementId);
    HtmlOption option = select.getOptionByText(itemToSelect);
    select.setSelectedAttribute(option, true);
  }

  HtmlPage clickButton(HtmlPage page, String xpathExpr) throws java.io.IOException {
    return ((HtmlButton) page.getByXPath(xpathExpr).get(0)).click();
  }

  HtmlPage getPage(String path) throws java.io.IOException {
    return webClient.getPage(SERVER + ":" + PORT + path);
  }

  @Test
  public void dummy() throws Exception {
    // Make jUnit happy
  }
}

@@ -129,31 +129,8 @@
 .*;%0A
-import org.junit.Test;%0A
 impo
@@ -578,43 +578,19 @@
 s = 
-%7B%22/test.properties%22, %22/integration-
+%22classpath:
 test
@@ -601,17 +601,16 @@
 perties%22
-%7D
 )%0A@Sprin
@@ -679,23 +679,16 @@
 M_PORT)%0A
-public 
 class Co
@@ -1865,85 +1865,7 @@
 %0A  %7D
-%0A%0A  @Test%0A  public void dummy() throws Exception %7B%0A    // Make jUnit happy%0A  %7D
 %0A%7D%0A

Add dummy test case to avoid jUnit reports errors for empty base test class