BAEL-5461 code for the Unit Test Private Methods in Java article (#12240)

Co-authored-by: thibault.faure <thibault.faure@mimacom.com>
This commit is contained in:
thibaultfaure
2022-06-09 16:19:24 +02:00
committed by GitHub
parent ca6ab5ff78
commit ff4bab7949
3 changed files with 80 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package com.baeldung.reflection.privatemethods;
public class Utils {
public static Integer validateAndDouble(Integer input) {
if (input == null) {
throw new IllegalArgumentException("input should not be null");
}
return doubleInteger(input);
}
private static Integer doubleInteger(Integer input) {
if (input == null) {
return null;
}
return 2 * input;
}
}