GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Error Prone
  • Bug Patterns
  • Docs
  • GitHub

This view

  • Original page
  • New address

GeezerVison is showing errorprone.info — IdentifierName

IdentifierName
Methods and non-static variables should be named in lowerCamelCase

Severity
WARNING

Alternate names: MemberName

The problem

The Google Java Style Guide §5.2 provides rules for naming identifiers.

Test methods

The style guide includes the following special case for test methods:

Underscores may appear in JUnit test method names to separate logical components of the name, with each component written in lowerCamelCase, for example transferMoney_deductsFromSource.

Note that this only applies to test methods themselves, not to helper methods called by test methods.

@Test
public void transferMoney_deductsFromChecking() {
  transferMoney_deductsFromSource(Source.CHECKING);
}

@Test
public void transferMoney_deductsFromSavings() {
  transferMoney_deductsFromSource(Source.SAVINGS);
}

// this method name shouldn't use underscores
private void transferMoney_deductsFromSource(Source source) { ... }

Instead of having a group of test methods call the same helper method with varying parameters, consider a parameterized test , or splitting the tests into separate setup and assert helper methods (named appropriately) to make the flow of each test clearer.

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("IdentifierName") to the enclosing element.

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.