小编Pet*_*zov的帖子

org.junit.platform.commons.JUnitException:ID为“junit-jupiter”的TestEngine未能发现测试

我想在 Gradle 项目中实施 Junit 5 测试。我试过这个:

梯度配置:

plugins {
    id 'org.springframework.boot' version '2.5.5'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'test'
version = '0.0.1'
sourceCompatibility = '17'

repositories {
    mavenCentral()
}

ext {
    set('springCloudVersion', "2020.0.4")
}

dependencies {
    ...............
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

test {
    useJUnitPlatform()
}
Run Code Online (Sandbox Code Playgroud)

联合测试:

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

import java.util.concurrent.TimeUnit;

public class GeneratePdf {

    @DisplayName("Test MessageService.get()")
    @Test
    @Timeout(value = 60, unit …
Run Code Online (Sandbox Code Playgroud)

java junit spring-test junit5 junit-jupiter

57
推荐指数
4
解决办法
13万
查看次数

从位置“类路径资源 [application-dev.yml]”导入的属性“spring.profiles.active”无效

我将 Spring cloud 应用程序更新到最新的 Spring boot 版本 2.5.0。

但在启动过程中我遇到了这个异常:

11:05:05.038 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property 'spring.profiles.active' imported from location 'class path resource [application-dev.yml]' is invalid in a profile specific resource [origin: class path resource [application-dev.yml] from skyshop-mail-1.0.jar - 42:17]
        at org.springframework.boot.context.config.InvalidConfigDataPropertyException.lambda$throwOrWarn$1(InvalidConfigDataPropertyException.java:125)
Run Code Online (Sandbox Code Playgroud)

应用程序.yml

spring:
    application:
        name: mail-service
    profiles:
        active: dev
Run Code Online (Sandbox Code Playgroud)

application-dev.yml 文件:

logging:
    file:
        name: ${java.io.tmpdir}/application.log
    level:
        com:
            backend: DEBUG
        org:
            springframework: DEBUG
            springframework.web: DEBUG
jwt:
    expiration: 86400
    secret: test112322
server:
    port: 8020
    servlet:
        context-path: /mail
spring: …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot spring-cloud

50
推荐指数
5
解决办法
10万
查看次数

Java.io.IOException:无效状态代码 = 403 文本 = 禁止

当我尝试在远程服务器的 Azure DevOps 驱动程序中执行一组 Selenium Webdriver 测试时,出现此错误堆栈:

2023-03-08T21:06:46.9827484Z Running Test 66728 Mobile Web - Pick Task
2023-03-08T21:06:46.9827843Z Test Description https://dev.azure.com/Corporation/%20FootPrint/_workitems/edit/66728
2023-03-08T21:06:47.2244460Z Starting ChromeDriver 111.0.5563.41 (976ef12907ef9b413c2d929c043307b415d27b9e-refs/branch-heads/5563@{#737}) on port 35235
2023-03-08T21:06:47.2248489Z Only local connections are allowed.
2023-03-08T21:06:47.2273309Z Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
2023-03-08T21:06:47.2530381Z ChromeDriver was started successfully.
2023-03-08T21:06:50.3292859Z Mar 08, 2023 4:06:50 PM org.openqa.selenium.remote.http.WebSocket$Listener onError
2023-03-08T21:06:50.3319163Z WARNING: Invalid Status code=403 text=Forbidden
2023-03-08T21:06:50.3320374Z java.io.IOException: Invalid Status code=403 text=Forbidden
2023-03-08T21:06:50.3321045Z    at org.asynchttpclient.netty.handler.WebSocketHandler.abort(WebSocketHandler.java:92)
2023-03-08T21:06:50.3321498Z    at org.asynchttpclient.netty.handler.WebSocketHandler.handleRead(WebSocketHandler.java:118)
2023-03-08T21:06:50.3322255Z    at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:78)
2023-03-08T21:06:50.3326071Z    at …
Run Code Online (Sandbox Code Playgroud)

selenium-webdriver

29
推荐指数
3
解决办法
7万
查看次数

任务与数据库操作的服务

JavaFX 8任务和服务之间有什么区别,在哪种情况下,使用一个优于另一个?在数据库操作中使用什么更好?

javafx javafx-2 javafx-8

28
推荐指数
1
解决办法
9193
查看次数

无法调用“org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()”,因为“this.condition”为空

我正在尝试使用 Spring Boot 2.6.7 运行 Springdoc。

配置:

@Configuration
public class SwaggerConfiguration {
  
  @Bean
  public GroupedOpenApi publicApi() {
    return GroupedOpenApi.builder()
            .group("springshop-public")
            .pathsToMatch("/public/**")
            .build();
  }
}
Run Code Online (Sandbox Code Playgroud)

错误堆栈:

00:50:54.956 [main] ERROR SpringApplication[reportFailure:830] - Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException: Cannot invoke "org.springframework.web.servlet.mvc.condition.PatternsRequestCondition.getPatterns()" because "this.condition" is null
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
    at com.atlas.psp.AtlasRouterApplication.main(AtlasRouterApplication.java:53) …
Run Code Online (Sandbox Code Playgroud)

java spring-boot springdoc springdoc-openapi-ui

28
推荐指数
3
解决办法
5万
查看次数

如何使用SQL查询显示Oracle模式大小?

我有一个包含70多个表的Oracle模式.我想创建一个简单的页面,可以显示表占用的硬盘空间.我如何用SQL查询获取此值?

PS以及我如何获得Oracle架构版本?

sql oracle oracle11g

22
推荐指数
2
解决办法
18万
查看次数

设置可执行Jar文件的图标

我有一个简单的可执行Jar文件.我该如何为这个文件设置图标?在我的情况下,我使用标准的Jar图标,我想改变.

在此输入图像描述

java jar executable-jar

20
推荐指数
2
解决办法
8万
查看次数

如何编译GnuTLS

我试图在Centos 6.2上多次编译GnuTLS库,但没有运气.这些是步骤:

我下载了Nettle 2.4

[root@localhost opt]# wget http://www.lysator.liu.se/~nisse/archive/nettle-2.4.tar.gz
[root@localhost nettle-2.4]# tar zxvf nettle-2.4.tar.gz
[root@localhost nettle-2.4]# cd nettle-2.4
[root@localhost nettle-2.4]# ./configure --enable-shared --prefix=/usr



  Version:           nettle 2.4
  Host type:         x86_64-unknown-linux-gnu
  ABI:               64
  Assembly files:    x86_64
  Install prefix:    /usr
  Library directory: ${exec_prefix}/lib64
  Compiler:          gcc
  Shared libraries:  yes
  Public key crypto: no
Run Code Online (Sandbox Code Playgroud)

我运行命令makemake install

我下载了最新的GnuTLS

 ./configure --with-libnettle-prefix=/usr

hecking for shared library run path origin... done
checking whether to use nettle... yes
checking for libnettle... no
configure: error:
  ***
  *** Libnettle 2.4 …
Run Code Online (Sandbox Code Playgroud)

c makefile compilation build

18
推荐指数
2
解决办法
3万
查看次数

JavaFX 8的基本JUnit测试

我想为JavaFX 8应用程序创建基本的JUnit测试.我有这个简单的代码示例:

public class Main extends Application {
    public static void main(String[] args) {
        Application.launch(args);
    }
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Tabs");
        Group root = new Group();
        Scene scene = new Scene(root, 400, 250, Color.WHITE);
        TabPane tabPane = new TabPane();
        BorderPane borderPane = new BorderPane();
        for (int i = 0; i < 5; i++) {
            Tab tab = new Tab();
            tab.setText("Tab" + i);
            HBox hbox = new HBox();
            hbox.getChildren().add(new Label("Tab" + i));
            hbox.setAlignment(Pos.CENTER);
            tab.setContent(hbox);
            tabPane.getTabs().add(tab);
        }
        // bind to …
Run Code Online (Sandbox Code Playgroud)

junit javafx junit4 javafx-2 javafx-8

18
推荐指数
3
解决办法
3万
查看次数

警告:此页面调用使用前缀[HTML元素名称]声明的XML名称空间,但该名称空间不存在taglibrary

我有一个JSF页面的问题.这是源代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:h="http://java.sun.com/jsf/html">
    <head>
        <title>Login</title>
        <link rel="stylesheet" type="text/css" href="resources/css/style.css" />
        <script src="resources/js/cufon-yui.js" type="text/javascript"></script>
        <script src="resources/js/ChunkFive_400.font.js" type="text/javascript"></script>
        <script type="text/javascript">
            Cufon.replace('h1',{ textShadow: '1px 1px #fff'});
            Cufon.replace('h2',{ textShadow: '1px 1px #fff'});
            Cufon.replace('h3',{ textShadow: '0px 1px #000'});
            Cufon.replace('.back');
        </script>
    </head>
    <body>
        <div class="wrapper">
            <div class="content">
                <div id="form_wrapper" class="form_wrapper">                    
                    <h:form class="login active">
                        <h3><img style="text-align:center" src="resources/images/title.png"/></h3>
                        <div>
                            <label>Username:</label>
                            <h:inputText value="#{loginController.user}" autocomplete="off"/>                           
                        </div>
                        <div>
                            <label>Password:</label>
                            <h:inputSecret value="#{loginController.password}" autocomplete="off"/>                         
                        </div>
                        <div class="bottom">    
                                                        <h:commandButton label="Login" value="Login" action="#{loginController.userCompare}"/>
                            <div class="clear"></div>
                        </div>
                    </h:form> …
Run Code Online (Sandbox Code Playgroud)

facelets jsf-2

16
推荐指数
2
解决办法
3万
查看次数