Skip to content

Commit

Permalink
Merge pull request #260 from GoogleCloudPlatform/tswast-update-java-r…
Browse files Browse the repository at this point in the history
…epo-tools

update java repo tools
  • Loading branch information
tswast committed Jun 28, 2016
2 parents 7ea9632 + 4b48de9 commit d5916da
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 27 deletions.
6 changes: 3 additions & 3 deletions java-repo-tools/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
# limitations under the License.
language: java
jdk:
- oraclejdk7
- oraclejdk8
- oraclejdk7
- oraclejdk8
script: mvn verify
after_success:
- mvn clean cobertura:cobertura coveralls:report
- bash <(curl -s https://codecov.io/bash)
branches:
only:
- master
2 changes: 2 additions & 0 deletions java-repo-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[![Build
Status](https://travis-ci.org/GoogleCloudPlatform/java-repo-tools.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/java-repo-tools)
[![Coverage
Status](https://codecov.io/gh/GoogleCloudPlatform/java-repo-tools/branch/master/graph/badge.svg)](https://codecov.io/gh/GoogleCloudPlatform/java-repo-tools)

This is a collection of common tools used to maintain and test Java repositories
in the [GoogleCloudPlaftorm](https://github.com/GoogleCloudPlatform)
Expand Down
18 changes: 18 additions & 0 deletions java-repo-tools/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
codecov:
branch: master
comment:
branches:
- master
43 changes: 24 additions & 19 deletions java-repo-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,30 @@ limitations under the License.
<execution><goals><goal>check</goal></goals></execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion java-repo-tools/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ limitations under the License.
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>0.27</version>
<version>0.28</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
* A hello world app to test the parent pom.xml.
*/
public class App {
public static String greeting() {
public String greeting() {
return "Hello World!";
}

public static void main(String[] args) {
System.out.println(App.greeting());
App app = new App();
System.out.println(app.greeting());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

/**
* Unit tests for {@link App}.
*/
@RunWith(JUnit4.class)
public class AppTest {
@Test public void greeting_returnsHelloWorld() {
assertThat(App.greeting()).named("greeting").isEqualTo("Hello World!");
@Test public void main_printsHelloWorld() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
System.setOut(new PrintStream(out));

App.main(new String[0]);

String greeting = out.toString();
assertThat(greeting).named("greeting").contains("Hello World!");
}
}

0 comments on commit d5916da

Please sign in to comment.