File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
kata/7-kyu/substituting-variables-into-strings-padded-numbers Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 11# [ Substituting Variables Into Strings: Padded Numbers] ( https://www.codewars.com/kata/substituting-variables-into-strings-padded-numbers " https://www.codewars.com/kata/51c89385ee245d7ddf000001 ")
22
3- Complete the solution so that it returns a formatted string. The return value should equal "Value is VALUE" where value is a 5 digit padded number.
3+ Complete the solution so that it returns a formatted string. The return value should equal "Value is VALUE" where value is a 5 digit padded
4+ number.
45
56Example:
67
78```
89solution(5); // should return "Value is 00005"
9- ```
10+ ```
Original file line number Diff line number Diff line change 1+ interface Kata {
2+ static String solution (int value ) {
3+ return String .format ("Value is %05d" , value );
4+ }
5+ }
Original file line number Diff line number Diff line change 1+ import static org .junit .jupiter .api .Assertions .assertEquals ;
2+
3+ import org .junit .jupiter .params .ParameterizedTest ;
4+ import org .junit .jupiter .params .provider .CsvSource ;
5+
6+ class Tests {
7+ @ ParameterizedTest
8+ @ CsvSource (textBlock = """
9+ 0, Value is 00000
10+ 5, Value is 00005
11+ 109, Value is 00109
12+ 1204 Value is 01204
13+ """ )
14+ void sample (int n , String expected ) {
15+ assertEquals (expected , Kata .solution (n ));
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments