File tree 7 files changed +62
-27
lines changed
main/java/com/google/cloud/samples/test
test/java/com/google/cloud/samples/test
7 files changed +62
-27
lines changed Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
language : java
15
15
jdk :
16
- - oraclejdk7
17
- - oraclejdk8
16
+ - oraclejdk7
17
+ - oraclejdk8
18
18
script : mvn verify
19
19
after_success :
20
- - mvn clean cobertura:cobertura coveralls:report
20
+ - bash <(curl -s https://codecov.io/bash)
21
21
branches :
22
22
only :
23
23
- master
Original file line number Diff line number Diff line change 2
2
3
3
[ ![ Build
4
4
Status] ( https://travis-ci.org/GoogleCloudPlatform/java-repo-tools.svg?branch=master )] ( https://travis-ci.org/GoogleCloudPlatform/java-repo-tools )
5
+ [ ![ Coverage
6
+ Status] ( https://codecov.io/gh/GoogleCloudPlatform/java-repo-tools/branch/master/graph/badge.svg )] ( https://codecov.io/gh/GoogleCloudPlatform/java-repo-tools )
5
7
6
8
This is a collection of common tools used to maintain and test Java repositories
7
9
in the [ GoogleCloudPlaftorm] ( https://github.com/GoogleCloudPlatform )
Original file line number Diff line number Diff line change
1
+ # Copyright 2016 Google Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ codecov :
15
+ branch : master
16
+ comment :
17
+ branches :
18
+ - master
Original file line number Diff line number Diff line change @@ -75,25 +75,30 @@ limitations under the License.
75
75
<execution ><goals ><goal >check</goal ></goals ></execution >
76
76
</executions >
77
77
</plugin >
78
- <plugin >
79
- <groupId >org.jacoco</groupId >
80
- <artifactId >jacoco-maven-plugin</artifactId >
81
- <version >0.7.6.201602180812</version >
82
- <executions >
83
- <execution >
84
- <goals >
85
- <goal >prepare-agent</goal >
86
- </goals >
87
- </execution >
88
- <execution >
89
- <id >report</id >
90
- <phase >test</phase >
91
- <goals >
92
- <goal >report</goal >
93
- </goals >
94
- </execution >
95
- </executions >
96
- </plugin >
78
+ <plugin >
79
+ <groupId >org.codehaus.mojo</groupId >
80
+ <artifactId >versions-maven-plugin</artifactId >
81
+ <version >2.2</version >
82
+ </plugin >
83
+ <plugin >
84
+ <groupId >org.jacoco</groupId >
85
+ <artifactId >jacoco-maven-plugin</artifactId >
86
+ <version >0.7.6.201602180812</version >
87
+ <executions >
88
+ <execution >
89
+ <goals >
90
+ <goal >prepare-agent</goal >
91
+ </goals >
92
+ </execution >
93
+ <execution >
94
+ <id >report</id >
95
+ <phase >test</phase >
96
+ <goals >
97
+ <goal >report</goal >
98
+ </goals >
99
+ </execution >
100
+ </executions >
101
+ </plugin >
97
102
</plugins >
98
103
</build >
99
104
</project >
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ limitations under the License.
41
41
<dependency >
42
42
<groupId >com.google.truth</groupId >
43
43
<artifactId >truth</artifactId >
44
- <version >0.27 </version >
44
+ <version >0.28 </version >
45
45
<scope >test</scope >
46
46
</dependency >
47
47
</dependencies >
Original file line number Diff line number Diff line change 20
20
* A hello world app to test the parent pom.xml.
21
21
*/
22
22
public class App {
23
- public static String greeting () {
23
+ public String greeting () {
24
24
return "Hello World!" ;
25
25
}
26
26
27
27
public static void main (String [] args ) {
28
- System .out .println (App .greeting ());
28
+ App app = new App ();
29
+ System .out .println (app .greeting ());
29
30
}
30
31
}
Original file line number Diff line number Diff line change 22
22
import org .junit .runner .RunWith ;
23
23
import org .junit .runners .JUnit4 ;
24
24
25
+ import java .io .ByteArrayOutputStream ;
26
+ import java .io .PrintStream ;
27
+
25
28
/**
26
29
* Unit tests for {@link App}.
27
30
*/
28
31
@ RunWith (JUnit4 .class )
29
32
public class AppTest {
30
- @ Test public void greeting_returnsHelloWorld () {
31
- assertThat (App .greeting ()).named ("greeting" ).isEqualTo ("Hello World!" );
33
+ @ Test public void main_printsHelloWorld () {
34
+ ByteArrayOutputStream out = new ByteArrayOutputStream ();
35
+ System .setOut (new PrintStream (out ));
36
+
37
+ App .main (new String [0 ]);
38
+
39
+ String greeting = out .toString ();
40
+ assertThat (greeting ).named ("greeting" ).contains ("Hello World!" );
32
41
}
33
42
}
You can’t perform that action at this time.
0 commit comments