Details

Recommendation type: NullPointerException Thrown

Configurable in Preferences: No

Filter category: Exceptions / assertion errors

Description

UTA displays this recommendation when a NullPointerException has been thrown during the test run. Depending on you code, the following action links may be available:

(info) UTA can detect the a NullPointerException within one source class.

See Exceptions and Assertion Errors for more options that can be displayed for exceptions.

Example

In the following example, the value of customer is null:

When the getName method is called on the customer object, the NullPointerExceprion is thrown:

UTA detects the NullPointerException and displays the following information in the Recommendations view:

Repair

You can prevent the NullPointerException from being thrown in one of the following ways: