-1

I run gradle script with dependecy to jupiter,wicket spring boot start and springboot starter

buildscript {
    repositories {
        mavenCentral()
        // The following is only necessary if you want to use SNAPSHOT releases.
        // maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
    dependencies {
        classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.2'
    }
}

apply plugin: 'org.junit.platform.gradle.plugin'

// Apply the java-library plugin to add support for Java Library
apply plugin: 'java'

junitPlatform {
    reportsDir file('build/test-results/junit-platform') // this is the default
    enableStandardTestTask true
    // selectors (optional)
    // filters (optional)
}

// In this section you declare where to find the dependencies of your project
repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

dependencies {// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter
compile group: 'org.springframework.boot', name: 'spring-boot-starter', version: '1.5.9.RELEASE'
// https://mvnrepository.com/artifact/com.giffing.wicket.spring.boot.starter/wicket-spring-boot-starter
compile group: 'com.giffing.wicket.spring.boot.starter', name: 'wicket-spring-boot-starter', version: '2.0.4'
}

dependencies {
    testCompile("org.junit.jupiter:junit-jupiter-api:5.0.2")
    testRuntime("org.junit.jupiter:junit-jupiter-engine:5.0.2")
}

dependencies {
    testCompile("junit:junit:4.12")
    testRuntime("org.junit.vintage:junit-vintage-engine:4.12.2")
}

On the test

package steinKo.ATM.Web.test.unit;
import org.apache.wicket.util.tester.WicketTester;
import org.junit.jupiter.api.Test;

class HomePageTest {
    private WicketTester tester;

    @Test
    public void shouldRender() {
        tester = new WicketTester();
        tester.startPage(HomePage.class);
        tester.assertRenderedPage(HomePage.class);
    }
}

On the class

package steinKo.ATM.Web;

import org.apache.wicket.markup.html.WebPage;

public class HomePage extends WebPage{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

}

With the html

Insert title here

I recive folloing error message

2:57:15.185 [main] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator - Attempting to locate resource 'org/apache/wicket/Page.html' using finder'[webapppath: /]' 22:57:15.185 [main] DEBUG org.apache.wicket.core.util.resource.locator.ResourceStreamLocator - Attempting to locate resource 'org/apache/wicket/Page.html' using finder'[classpath: META-INF/resources/]' 22:57:15.186 [main] DEBUG org.apache.wicket.markup.MarkupCache - Markup not found: steinKo.ATM.Web.HomePage_nb_NO.html 22:57:15.195 [main] DEBUG org.apache.wicket.page.PageAccessSynchronizer - 'main' attempting to acquire lock to page with id '0' 22:57:15.195 [main] DEBUG org.apache.wicket.page.PageAccessSynchronizer - main acquired lock to page 0 22:57:15.229 [main] WARN RequestCycleExtra - ******************************** 22:57:15.232 [main] WARN RequestCycleExtra - Handling the following exception org.apache.wicket.markup.MarkupNotFoundException: Can not determine Markup. Component is not yet connected to a parent. [Page class = steinKo.ATM.Web.HomePage, id = 0, render count = 1]

I think the erreor is cause by lack of link between Homepage.java and HomePage.hlml in Gradle
How could I fixed this error?

stein korsveien
  • 1,047
  • 5
  • 13
  • 35
  • I have cleaned your snippets up a little. It would be great if you could slim down your example to the bare minimum necessary to reproduce the error. I lost count how many buttons you have in your code and didn't even start to read the html. Or the error message, for that matter. – Malte Hartwig Nov 29 '17 at 17:58
  • Hope the edit made the problem clearer – stein korsveien Nov 29 '17 at 22:16
  • 1
    Is the `HomePage.html` file in the same package as the `HomePage.java` file? If so: it might be that Gradle needs to be instructed to include HTML files in your sources directory as part of the application – Jeroen Steenbeeke Nov 30 '17 at 08:09
  • The HomePage.html and HomePage.jave is in the same package and directory. How does one instruct Gradle to include HTML files? – stein korsveien Nov 30 '17 at 09:14
  • Just move all _resources_ (i.e., non-Java source code files like your HTML) from the `src/test/java` folder structure to the `src/test/resources` structure. – Sam Brannen Nov 30 '17 at 11:02

1 Answers1

1

The solution

sourceSets {
    main {
        java {
            srcDirs = ['src/main/java']
        }
        resources {
            srcDirs = ['src/main/java','src/main/resources']
        }
    }
}
stein korsveien
  • 1,047
  • 5
  • 13
  • 35