Skip to content

Commit 51648c0

Browse files
committed
more tests
1 parent 5e38103 commit 51648c0

27 files changed

+173
-169
lines changed

sources/net.sf.j2s.java.core/src/test/Test_.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public int showt() {
2828
}
2929
return t;
3030
}
31+
32+
public void setT(int t) {
33+
this.t = t;
34+
}
3135

3236
public String t_test = "test_";
3337

@@ -112,14 +116,21 @@ public static void main(String[] args) {
112116
Test_Cinit.main(args);
113117
Test_Cinit2.main(args);
114118
Test_Class.main(args);
119+
Test_Class_1.main(args);
120+
Test_ClassBase.main(args);
115121
Test_Clone.main(args);
116122
Test_DivEqual.main(args);
117123
Test_Double.main(args);
118124
Test_Enum.main(args);
125+
Test_Enum2.main(args);
126+
Test_EPS.main(args);
119127
Test_Extends_6.main(args);
120128
// Test_Extends_7.main(args);
121129
// Test_Extends_JButton.main(args);
122130
Test_Extends.main(args);
131+
Test_Field_fails.main(args);
132+
Test_Field_ok.main(args);
133+
//Test_File.main(args);
123134
Test_Final.main(args);
124135
Test_Format.main(args);
125136
Test_Generic_Java8.main(args);
@@ -133,6 +144,7 @@ public static void main(String[] args) {
133144
Test_Interface.main(args);
134145
Test_Interface2.main(args);
135146
Test_Intern.main(args);
147+
Test_Interval.main(args);
136148
Test_Ints.main(args);
137149
Test_J8_Generic2.main(args);
138150
Test_J8_Stream.main(args);

sources/net.sf.j2s.java.core/src/test/Test_Class.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Hashtable;
1111

1212
@SuppressWarnings("rawtypes")
13-
class Test_Class extends Test_Class2 {
13+
class Test_Class extends Test_Class2<Integer> {
1414

1515
Test_Class(byte[]...d) {
1616
super(d);
@@ -109,12 +109,19 @@ public void propertyChange(PropertyChangeEvent event) {
109109
final Test_Class me = Test_Class.this;
110110
MouseListener c = new MouseListener() {
111111

112+
public int showt() {
113+
return 2;
114+
}
115+
112116
@Override
113117
public void mouseClicked(MouseEvent e) {
114118
System.out.println("mouseClicked1");
115-
Test_Class.this.showt();
116-
showt();
119+
// test of qualified this
120+
setT(1);
121+
assert(Test_Class.this.showt() == 1);
122+
assert(showt() == 2);
117123
assert(Test_Class.this == me);
124+
setT(0);
118125
System.out.println("mouseClicked2");
119126
}
120127

@@ -371,6 +378,19 @@ public static void testStatic() {
371378

372379
}
373380

381+
382+
public void testAbstract(int i, Integer n, long j) {
383+
System.out.println("OK -- Test_Class.testAbstract int Integer long");
384+
385+
}
386+
387+
public void testAbstract(int i, Double n, long j) {
388+
System.out.println("OHOH!!!!!!!!!!!!!!!!!!!!!!!!!");
389+
//assert(false);
390+
391+
}
392+
393+
374394
}
375395

376396
class Test_class1 {

sources/net.sf.j2s.java.core/src/test/Test_Class2.java

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.beans.PropertyChangeListener;
77
import java.util.Hashtable;
88

9-
class Test_Class2 extends Test_ implements Test_Class_int {
9+
abstract class Test_Class2<T extends Number> extends Test_ implements Test_Class_int {
1010

1111

1212
static {
@@ -42,66 +42,71 @@ protected String getTesting() {
4242

4343
public Test_Class2() {
4444

45-
PropertyChangeListener l = new PropertyChangeListener() {
46-
@Override
47-
public void propertyChange(PropertyChangeEvent event) {
48-
// Let the defaultCloseOperation handle the closing
49-
// if the user closed the window without selecting a button
50-
// (newValue = null in that case). Otherwise, close the dialog.
51-
Test_Class2 x = Test_Class2.this;
52-
System.out.println(x);
53-
}
54-
};
45+
// PropertyChangeListener l = new PropertyChangeListener() {
46+
// @Override
47+
// public void propertyChange(PropertyChangeEvent event) {
48+
// // Let the defaultCloseOperation handle the closing
49+
// // if the user closed the window without selecting a button
50+
// // (newValue = null in that case). Otherwise, close the dialog.
51+
// Test_Class2 x = Test_Class2.this;
52+
// System.out.println(x);
53+
// }
54+
// };
5555

5656
System.out.println("TestClass2() constructor ");
5757

58-
final Test_Class2 me = Test_Class2.this;
59-
MouseListener c = new MouseListener() {
60-
61-
@Override
62-
public void mouseClicked(MouseEvent e) {
63-
System.out.println("!!!");
64-
Test_Class2.this.showt();
65-
showt();
66-
assert (Test_Class2.this == me);
67-
System.out.println("!!!");
68-
}
69-
70-
@Override
71-
public void mousePressed(MouseEvent e) {
72-
// TODO Auto-generated method stub
73-
74-
}
75-
76-
@Override
77-
public void mouseReleased(MouseEvent e) {
78-
// TODO Auto-generated method stub
79-
80-
}
81-
82-
@Override
83-
public void mouseEntered(MouseEvent e) {
84-
// TODO Auto-generated method stub
85-
86-
}
87-
88-
@Override
89-
public void mouseExited(MouseEvent e) {
90-
// TODO Auto-generated method stub
91-
92-
}
93-
94-
};
58+
// final Test_Class2 me = Test_Class2.this;
59+
// MouseListener c = new MouseListener() {
60+
//
61+
// @Override
62+
// public void mouseClicked(MouseEvent e) {
63+
// System.out.println("!!!");
64+
// Test_Class2.this.showt();
65+
// showt();
66+
// assert (Test_Class2.this == me);
67+
// System.out.println("!!!");
68+
// }
69+
//
70+
// @Override
71+
// public void mousePressed(MouseEvent e) {
72+
// // TODO Auto-generated method stub
73+
//
74+
// }
75+
//
76+
// @Override
77+
// public void mouseReleased(MouseEvent e) {
78+
// // TODO Auto-generated method stub
79+
//
80+
// }
81+
//
82+
// @Override
83+
// public void mouseEntered(MouseEvent e) {
84+
// // TODO Auto-generated method stub
85+
//
86+
// }
87+
//
88+
// @Override
89+
// public void mouseExited(MouseEvent e) {
90+
// // TODO Auto-generated method stub
91+
//
92+
// }
93+
//
94+
// };
9595
}
9696

9797
public Test_Class2(byte[]... d) {
9898
System.out.println("Test_Class2 len = " + d.length);
99+
testAbstract(3, null, 40);
99100
}
100101

101-
public static void main(String[] args) {
102-
new Test_Class2();
103-
new Test_Class2();
104-
105-
}
102+
// public static void main(String[] args) {
103+
// //new Test_Class2();
104+
// //new Test_Class2();
105+
//
106+
// }
107+
108+
public abstract void testAbstract(int i, T n, long j);
109+
110+
// public abstract void testAbstract(int i, Integer n, long j);
106111

107112
}

sources/net.sf.j2s.java.core/src/test/Test_Class3.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package test;
22

3-
import java.awt.event.MouseEvent;
4-
import java.awt.event.MouseListener;
5-
import java.beans.PropertyChangeEvent;
6-
import java.beans.PropertyChangeListener;
7-
import java.util.Hashtable;
8-
93
class Test_Class3 extends Test_ {
104

115
// Test_Class3 static init

sources/net.sf.j2s.java.core/src/test/Test_Class3a.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package test;
22

3-
import java.awt.event.MouseEvent;
4-
import java.awt.event.MouseListener;
5-
import java.beans.PropertyChangeEvent;
6-
import java.beans.PropertyChangeListener;
7-
import java.util.Hashtable;
8-
93
class Test_Class3a extends Test_Class4 {
104

115
// extends a class

sources/net.sf.j2s.java.core/src/test/Test_Class3b.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package test;
22

3-
import java.awt.event.MouseEvent;
4-
import java.awt.event.MouseListener;
5-
import java.beans.PropertyChangeEvent;
6-
import java.beans.PropertyChangeListener;
7-
import java.util.Hashtable;
8-
93
class Test_Class3b extends Test_ {
104

115
// Test_Class5 static init

sources/net.sf.j2s.java.core/src/test/Test_Class3c.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package test;
22

3-
import java.awt.event.MouseEvent;
4-
import java.awt.event.MouseListener;
5-
import java.beans.PropertyChangeEvent;
6-
import java.beans.PropertyChangeListener;
7-
import java.util.Hashtable;
8-
93
class Test_Class3c extends Test_ {
104

115
// demonstration that referencing a static runs the static initializers in reverse order

sources/net.sf.j2s.java.core/src/test/Test_Class3d.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package test;
22

3-
import java.awt.event.MouseEvent;
4-
import java.awt.event.MouseListener;
5-
import java.beans.PropertyChangeEvent;
6-
import java.beans.PropertyChangeListener;
7-
import java.util.Hashtable;
8-
93
class Test_Class3d extends Test_ implements Test_Class3dint {
104

115
// reference to interface field -- interface static init called

sources/net.sf.j2s.java.core/src/test/Test_Class3d2.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package test;
22

3-
import java.awt.event.MouseEvent;
4-
import java.awt.event.MouseListener;
5-
import java.beans.PropertyChangeEvent;
6-
import java.beans.PropertyChangeListener;
7-
import java.util.Hashtable;
8-
93
class Test_Class3d2 extends Test_ {
104

115

sources/net.sf.j2s.java.core/src/test/Test_Class3e.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
package test;
22

3-
import java.awt.event.MouseEvent;
4-
import java.awt.event.MouseListener;
5-
import java.beans.PropertyChangeEvent;
6-
import java.beans.PropertyChangeListener;
7-
import java.util.Hashtable;
8-
93
class Test_Class3e extends Test_ implements Test_Class3dint {
104

115
// just references the interface -- <clinit> not called on interface

0 commit comments

Comments
 (0)