Skip to content

Commit

Permalink
fix potential NPE before mock check.
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenlj committed Nov 12, 2019
1 parent b133782 commit 8be7726
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,14 @@ public static void validateMethodConfig(MethodConfig config) {
checkMethodName("name", config.getName());

String mock = config.getMock();
if (mock.startsWith(RETURN_PREFIX) || mock.startsWith(THROW_PREFIX + " ")) {
checkLength(MOCK_KEY, mock);
} else if (mock.startsWith(FAIL_PREFIX) || mock.startsWith(FORCE_PREFIX)) {
checkNameHasSymbol(MOCK_KEY, mock);
} else {
checkName(MOCK_KEY, mock);
if (StringUtils.isNotEmpty(mock)) {
if (mock.startsWith(RETURN_PREFIX) || mock.startsWith(THROW_PREFIX + " ")) {
checkLength(MOCK_KEY, mock);
} else if (mock.startsWith(FAIL_PREFIX) || mock.startsWith(FORCE_PREFIX)) {
checkNameHasSymbol(MOCK_KEY, mock);
} else {
checkName(MOCK_KEY, mock);
}
}
}

Expand Down

0 comments on commit 8be7726

Please sign in to comment.