Test Writing: Validate Brackets
Created By: Justin Maier
/ Version: 2024.12.0
Complete the method below that takes in a String containing only the enclosing characters '(', ')', '[', and ']'.
The function should determine whether the ordering and pairing of the brackets form a valid expression. For example,
- "[()]" is valid.
- "[()[]" is not valid since the first bracket '[' is not matched.
- "[(])" is not valid as the outer closing bracket ']' occurs before the inner closing bracket ')'.
Test Design Challenge
You're challenge is to write tests for this problem described above.
- Provide a method named test that accepts no arguments and does not return a value.
- If the implementation of the class described above is incorrect, your test method should throw an exception.
- If it is correct, do not throw an exception.
- You may want to use Java's assert method
boolean validBrackets(String input) {
return false;
}