7 kyu
Guava against Million dollar error
130 of 131Javatlacati
Description:
Let's use Google Guava Library to fight against the million dollar error.
As start point we have a simple sum function and we need it to validate the following, in order:
- that parameters are not null
- if first parameter is null throw NPE with message "Illegal Argument passed: First parameter is Null."
- if second parameter is null throw NPE with message "Illegal Argument passed: Second parameter is Null."
- that parameters are positive ( > 0 )
- if this is not the case then throw IllegalArgumentException with message "Illegal Argument passed: Non-positive value d." where
d
is the non-positive value (no need to format the value, just turn it into a string). If both values are non-positive, use the first parameter.
Hint: you could use a reading to class com.google.common.base.Preconditions
Fundamentals
Similar Kata:
Stats:
Created | Nov 8, 2017 |
Published | Feb 24, 2018 |
Warriors Trained | 278 |
Total Skips | 1 |
Total Code Submissions | 560 |
Total Times Completed | 131 |
Java Completions | 130 |
Total Stars | 4 |
% of votes with a positive feedback rating | 70% of 40 |
Total "Very Satisfied" Votes | 22 |
Total "Somewhat Satisfied" Votes | 12 |
Total "Not Satisfied" Votes | 6 |
Total Rank Assessments | 8 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |