View | Details | Raw Unified | Return to bug 163600 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java (+126 lines)
Lines 309-312 Link Here
309
			},
309
			},
310
			"SUCCESS"); // expected output
310
			"SUCCESS"); // expected output
311
	}
311
	}
312
	
313
	
314
	/**
315
	 * http://dev.eclipse.org/bugs/show_bug.cgi?id=163600
316
	 */
317
	public void test014() {
318
		this.runConformTest(
319
			new String[] {
320
				"X.java",
321
				"public class X {\n" + 
322
				"\n" + 
323
				"	public static class Foo {\n" + 
324
				"		public void myMethod(boolean trash) {\n" + 
325
				"			System.out.println(\"Expecting class Foo\");\n" + 
326
				"			Class c = Foo.class;\n" + 
327
				"			System.out.println(\"Got the class \" + c);\n" + 
328
				"		}\n" + 
329
				"	}\n" + 
330
				"	public static class Bar {\n" + 
331
				"		public void myMethod(boolean doAssert) {\n" + 
332
				"			System.out.println(\"Expecting class Bar\");\n" + 
333
				"			Class c = Bar.class;\n" + 
334
				"			System.out.println(\"Got the class \" + c);\n" + 
335
				"			assert c.getName().endsWith(\"Bar\");\n" + 
336
				"		}\n" + 
337
				"	}\n" + 
338
				"	public static void main(String[] args) {\n" + 
339
				"		new Foo().myMethod(false);\n" + 
340
				"		new Bar().myMethod(false);\n" + 
341
				"	}\n" + 
342
				"}"
343
			},
344
			"Expecting class Foo\n" + 
345
			"Got the class class X$Foo\n" + 
346
			"Expecting class Bar\n" + 
347
			"Got the class class X$Bar"); // expected output
348
	}
349
	
350
	/**
351
	 * http://dev.eclipse.org/bugs/show_bug.cgi?id=163600
352
	 */
353
	public void test015() {
354
		this.runConformTest(
355
			new String[] {
356
				"X.java",
357
				"public class X {\n" + 
358
				"\n" + 
359
				"	public static class Foo {\n" + 
360
				"		public void myMethod(boolean trash) {\n" + 
361
				"			System.out.println(\"Expecting class Foo\");\n" + 
362
				"			Class c = Foo.class;\n" + 
363
				"			System.out.println(\"Got the class \" + c);\n" + 
364
				"		}\n" + 
365
				"	}\n" + 
366
				"	public static class Bar {\n" + 
367
				"		public void myMethod(boolean doAssert) {\n" + 
368
				"			System.out.println(\"Expecting class Bar\");\n" + 
369
				"			Class c = Bar.class;\n" + 
370
				"			try {\n" +
371
				"				assert c.getName().endsWith(\"Bar2\");\n" +
372
				"			} catch(AssertionError e) {\n" +
373
				"				System.out.println(\"SUCCESS\");\n" +
374
				"			}\n" +
375
				"			System.out.println(\"Got the class \" + c);\n" +
376
				"		}\n" + 
377
				"	}\n" + 
378
				"	public static void main(String[] args) {\n" + 
379
				"		new Foo().myMethod(false);\n" + 
380
				"		new Bar().myMethod(false);\n" + 
381
				"	}\n" + 
382
				"}"
383
			},
384
			"Expecting class Foo\n" + 
385
			"Got the class class X$Foo\n" + 
386
			"Expecting class Bar\n" + 
387
			"SUCCESS\n" +
388
			"Got the class class X$Bar",
389
			null, // use default classpath
390
			true, // flush previous output dir content
391
			new String[] {"-ea"});
392
	}
393
	
394
	/**
395
	 * http://dev.eclipse.org/bugs/show_bug.cgi?id=163600
396
	 */
397
	public void test016() {
398
		this.runConformTest(
399
			new String[] {
400
				"X.java",
401
				"public class X {\n" + 
402
				"\n" + 
403
				"	public static class Foo {\n" + 
404
				"		public void myMethod(boolean trash) {\n" + 
405
				"			System.out.println(\"Expecting class Foo\");\n" + 
406
				"			Class c = Foo.class;\n" + 
407
				"			System.out.println(\"Got the class \" + c);\n" + 
408
				"		}\n" + 
409
				"	}\n" + 
410
				"	public static class Bar {\n" + 
411
				"		public void myMethod(boolean doAssert) {\n" + 
412
				"			System.out.println(\"Expecting class Bar\");\n" + 
413
				"			Class c = Bar.class;\n" + 
414
				"			try {\n" +
415
				"				assert c.getName().endsWith(\"Bar2\");\n" +
416
				"				System.out.println(\"SUCCESS\");\n" +
417
				"			} catch(AssertionError e) {\n" +
418
				"				System.out.println(\"FAILED\");\n" +
419
				"			}\n" +
420
				"			System.out.println(\"Got the class \" + c);\n" +
421
				"		}\n" + 
422
				"	}\n" + 
423
				"	public static void main(String[] args) {\n" + 
424
				"		new Foo().myMethod(false);\n" + 
425
				"		new Bar().myMethod(false);\n" + 
426
				"	}\n" + 
427
				"}"
428
			},
429
			"Expecting class Foo\n" + 
430
			"Got the class class X$Foo\n" + 
431
			"Expecting class Bar\n" + 
432
			"SUCCESS\n" +
433
			"Got the class class X$Bar",
434
			null, // use default classpath
435
			true, // flush previous output dir content
436
			new String[] {"-da"});
437
	}
312
}
438
}

Return to bug 163600