@@ -264,18 +264,17 @@ public void testCollidingCompile() throws Exception {
264
264
265
265
@ Test
266
266
public void testMultiCompileWithFailure () throws ExecutionException , InterruptedException {
267
- final String goodProgram = String .join (
268
- "\n " ,
267
+ final String goodProgram = String .join ("\n " ,
269
268
"public class GoodTest {" ,
270
269
" public static void main (String [] args) {" ,
271
270
" }" ,
272
271
"}" );
273
- final String badProgram = String .join (
274
- "\n " ,
275
- "public class BadTest {" ,
276
- " public static void main (String [] args) { " ,
277
- " }" ,
278
- "}} " );
272
+ final String badProgram = String .join (" \n " ,
273
+ "public class Formula { " ,
274
+ " public Formula() {" ,
275
+ " S.badCall(0); " ,
276
+ " }" ,
277
+ "}" );
279
278
280
279
QueryCompilerRequest [] requests = new QueryCompilerRequest [] {
281
280
QueryCompilerRequest .builder ()
@@ -299,15 +298,53 @@ public void testMultiCompileWithFailure() throws ExecutionException, Interrupted
299
298
CompletionStageFuture .make (),
300
299
};
301
300
302
- try {
303
- ExecutionContext .getContext ().getQueryCompiler ().compile (requests , resolvers );
304
- // noinspection DataFlowIssue
305
- throw Assert .statementNeverExecuted ();
306
- } catch (Exception ignored ) {
307
- }
301
+ ExecutionContext .getContext ().getQueryCompiler ().compile (requests , resolvers );
308
302
309
303
Assert .eqTrue (resolvers [0 ].getFuture ().isDone (), "resolvers[0].getFuture().isDone()" );
310
304
Assert .eqTrue (resolvers [1 ].getFuture ().isDone (), "resolvers[0].getFuture().isDone()" );
311
305
Assert .neqNull (resolvers [1 ].getFuture ().get (), "resolvers[1].getFuture().get()" );
312
306
}
307
+
308
+ @ Test
309
+ public void testMultiCompileWithFailureSecond () throws ExecutionException , InterruptedException {
310
+ final String badProgram = String .join ("\n " ,
311
+ "public class Formula {" ,
312
+ " public Formula() {" ,
313
+ " S.badCall(0);" ,
314
+ " }" ,
315
+ "}" );
316
+ final String goodProgram = String .join ("\n " ,
317
+ "public class Formula {" ,
318
+ " public static void main (String [] args) {" ,
319
+ " }" ,
320
+ "}" );
321
+
322
+ QueryCompilerRequest [] requests = new QueryCompilerRequest [] {
323
+ QueryCompilerRequest .builder ()
324
+ .description ("Test Good Compile" )
325
+ .className ("Formula" )
326
+ .classBody (goodProgram )
327
+ .packageNameRoot ("com.deephaven.test" )
328
+ .build (),
329
+ QueryCompilerRequest .builder ()
330
+ .description ("Test Bad Compile" )
331
+ .className ("Formula" )
332
+ .classBody (badProgram )
333
+ .packageNameRoot ("com.deephaven.test" )
334
+ .build (),
335
+ };
336
+
337
+ // noinspection unchecked
338
+ CompletionStageFuture .Resolver <Class <?>>[] resolvers =
339
+ (CompletionStageFuture .Resolver <Class <?>>[]) new CompletionStageFuture .Resolver [] {
340
+ CompletionStageFuture .make (),
341
+ CompletionStageFuture .make (),
342
+ };
343
+
344
+ ExecutionContext .getContext ().getQueryCompiler ().compile (requests , resolvers );
345
+
346
+ Assert .eqTrue (resolvers [1 ].getFuture ().isDone (), "resolvers[0].getFuture().isDone()" );
347
+ Assert .eqTrue (resolvers [0 ].getFuture ().isDone (), "resolvers[0].getFuture().isDone()" );
348
+ Assert .neqNull (resolvers [0 ].getFuture ().get (), "resolvers[1].getFuture().get()" );
349
+ }
313
350
}
0 commit comments