Skip to content

Commit c1e0a52

Browse files
committed
style: fix checkstyle violations in ValidParentheses and tests
1 parent 3d3f61a commit c1e0a52

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/main/java/com/thealgorithms/stacks/ValidParentheses.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public static boolean isValid(final String str) {
4444
return false;
4545
}
4646
char top = stack.peek();
47-
if ((top == '(' && ch == ')') ||
48-
(top == '{' && ch == '}') ||
49-
(top == '[' && ch == ']')) {
47+
if ((top == '(' && ch == ')')
48+
|| (top == '{' && ch == '}')
49+
|| (top == '[' && ch == ']')) {
5050
stack.pop();
5151
} else {
5252
return false;

src/test/java/com/thealgorithms/stacks/ValidParenthesesTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33

44
import static org.junit.jupiter.api.Assertions.assertEquals;
5-
import static org.junit.jupiter.api.Assertions.assertThrows;
6-
75
import java.util.stream.Stream;
86
import org.junit.jupiter.params.ParameterizedTest;
97
import org.junit.jupiter.params.provider.Arguments;
@@ -13,7 +11,7 @@ public class ValidParenthesesTest {
1311

1412
@ParameterizedTest
1513
@MethodSource("provideValidTestCases")
16-
void testIsValid_ValidCases(String input, boolean expected) {
14+
void testIsValidValidCases(String input, boolean expected) {
1715
assertEquals(expected, ValidParentheses.isValid(input));
1816
}
1917

@@ -28,7 +26,7 @@ static Stream<Arguments> provideValidTestCases() {
2826

2927
@ParameterizedTest
3028
@MethodSource("provideInvalidTestCases")
31-
void testIsValid_InvalidCases(String input) {
29+
void testIsValidInvalidCases(String input) {
3230
assertEquals(false, ValidParentheses.isValid(input));
3331
}
3432

0 commit comments

Comments
 (0)