Skip to content

Commit 267ce98

Browse files
Copilotnixel2007
andcommitted
Use assertThatCode with lambda to test getDiagnostics doesn't throw
- Import assertThatCode from assertj - Replace isEmpty() assertion with doesNotThrowAnyException() - Specifically test that getDiagnostics call doesn't throw NPE Co-authored-by: nixel2007 <[email protected]>
1 parent 9f3ab19 commit 267ce98

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UselessTernaryOperatorDiagnosticTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.List;
3030

3131
import static com.github._1c_syntax.bsl.languageserver.util.Assertions.assertThat;
32+
import static org.assertj.core.api.Assertions.assertThatCode;
3233

3334
class UselessTernaryOperatorDiagnosticTest extends AbstractDiagnosticTest<UselessTernaryOperatorDiagnostic> {
3435

@@ -89,9 +90,8 @@ void testMalformedTernaryOperatorDoesNotThrowNPE() {
8990
// Пример из issue: Return ?(table.Count() = 1, undefined, );
9091
var documentContext = getDocumentContext("UselessTernaryOperatorDiagnosticMalformed");
9192

92-
List<Diagnostic> diagnostics = getDiagnostics(documentContext);
93-
94-
assertThat(diagnostics).isEmpty();
93+
assertThatCode(() -> getDiagnostics(documentContext))
94+
.doesNotThrowAnyException();
9595
}
9696

9797
}

0 commit comments

Comments
 (0)