File tree Expand file tree Collapse file tree 5 files changed +30
-2
lines changed
tests/net.sf.j2s.test.junit/src/net/sf/j2s/test/junit Expand file tree Collapse file tree 5 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 1818public class AllBasicTests extends TestCase {
1919
2020 public static Test suite () {
21- TestSuite suite = new TestSuite ("Kernel " );
21+ TestSuite suite = new TestSuite ("All Basic Tests " );
2222
2323 suite .addTestSuite (FieldInitTest .class );
2424 suite .addTestSuite (OverloadTest .class );
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public void testOverloadedConstructorBoolean() {
8282
8383 new C (true );
8484
85- assertEquals ("C(true)\n " , Output .text ());
85+ assertEquals ("C(true)\n C.baz() \ n " , Output .text ());
8686 }
8787
8888
Original file line number Diff line number Diff line change @@ -27,6 +27,19 @@ public void testSuperClassConstructorCallsOverridingMethod() {
2727 new C1 ();
2828 assertEquals ("C()\n C1.foo()\n C.bar()\n C1()\n " , Output .text ());
2929 }
30+
31+ /**
32+ * A call in a superclass constructor to a private method ("baz") does
33+ * not run a (public) subclass method with the same signature but the
34+ * method in the superclass.
35+ *
36+ */
37+ public void testSuperClassConstructorCallsPrivatePseudoOverriddenMethod () {
38+ Output .clear ();
39+
40+ new C1 (true );
41+ assertEquals ("C(true)\n C.baz()\n C1(true)\n C1.baz()\n " , Output .text ());
42+ }
3043}
3144
3245
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ public C(double n) {
4343
4444 public C (boolean b ) {
4545 Output .add ("C(" +b +")\n " );
46+ baz ();
4647 }
4748
4849 public void foo () {
@@ -52,4 +53,8 @@ public void foo() {
5253 public void bar () {
5354 Output .add ("C.bar()\n " );
5455 }
56+
57+ private void baz () {
58+ Output .add ("C.baz()\n " );
59+ }
5560}
Original file line number Diff line number Diff line change @@ -19,8 +19,18 @@ public C1() {
1919 Output .add ("C1()\n " );
2020 }
2121
22+ public C1 (boolean b ) {
23+ super (b );
24+ Output .add ("C1(" +b +")\n " );
25+ baz ();
26+ }
27+
2228 public void foo () {
2329 Output .add ("C1.foo()\n " );
2430 }
2531
32+ public void baz () {
33+ Output .add ("C1.baz()\n " );
34+ }
35+
2636}
You can’t perform that action at this time.
0 commit comments