File tree Expand file tree Collapse file tree 7 files changed +62
-27
lines changed
main/java/com/google/cloud/samples/test
test/java/com/google/cloud/samples/test Expand file tree Collapse file tree 7 files changed +62
-27
lines changed Original file line number Diff line number Diff line change 1313# limitations under the License.
1414language : java
1515jdk :
16- - oraclejdk7
17- - oraclejdk8
16+ - oraclejdk7
17+ - oraclejdk8
1818script : mvn verify
1919after_success :
20- - mvn clean cobertura:cobertura coveralls:report
20+ - bash <(curl -s https://codecov.io/bash)
2121branches :
2222 only :
2323 - master
Original file line number Diff line number Diff line change 22
33[ ![ Build
44Status] ( 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 )
57
68This is a collection of common tools used to maintain and test Java repositories
79in 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.
7575 <execution ><goals ><goal >check</goal ></goals ></execution >
7676 </executions >
7777 </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 >
97102 </plugins >
98103 </build >
99104</project >
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ limitations under the License.
4141 <dependency >
4242 <groupId >com.google.truth</groupId >
4343 <artifactId >truth</artifactId >
44- <version >0.27 </version >
44+ <version >0.28 </version >
4545 <scope >test</scope >
4646 </dependency >
4747 </dependencies >
Original file line number Diff line number Diff line change 2020 * A hello world app to test the parent pom.xml.
2121 */
2222public class App {
23- public static String greeting () {
23+ public String greeting () {
2424 return "Hello World!" ;
2525 }
2626
2727 public static void main (String [] args ) {
28- System .out .println (App .greeting ());
28+ App app = new App ();
29+ System .out .println (app .greeting ());
2930 }
3031}
Original file line number Diff line number Diff line change 2222import org .junit .runner .RunWith ;
2323import org .junit .runners .JUnit4 ;
2424
25+ import java .io .ByteArrayOutputStream ;
26+ import java .io .PrintStream ;
27+
2528/**
2629 * Unit tests for {@link App}.
2730 */
2831@ RunWith (JUnit4 .class )
2932public 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!" );
3241 }
3342}
You can’t perform that action at this time.
0 commit comments