A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2528 below:

[java] MethodNamingConventions - JUnit 5 method naming not support ParameterizedTest · Issue #2528 · pmd/pmd · GitHub

Affects PMD Version: 6.24.0

Rule: MethodNamingConventions

Description:

The PMD does not use the junit5TestPattern rule for tests annotated with org.junit.jupiter.params.ParameterizedTest.

Code Sample demonstrating the issue:

pmd.xml:

  <rule ref="category/java/codestyle.xml/MethodNamingConventions">
    <properties>
      <property name="methodPattern" value="[a-z][a-zA-Z0-9]*"/>
      <property name="staticPattern" value="[a-z][a-zA-Z0-9]*"/>
      <property name="nativePattern" value="[a-z][a-zA-Z0-9]*"/>
      <property name="junit3TestPattern"
                value="test_[a-z][a-zA-Z0-9]*(_with(out)?[A-Z0-9][a-zA-Z0-9]*)?_should[A-Z0-9][a-zA-Z0-9]*"/>
      <property name="junit4TestPattern"
                value="test_[a-z][a-zA-Z0-9]*(_with(out)?[A-Z0-9][a-zA-Z0-9]*)?_should[A-Z0-9][a-zA-Z0-9]*"/>
      <property name="junit5TestPattern"
                value="test_[a-z][a-zA-Z0-9]*(_with(out)?[A-Z0-9][a-zA-Z0-9]*)?_should[A-Z0-9][a-zA-Z0-9]*"/>
    </properties>
  </rule>

Test code:

  @ParameterizedTest
  @ValueSource(strings = { "FEMALE", "MALE" })
  public void test_fromValue_withGenderValues_shouldReturnEnumType(final String value) {
    assertNotNull(Gender.fromValue(value));
  }

Problem:

The instance method name 'test_fromValue_withGenderValues_shouldReturnEnumType' doesn't match '[a-z][a-zA-Z0-9]*'

Expected outcome:

Running PMD through: Gradle


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4