Skip to content

Commit

Permalink
adding code coverage github action, removing folders in bin/ folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael7371 committed Feb 26, 2025
1 parent a747312 commit 1447a2e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 107 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test & Coverage

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run Tests with Coverage
working-directory: ./j2735-2024
run: ./gradlew test jacocoTestReport

- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: j2735-2024/build/reports/jacoco/test/html/

- name: Add Coverage PR Comment
uses: madrapps/jacoco-report@v1.6.1
if: github.event_name == 'pull_request'
with:
paths: ${{ github.workspace }}/j2735-2024/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 80
min-coverage-changed-files: 80
Binary file not shown.

This file was deleted.

4 changes: 4 additions & 0 deletions j2735-2024/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ test {

jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public void xmlDeserialize_generatedXml_basicDeserialization() throws IOExceptio
assertThat(psm, notNullValue());
}


@Test
public void jsonDeserialize_generatedJson() throws IOException {
PersonalSafetyMessage psm = fromJson(loadResource("/j2735/PersonalSafetyMessage/json/GeneratedPsm.json"));
assertThat(psm, notNullValue());
}


@Test
public void serializeDeserialize_humanPropelledType() throws IOException {
PersonalSafetyMessage psm = new PersonalSafetyMessage();
Expand Down Expand Up @@ -84,15 +92,6 @@ public void serializeDeserialize_animalPropelledType() throws IOException {
assertThat(deserializedFromJson.getPropulsion().getAnimal(), is(animalType));
}

@Test
public void jsonDeserialize_generatedJson() throws IOException {
PersonalSafetyMessage psm = fromJson(loadResource("/j2735/PersonalSafetyMessage/json/GeneratedPsm.json"));
assertThat(psm, notNullValue());

String json = toJson(psm);
System.out.println(json);
}

@Test
public void roundTripSerialization_withHumanPropulsion() throws IOException {
PersonalSafetyMessage original = new PersonalSafetyMessage();
Expand Down Expand Up @@ -145,6 +144,8 @@ public void roundTripSerialization_allFieldsPopulated() throws IOException {
original.setSecMark(new DSecond(1234));
original.setMsgCnt(new MsgCount(99));
original.setId(new TemporaryID("12341234"));
original.setClusterRadius(new PersonalClusterRadius(10L));
original.setAttachmentRadius(new AttachmentRadius(10L));

PropelledInformation propInfo = new PropelledInformation();
propInfo.setMotor(MotorizedPropelledType.WHEELCHAIR);
Expand All @@ -160,5 +161,7 @@ public void roundTripSerialization_allFieldsPopulated() throws IOException {
assertThat(fromXml.getMsgCnt().getValue(), is(99L));
assertThat(fromXml.getId().getValue(), is("12341234"));
assertThat(fromXml.getPropulsion().getMotor(), is(MotorizedPropelledType.WHEELCHAIR));
assertThat(fromXml.getClusterRadius().getValue(), is(10L));
assertThat(fromXml.getAttachmentRadius().getValue(), is(10L));
}
}

0 comments on commit 1447a2e

Please sign in to comment.