BAEL-919: Introduction to JUnitParams (#1938)
* BAEL-919 Added the JUnitParams intorduction classes * BAEL-919 Added the JUnitParams intorduction classes * Reverting the adding to libraries folder
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.junitparams;
|
||||
|
||||
public class SafeAdditionUtil {
|
||||
|
||||
public int safeAdd(int a, int b) {
|
||||
long result = ((long) a) + b;
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
} else if (result < Integer.MIN_VALUE) {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
return (int) result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user