Я обновляю свой проект jhipster с версии 5.8.2 до 6.1.0.
Затем я обновляю свои классы модульного тестирования по следующей ссылке: https://github.com/jhipster/jhipster-online/issues/107
Когда я запускаю:
./gradlew test
Нет запуска модульного теста ...
Образец класса UnitTest:
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.Validator;
import javax.persistence.EntityManager;
import java.util.ArrayList;
import java.util.List;
import static fr.project.app.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.mockito.Mockito.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Integration tests for the {@Link WebServiceResource} REST controller.
*/
@SpringBootTest(classes = ProjectApp.class)
public class WebServiceResourceIntTest {
Мой файл build.gradle есть:
import org.gradle.internal.os.OperatingSystem
buildscript {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
maven { url "http://repo.spring.io/plugins-release" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}"
classpath "io.spring.gradle:propdeps-plugin:0.0.10.RELEASE"
//jhipster-needle-gradle-buildscript-dependency - JHipster will add additional gradle build script plugins here
}
}
test {
useJUnitPlatform()
exclude "**/*IT*", "**/*IntTest*", "**/*CucumberIT*"
testLogging {
events 'FAILED', 'SKIPPED'
}
// uncomment if the tests reports are not generated
// see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
// ignoreFailures true
reports.html.enabled = false
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
//jhipster-needle-gradle-repositories - JHipster will add additional repositories
}
dependencies {
// import JHipster dependencies BOM
implementation platform("io.github.jhipster:jhipster- dependencies:${jhipster_dependencies_version}" )
// Use ", version: jhipster_dependencies_version, changing: true" if you want
// to use a SNAPSHOT release instead of a stable release
implementation group: "io.github.jhipster", name: "jhipster-framework"
....
implementation "org.springframework.boot:spring-boot-starter-cache"
testImplementation ("org.springframework.boot:spring-boot-starter-test") {
exclude module: "junit"
exclude group: "com.vaadin.external.google", module: "android-json"
}
testImplementation "org.springframework.security:spring-security-test"
testImplementation "org.springframework.boot:spring-boot-test"
testImplementation "org.junit.jupiter:junit-jupiter-engine"
testImplementation "org.junit.vintage:junit-vintage-engine"
testImplementation "org.assertj:assertj-core"
testImplementation "junit:junit"
testImplementation "org.mockito:mockito-core"
testImplementation "org.hamcrest:hamcrest-library"
testImplementation "com.h2database:h2"
//jhipster-needle-gradle-dependency - JHipster will add additional
}
wrapper {
gradleVersion = "5.4.1"
}
...
compileJava.dependsOn processResources
processResources.dependsOn bootBuildInfo
Обновление jhipster автоматически изменяет этот файл
У вас есть идея, пожалуйста?