mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
30 lines
939 B
Java
30 lines
939 B
Java
package com.thealgorithms.stacks;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.params.ParameterizedTest;
|
|
import org.junit.jupiter.params.provider.CsvSource;
|
|
|
|
class DuplicateBracketsTest {
|
|
|
|
@ParameterizedTest
|
|
@CsvSource({"'((a + b) + (c + d))'", "'(a + b)'", "'a + b'", "'('", "''"})
|
|
void testInputReturnsFalse(String input) {
|
|
assertFalse(DuplicateBrackets.check(input));
|
|
}
|
|
|
|
@ParameterizedTest
|
|
@CsvSource({"'(a + b) + ((c + d))'", "'((a + b))'", "'((((a + b)))))'"})
|
|
void testInputReturnsTrue(String input) {
|
|
assertTrue(DuplicateBrackets.check(input));
|
|
}
|
|
|
|
@Test
|
|
void testInvalidInput() {
|
|
assertThrows(IllegalArgumentException.class, () -> DuplicateBrackets.check(null));
|
|
}
|
|
}
|