Skip to content

Commit d5916da

Browse files
authored
Merge pull request GoogleCloudPlatform#260 from GoogleCloudPlatform/tswast-update-java-repo-tools
update java repo tools
2 parents 7ea9632 + 4b48de9 commit d5916da

File tree

7 files changed

+62
-27
lines changed

7 files changed

+62
-27
lines changed

java-repo-tools/.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
# limitations under the License.
1414
language: java
1515
jdk:
16-
- oraclejdk7
17-
- oraclejdk8
16+
- oraclejdk7
17+
- oraclejdk8
1818
script: mvn verify
1919
after_success:
20-
- mvn clean cobertura:cobertura coveralls:report
20+
- bash <(curl -s https://codecov.io/bash)
2121
branches:
2222
only:
2323
- master

java-repo-tools/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![Build
44
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)
57

68
This is a collection of common tools used to maintain and test Java repositories
79
in the [GoogleCloudPlaftorm](https://github.com/GoogleCloudPlatform)

java-repo-tools/codecov.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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

java-repo-tools/pom.xml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff 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>

java-repo-tools/test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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>

java-repo-tools/test/src/main/java/com/google/cloud/samples/test/App.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
* A hello world app to test the parent pom.xml.
2121
*/
2222
public 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
}

java-repo-tools/test/src/test/java/com/google/cloud/samples/test/AppTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,21 @@
2222
import org.junit.runner.RunWith;
2323
import 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)
2932
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!");
3241
}
3342
}

0 commit comments

Comments
 (0)