Skip to content

Commit 1ec43d9

Browse files
committed
Initial mods
1 parent cf49b0d commit 1ec43d9

8 files changed

Lines changed: 30 additions & 98 deletions

File tree

.testspace.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mvn clean compile]]>
1515
<suite name="Tests" state="1" id=".sh" description="run **all** of the tests">
1616
<attributes>
1717
<![CDATA[mvn cobertura:cobertura -Dcobertura.report.format=xml
18-
echo "$RESULTS_DIR/TEST-TestSuite.xml" > ${self.result}]]>
18+
echo "$RESULTS_DIR/TEST-*.xml" > ${self.result}]]>
1919
</attributes>
2020
</suite>
2121
<suite name="Coverage" state="1" id=".sh" description="Code coverage based on latest run. Review the ==Reports== tab for historical tracking">

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ script:
1313
# Testspace credentials: "credentials@myorg.testspace.com/myproject/myspace
1414
- testspace config url ${TESTSPACE_USER_TOKEN}:@${TESTSPACE_URL}
1515
# Publish Test Results along with Coverage
16-
- testspace publish target/surefire-reports/TEST-TestSuite.xml target/site/cobertura/coverage.xml
16+
- testspace publish target/surefire-reports/TEST*.xml target/site/cobertura/coverage.xml

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[![Testspace](http://www.testspace.com/public/img/testspace_logo.png)](http://www.testspace.com)
22
***
33

4-
## Java/TestNG sample for demonstrating Testspace
4+
## Java/JUnit sample for demonstrating Testspace
55

6-
Sample demonstrates techniques for using Testspace with Java code and the [TestNG](http://testng.org/).
6+
Sample demonstrates techniques for using Testspace with Java code and the [JUnit](http://junit.org/).
77

88
***
99

10-
[![Build Status](https://travis-ci.org/testspace-samples/java.testng.svg?branch=master)](https://travis-ci.org/testspace-samples/java.testng)
11-
[![Space Health](https://samples.testspace.com/projects/88/spaces/325/badge)](https://samples.testspace.com/projects/88/spaces/325 "Test Cases")
12-
[![Space Metric](https://samples.testspace.com/projects/88/spaces/325/metrics/228/badge)](https://samples.testspace.com/projects/88/spaces/325/metrics#metric-228 "Line/Statement Coverage")
10+
[![Build Status](https://travis-ci.org/testspace-samples/java.junit.svg?branch=master)](https://travis-ci.org/testspace-samples/java.junit)
11+
[![Space Health](https://samples.testspace.com/projects/88/spaces/294/badge)](https://samples.testspace.com/projects/88/spaces/294 "Test Cases")
12+
[![Space Metric](https://samples.testspace.com/projects/88/spaces/294/metrics/236/badge)](https://samples.testspace.com/projects/88/spaces/294/metrics#metric-236 "Line/Statement Coverage")
1313

1414
***
1515

@@ -23,10 +23,10 @@ Build examples:
2323
Publishing results example:
2424

2525
<pre>
26-
testspace publish target/surefire-reports/TEST-TestSuite.xml target/site/cobertura/coverage.xml
26+
testspace publish target/surefire-reports/TEST*.xml target/site/cobertura/coverage.xml
2727
</pre>
2828

29-
Checkout the [Space](https://samples.testspace.com/projects/java/spaces/testng).
29+
Checkout the [Space](https://samples.testspace.com/projects/java/spaces/junit).
3030

3131
***
3232

pom.xml

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,17 @@
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.testspace.java</groupId>
5-
<artifactId>testng</artifactId>
5+
<artifactId>junit</artifactId>
66
<packaging>jar</packaging>
77
<version>1.0-SNAPSHOT</version>
8-
<name>testng</name>
8+
<name>junit</name>
99
<url>http://maven.apache.org</url>
1010
<dependencies>
1111
<dependency>
12-
<groupId>org.testng</groupId>
13-
<artifactId>testng</artifactId>
14-
<version>6.1.1</version>
12+
<groupId>junit</groupId>
13+
<artifactId>junit</artifactId>
14+
<version>3.8.1</version>
1515
<scope>test</scope>
1616
</dependency>
1717
</dependencies>
18-
<reporting>
19-
<plugins>
20-
<!-- integrate maven-cobertura-plugin to project site -->
21-
<plugin>
22-
<groupId>org.codehaus.mojo</groupId>
23-
<artifactId>cobertura-maven-plugin</artifactId>
24-
<version>2.6</version>
25-
<configuration>
26-
<formats>
27-
<format>html</format>
28-
<format>xml</format>
29-
</formats>
30-
</configuration>
31-
</plugin>
32-
</plugins>
33-
</reporting>
34-
<build>
35-
<pluginManagement>
36-
<plugins>
37-
<plugin>
38-
<groupId>org.apache.maven.plugins</groupId>
39-
<artifactId>maven-compiler-plugin</artifactId>
40-
<configuration>
41-
<source>1.7</source>
42-
<target>1.7</target>
43-
<showDeprecation>true</showDeprecation>
44-
<showWarnings>true</showWarnings>
45-
<fork>true</fork>
46-
</configuration>
47-
</plugin>
48-
</plugins>
49-
</pluginManagement>
50-
</build>
5118
</project>

shippable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: java
22

33
env:
44
global:
5-
- secure: kmMY3oyTMTfw20msctpDr3K0Q0W1pVJQAgvrJgvs72wuQW5sEdIcnMYMvXpk5nIK/QPhMU9w0yYGf93ExrkhRE6vCO3ETG4maJwg2TJa8OFnLtqmNSeT/bktmUriazb3c0gwLJ7MwBCr+3M2WMivgjlaw6F+cQt1JiyXJ5SACMWtCl7qq35JxVdiNCe69fYca596e2crdY+yASYEDiZy+fQn8EBrlEx2E2cM79nK2KPdkazAIa98K30hDQyUoDsYsVfeBJDBXauu3XFOBqSBVO5aJ+WnYNnsienTPd0Cfqfe7/9UZ3zHnnaKblNr+LU2YlJvlOu2af4IYWIdE50BEw==
5+
- secure: gcPX8hFTKTlc0fQBeNM6JJh+IcVmyBa+PrgQ/Skbi0u+IXrW/zCVdbCeqej3iTw48UeYvWhdCsoaXTrWaff6/r8MBoFgLp44+ytRI8B3qpoXleCS0Z39G1o5dmkySfzbgrBLixs809f+GoUoEGrbkN3iRuFRG2WsgpxTrHZycUy/Cg30ixxvt5SqnZvrFSRNbaNOpTPUMuo8ZArLYx4F7RKRjiJ7XM+Mkw8sj1PyOvXv6Er38t0mfRg/2Pk/989Ec+Wf2MafwYQRG1IFXeOgvOtW6nmq20tORXsYo/xrpaRsY2CMzUzHbYSHTRoTIeU4jLxoudGGqykGTOcDtoRmnw==
66

77
before_script:
88
- ./testspace_install.sh

src/test/java/com/testspace/java/list/GenericListTest.java

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,53 @@
11
package com.testspace.java.list;
22

3-
import org.testng.annotations.BeforeTest;
4-
import org.testng.annotations.Test;
5-
import static org.testng.Assert.*;
3+
import junit.framework.TestCase;
64

7-
public class GenericListTest
5+
public class GenericListTest extends TestCase
86
{
97
private int capacity;
108
private int nonPositiveCapacity;
119
private int position;
1210
private Object element;
1311
private GenericList list;
1412

15-
@BeforeTest
16-
public void setUp()
13+
public GenericListTest(String testName)
1714
{
15+
super(testName);
16+
1817
capacity = 1;
1918
nonPositiveCapacity = -1;
2019
position = 1;
2120
element = "test";
2221
}
2322

24-
@Test
2523
public void testGenericListDefaultConstructor()
2624
{
2725
GenericList list = new GenericList();
2826
assertNotNull(list);
2927
assertEquals(list.size(), 0);
3028
}
3129

32-
@Test
3330
public void testGenericListPamaterizedConstructor()
3431
{
3532
GenericList list = new GenericList(capacity);
3633
assertNotNull(list);
3734
assertEquals(list.size(), 0);
3835
}
3936

40-
@Test(expectedExceptions = IllegalArgumentException.class)
41-
public void testGenericListPamaterizedConstructorWithNonPositiveCapacity()
42-
{
43-
GenericList list = new GenericList(nonPositiveCapacity);
44-
}
45-
46-
@Test
4737
public void testSize()
4838
{
4939
GenericList list = new GenericList();
5040
list.add(element);
5141
assertEquals(list.size(), 1);
5242
}
5343

54-
@Test
5544
public void testGetElement()
5645
{
5746
GenericList list = new GenericList();
5847
list.add(element);
5948
assertEquals(list.get(0), element);
6049
}
6150

62-
@Test
6351
public void testAddElement()
6452
{
6553
GenericList list = new GenericList();
@@ -68,7 +56,6 @@ public void testAddElement()
6856
assertEquals(list.get(0), element);
6957
}
7058

71-
@Test
7259
public void testInsertElement()
7360
{
7461
GenericList list = new GenericList();
@@ -80,7 +67,6 @@ public void testInsertElement()
8067
assertEquals(list.get(1), "inserted");
8168
}
8269

83-
@Test
8470
public void testRemoveElement()
8571
{
8672
GenericList list = new GenericList();
@@ -90,14 +76,12 @@ public void testRemoveElement()
9076
assertEquals(list.size(), size - 1);
9177
}
9278

93-
@Test
9479
public void testToStringWithEmptyList()
9580
{
9681
GenericList list = new GenericList();
9782
assertEquals(list.toString(), "size: 0, elements: []");
9883
}
9984

100-
@Test
10185
public void testToString()
10286
{
10387
GenericList list = new GenericList();
@@ -106,14 +90,12 @@ public void testToString()
10690
assertEquals(list.toString(), "size: 2, elements: [test, test]");
10791
}
10892

109-
@Test
11093
public void testToStringUsingStringBufferWithEmptyList()
11194
{
11295
GenericList list = new GenericList();
11396
assertEquals(list.toStringUsingStringBuffer(), "size: 0, elements: []");
11497
}
11598

116-
@Test
11799
public void testToStringUsingStringBuffer()
118100
{
119101
GenericList list = new GenericList();
@@ -122,30 +104,26 @@ public void testToStringUsingStringBuffer()
122104
assertEquals(list.toStringUsingStringBuffer(), "size: 2, elements: [test, test]");
123105
}
124106

125-
@Test
126107
public void testEqualsNull()
127108
{
128109
GenericList list = new GenericList();
129110
assertEquals(list.equals(null), false);
130111
}
131112

132-
@Test
133113
public void testEqualsDifferentClasses()
134114
{
135115
GenericList list = new GenericList();
136116
Object obj = new Object();
137117
assertEquals(list.equals(obj), false);
138118
}
139119

140-
@Test
141120
public void testEqualsSameReference()
142121
{
143122
GenericList list = new GenericList();
144123
GenericList refList = list;
145124
assertEquals(list.equals(refList), true);
146125
}
147126

148-
@Test
149127
public void testEqualsDifferentInstances()
150128
{
151129
GenericList list = new GenericList();

src/test/java/com/testspace/java/math/MathOpsTest.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
11
package com.testspace.java.math;
22

3-
import org.testng.annotations.BeforeTest;
4-
import org.testng.annotations.Test;
5-
import static org.testng.Assert.assertEquals;
3+
import junit.framework.TestCase;
64

7-
public class MathOpsTest
5+
public class MathOpsTest extends TestCase
86
{
97

108
private int value1;
119
private int value2;
1210

13-
14-
@BeforeTest
15-
public void setUp()
11+
public MathOpsTest(String testName)
1612
{
13+
super(testName);
14+
1715
value1 = 3;
1816
value2 = 5;
1917
}
2018

21-
@Test
2219
public void testAdd1()
2320
{
2421
int total = 8;
2522
int sum = MathOps.add(value1, value2);
2623
assertEquals(sum, total);
2724
}
2825

29-
@Test
3026
public void testAdd2willFail()
3127
{
3228
int total = 8;
@@ -36,15 +32,13 @@ public void testAdd2willFail()
3632
assertEquals(sum, total);
3733
}
3834

39-
@Test
4035
public void testAdd3()
4136
{
4237
int total = 9;
4338
int sum = MathOps.add(value1, 0);
4439
assertEquals(sum, value1);
4540
}
4641

47-
@Test
4842
public void testSub1()
4943
{
5044
int total = 0;

src/test/java/com/testspace/java/string/StringOpsTest.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,53 @@
11
package com.testspace.java.string;
22

3-
import org.testng.annotations.BeforeTest;
4-
import org.testng.annotations.Test;
5-
import static org.testng.Assert.assertEquals;
3+
import junit.framework.TestCase;
64

7-
public class StringOpsTest
5+
public class StringOpsTest extends TestCase
86
{
97

108
private String sL;
119
private String sR;
1210
private String sEmpty;
1311

14-
@BeforeTest
15-
public void setUp()
12+
public StringOpsTest(String testName)
1613
{
14+
super(testName);
15+
1716
sL = "left";
1817
sR = "right";
1918
sEmpty = "";
2019
}
2120

22-
@Test
2321
public void testConcat1()
2422
{
2523
String sOut = StringOps.concat(sL, sR);
2624
assertEquals("leftright", sOut);
2725
}
2826

29-
@Test
3027
public void testConcat2()
3128
{
3229
String sOut = StringOps.concat(sEmpty, sL);
3330
assertEquals(sOut, "left");
3431
}
3532

36-
@Test
3733
public void testConcat3()
3834
{
3935
String sOut = StringOps.concat(sL, sEmpty);
4036
assertEquals(sOut, "left");
4137
}
4238

43-
@Test
4439
public void testReverse1()
4540
{
4641
String sOut = StringOps.reverse(sEmpty);
4742
assertEquals(sOut, sEmpty);
4843
}
4944

50-
@Test
5145
public void testReverse2()
5246
{
5347
String sOut = StringOps.reverse("dcba");
5448
assertEquals(sOut, "abcd");
5549
}
5650

57-
@Test
5851
public void testReverse3WillFail()
5952
{
6053
String sOut = StringOps.reverse("edcba");

0 commit comments

Comments
 (0)