Skip to content

Commit 04f961c

Browse files
author
Bruce Eckel
committed
Might work now with gradle
1 parent ca25b1a commit 04f961c

File tree

85 files changed

+199
-2660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+199
-2660
lines changed

annotations/AtUnitComposition.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Creating non-embedded tests
6+
// {main: onjava.atunit.AtUnit}
7+
// {Args: build/classes/main/annotations/AtUnitComposition.class}
68
package annotations;
79
import onjava.atunit.*;
810
import onjava.*;
@@ -16,11 +18,6 @@ public class AtUnitComposition {
1618
@Test boolean _methodTwo() {
1719
return testObject.methodTwo() == 2;
1820
}
19-
public static void
20-
main(String[] args) throws Exception {
21-
OSExecute.command("java -cp .. " +
22-
"onjava.atunit.AtUnit AtUnitComposition.class");
23-
}
2421
}
2522
/* Output:
2623
annotations.AtUnitComposition

annotations/AtUnitExample1.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
// {main: onjava.atunit.AtUnit}
6+
// {Args: build/classes/main/annotations/AtUnitExample1.class}
57
package annotations;
68
import onjava.atunit.*;
79
import onjava.*;
@@ -22,11 +24,6 @@ public int methodTwo() {
2224
// Shows output for failure:
2325
@Test boolean failureTest() { return false; }
2426
@Test boolean anotherDisappointment() { return false; }
25-
public static void
26-
main(String[] args) throws Exception {
27-
OSExecute.command("java -cp .. " +
28-
"onjava.atunit.AtUnit AtUnitExample1.class");
29-
}
3027
}
3128
/* Output:
3229
annotations.AtUnitExample1

annotations/AtUnitExample2.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Assertions and exceptions can be used in @Tests
6+
// {main: onjava.atunit.AtUnit}
7+
// {Args: build/classes/main/annotations/AtUnitExample2.class}
68
package annotations;
79
import java.io.*;
810
import onjava.atunit.*;
@@ -30,11 +32,6 @@ public int methodTwo() {
3032
assert methodTwo() == 2: "methodTwo must equal 2";
3133
return methodOne().equals("This is methodOne");
3234
}
33-
public static void
34-
main(String[] args) throws Exception {
35-
OSExecute.command("java -cp .. " +
36-
"onjava.atunit.AtUnit AtUnitExample2.class");
37-
}
3835
}
3936
/* Output:
4037
annotations.AtUnitExample2

annotations/AtUnitExample3.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
// {main: onjava.atunit.AtUnit}
6+
// {Args: build/classes/main/annotations/AtUnitExample3.class}
57
package annotations;
68
import onjava.atunit.*;
79
import onjava.*;
@@ -25,11 +27,6 @@ public int methodTwo() {
2527
return methodOne().equals("This is methodOne");
2628
}
2729
@Test boolean m2() { return methodTwo() == 2; }
28-
public static void
29-
main(String[] args) throws Exception {
30-
OSExecute.command("java -cp .. " +
31-
"onjava.atunit.AtUnit AtUnitExample3.class");
32-
}
3330
}
3431
/* Output:
3532
annotations.AtUnitExample3

annotations/AtUnitExample4.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
// {main: onjava.atunit.AtUnit}
6+
// {Args: build/classes/main/annotations/AtUnitExample4.class}
57
package annotations;
68
import java.util.*;
79
import onjava.atunit.*;
@@ -53,12 +55,6 @@ public String scrambleWord() {
5355
System.out.println(scrambled);
5456
return scrambled.equals("tsaeborornussu");
5557
}
56-
public static void
57-
main(String[] args) throws Exception {
58-
System.out.println("starting");
59-
OSExecute.command("java -cp .. " +
60-
"onjava.atunit.AtUnit AtUnitExample4.class");
61-
}
6258
}
6359
/* Output:
6460
starting

annotations/AtUnitExample5.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
// {main: onjava.atunit.AtUnit}
6+
// {Args: build/classes/main/annotations/AtUnitExample5.class}
57
package annotations;
68
import java.io.*;
79
import onjava.atunit.*;
@@ -40,11 +42,6 @@ public class AtUnitExample5 {
4042
output.print("test3");
4143
return true;
4244
}
43-
public static void
44-
main(String[] args) throws Exception {
45-
OSExecute.command("java -cp .. " +
46-
"onjava.atunit.AtUnit AtUnitExample5.class");
47-
}
4845
}
4946
/* Output:
5047
annotations.AtUnitExample5

annotations/AtUnitExternalTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Creating non-embedded tests
6+
// {main: onjava.atunit.AtUnit}
7+
// {Args: build/classes/main/annotations/AtUnitExternalTest.class}
68
package annotations;
79
import onjava.atunit.*;
810
import onjava.*;
@@ -12,11 +14,6 @@ public class AtUnitExternalTest extends AtUnitExample1 {
1214
return methodOne().equals("This is methodOne");
1315
}
1416
@Test boolean _methodTwo() { return methodTwo() == 2; }
15-
public static void
16-
main(String[] args) throws Exception {
17-
OSExecute.command("java -cp .. " +
18-
"onjava.atunit.AtUnit AtUnitExternalTest.class");
19-
}
2017
}
2118
/* Output:
2219
annotations.AtUnitExternalTest

annotations/HashSetTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// (c)2016 MindView LLC: see Copyright.txt
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
5+
// {main: onjava.atunit.AtUnit}
6+
// {Args: build/classes/main/annotations/HashSetTest.class}
57
package annotations;
68
import java.util.*;
79
import onjava.atunit.*;
@@ -21,11 +23,6 @@ public class HashSetTest {
2123
testObject.remove("one");
2224
assert testObject.isEmpty();
2325
}
24-
public static void
25-
main(String[] args) throws Exception {
26-
OSExecute.command("java -cp .. " +
27-
"onjava.atunit.AtUnit HashSetTest.class");
28-
}
2926
}
3027
/* Output:
3128
annotations.HashSetTest

annotations/StackLStringTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// We make no guarantees that this code is fit for any purpose.
44
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55
// Applying @Unit to generics
6+
// {main: onjava.atunit.AtUnit}
7+
// {Args: build/classes/main/annotations/StackLStringTest.class}
68
package annotations;
79
import onjava.atunit.*;
810
import onjava.*;
@@ -26,11 +28,6 @@ public class StackLStringTest extends StackL<String> {
2628
assert top().equals("B");
2729
assert top().equals("B");
2830
}
29-
public static void
30-
main(String[] args) throws Exception {
31-
OSExecute.command("java -cp .. " +
32-
"onjava.atunit.AtUnit StackLStringTest.class");
33-
}
3431
}
3532
/* Output:
3633
annotations.StackLStringTest

annotations/build.xml

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)