weixin_39980234 2020-11-29 16:37
浏览 0

Two inappropriate test samples

Summary

I think there are two inappropriate test samples in Urls_assertHasQuery_Test and Uris_assertHasQuery_Test.

Example

In Urls_assertHasQuery_Test:

java

  public void should_fail_if_actual_is_null() {
    assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> urls.assertHasQuery(info, null, 
                                                                                         "http://www.helloworld.org/index.html?type=test")).withMessage(actualIsNull());
  }

should be:

java

  public void should_fail_if_actual_is_null() {
    assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> urls.assertHasQuery(info, null, 
                                                                                         "type=test")).withMessage(actualIsNull());
  }

And in Uris_assertHasQuery_Test:

java

  public void should_fail_if_actual_is_null() {
    assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> uris.assertHasQuery(info, null, 
                                                                                         "http://www.helloworld.org/index.html?type=test")).withMessage(actualIsNull());
  }

should be:

java

  public void should_fail_if_actual_is_null() {
    assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> uris.assertHasQuery(info, null, 
                                                                                         "type=test")).withMessage(actualIsNull());
  }

If this issue is valid, I'd like to create a PR for it.

该提问来源于开源项目:assertj/assertj-core

  • 写回答

0条回答 默认 最新

    报告相同问题?