Skip to content

Commit 4a3565a

Browse files
committed
unit test integration
1 parent 8f16e06 commit 4a3565a

1 file changed

Lines changed: 32 additions & 14 deletions

File tree

build.gradle

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
11
apply plugin: 'java'
22
apply plugin: 'eclipse'
3-
4-
jar.baseName = 'JSON-java'
3+
apply plugin: 'jacoco'
54

65
sourceSets {
7-
test {
8-
java {
9-
srcDir 'src/test'
6+
// Uncomment main if you have merged JSON-Java and JSON-Java-unit-test code
7+
main {
8+
java {
9+
srcDir 'src'
10+
exclude 'test/'
11+
}
12+
}
13+
test {
14+
java {
15+
srcDir 'src/test'
16+
}
1017
}
11-
}
1218
}
1319

1420
repositories {
15-
mavenCentral()
21+
mavenCentral()
1622
}
1723

1824
dependencies {
19-
testCompile group: 'junit', name: 'junit', version: '4.+'
20-
testCompile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.1.0'
21-
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
22-
// Use this line if you are testing a JSON-Java release.
23-
// Otherwise add an external jar from your local repository in Eclipse
24-
// (The gradle build won't work unless you add a main sourceSets entry and a jar.baseName entry
25-
// testCompile group: 'org.json', name: 'json', version: '20151123'
25+
testCompile group: 'junit', name: 'junit', version: '4.+'
26+
testCompile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.1.0'
27+
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
28+
// Uncomment if you are testing against a JSON-Java release
29+
// testCompile 'org.json:json:20160212'
30+
// Uncomment if you have copied a local JSON-Java jar file into this project
31+
// testCompile files('./JSON-Java.jar')
2632
}
33+
34+
test { finalizedBy jacocoTestReport }
35+
jacocoTestReport{
36+
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
37+
reports {
38+
xml.enabled false
39+
csv.enabled false
40+
html.destination "${buildDir}/reports/jacoco/html"
41+
}
42+
executionData = files('build/jacoco/test.exec')
43+
}
44+

0 commit comments

Comments
 (0)