小编chi*_*ult的帖子

我可以在一种测试方法中测试多个抛出的异常吗?

我有一个很好的指定接口,我写了我的JUnit测试:

public interface ShortMessageService {

     /**
     * Creates a message. A message is related to a topic
     * Creates a date for the message
     * @throws IllegalArgumentException, if the message is longer then 255 characters.
     * @throws IllegalArgumentException, if the message ist shorter then 10 characters.
     * @throws IllegalArgumentException, if the user doesn't exist
     * @throws IllegalArgumentException, if the topic doesn't exist
     * @throws NullPointerException, if one argument is null.
     * @param userName
     * @param message
     * @return ID of …
Run Code Online (Sandbox Code Playgroud)

java testing junit exception-handling junit4

11
推荐指数
1
解决办法
1万
查看次数

如何为子域永久禁用Chrome HSTS

我有以下设置:

该应用程序https://app.domain.de是我们的生产环境,并自动转发使用HTTPS.这一切都很好.最重要的是,有一些应用程序的开发版本可供我们的QA-Team访问http://develop.app.domain.de(此处不需要HTTPS).

问题从这里开始:我一旦访问https://app.domain.deChrome(我猜也是其他浏览器)转发http://develop.app.domain.de(没有HTTPS)也转到https://develop.app.domain.de(HTTPS).我当然可以禁用HSTS并清除此域的缓存并http://develop.app.domain.de再次工作,但直到我https://app.domain.de再次访问.

我无法为我们的开发环境启用HTTPS,因为您需要在Heroku中至少拥有一个Hobby Plan才能这样做,因此这会浪费我们应用程序的所有开发和测试版本.我还想保留url架构.

所以我的问题是如何永久禁用这个讨厌的转发(HSTS)?

https google-chrome hsts

5
推荐指数
2
解决办法
1万
查看次数

对没有实现的接口的JUnit测试

我尝试用JUnit编写一个给定接口的测试,并且不知道如何做到这一点:

public interface ShortMessageService {

    /**
     * Creates a message. A message is related to a topic
     * Creates a date for the message
     * @throws IllegalArgumentException, if the message is longer then 255 characters.
     * @throws IllegalArgumentException, if the message ist shorter then 10 characters.
     * @throws IllegalArgumentException, if the user doesn't exist
     * @throws IllegalArgumentException, if the topic doesn't exist
     * @throws NullPointerException, if one argument is null.
     * @param userName
     * @param message
     * @return ID of …
Run Code Online (Sandbox Code Playgroud)

testing junit interface mockito

3
推荐指数
1
解决办法
5722
查看次数