File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
liquidjava-verifier/src/test/java/liquidjava/rj_language/opt Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ package liquidjava .integration ;
2+
3+ import liquidjava .errors .ErrorEmitter ;
4+ import org .junit .jupiter .api .Test ;
5+ import static org .junit .jupiter .api .Assertions .*;
6+
7+ /**
8+ * Simple integration test that verifies interaction between the ErrorEmitter
9+ * class and the simulated error reporting process. It ensures that error data
10+ * is recorded and retrievable without expecting specific internal fields.
11+ */
12+ public class TesteIntegracao {
13+
14+ @ Test
15+ void shouldEmitAndRetrieveErrorInfo () {
16+ ErrorEmitter emitter = new ErrorEmitter ();
17+
18+ // Simulate adding an error
19+ emitter .addError ("Integration test error" , "FakeFile.java" , 42 );
20+
21+ // Verify that the emitter detected an error and has non-null info
22+ assertTrue (emitter .foundError (), "Emitter should register an error" );
23+ assertNotNull (emitter .getFullMessage (), "Full message should not be null" );
24+
25+ // File path may not be implemented — only check for no exception
26+ try {
27+ emitter .getFilePath ();
28+ } catch (Exception e ) {
29+ fail ("getFilePath() should not throw an exception" );
30+ }
31+ }
32+ }
33+
Original file line number Diff line number Diff line change @@ -8,11 +8,19 @@ public class TestesErrorEmitter {
88
99 private ErrorEmitter emitter ;
1010
11+ /**
12+ * Initializes a new ErrorEmitter before each test.
13+ */
14+
1115 @ BeforeEach
1216 void setup () {
1317 emitter = new ErrorEmitter ();
1418 }
1519
20+ /**
21+ * Tests that all getter methods return non-null values after an error is added.
22+ */
23+
1624 @ Test
1725 void returnNonNullValues () {
1826 emitter .addError ("test" , "main.java" , 3 );
@@ -21,6 +29,9 @@ void returnNonNullValues() {
2129 assertNotNull (emitter .getErrorStatus ());
2230 }
2331
32+ /**
33+ * Tests adding an error and verifying that it is correctly registered and demontrated through the emitter.
34+ */
2435 @ Test
2536 void addError () {
2637 emitter .addError ("Test error" , "File.java" , 42 );
You can’t perform that action at this time.
0 commit comments