diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d0ff16d --- /dev/null +++ b/.github/workflows/test.yml @@ -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 \ No newline at end of file diff --git a/j2735-2024/bin/test/j2735/PersonalSafetyMessage/PersonalSafetyMessageTest.class b/j2735-2024/bin/test/j2735/PersonalSafetyMessage/PersonalSafetyMessageTest.class deleted file mode 100644 index c76f497..0000000 Binary files a/j2735-2024/bin/test/j2735/PersonalSafetyMessage/PersonalSafetyMessageTest.class and /dev/null differ diff --git a/j2735-2024/bin/test/j2735/PersonalSafetyMessage/json/GeneratedPsm.json b/j2735-2024/bin/test/j2735/PersonalSafetyMessage/json/GeneratedPsm.json deleted file mode 100644 index c73ca2a..0000000 --- a/j2735-2024/bin/test/j2735/PersonalSafetyMessage/json/GeneratedPsm.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "basicType": "aPEDESTRIAN", - "secMark": 63364, - "msgCnt": 115, - "id": "4F435445", - "position": { - "lat": -322352782, - "long": -1390327360, - "elevation": 35204, - "regional": [] - }, - "accuracy": { - "semiMajor": 167, - "semiMinor": 30, - "orientation": 23832 - }, - "speed": 162, - "heading": 22144, - "accelSet": { - "long": 1050, - "lat": 1999, - "vert": 52, - "yaw": 2334 - }, - "pathHistory": { - "initialPosition": { - "utcTime": { - "year": 3582, - "month": 1, - "day": 21, - "hour": 24, - "minute": 39, - "second": 35644, - "offset": 649 - }, - "long": 273616426, - "lat": -138038280, - "elevation": 8370, - "heading": 25956, - "speed": { - "transmisson": "reserved3", - "speed": 44 - }, - "posAccuracy": { - "semiMajor": 156, - "semiMinor": 111, - "orientation": 21942 - }, - "timeConfidence": "time-000-000-000-001", - "posConfidence": { - "pos": "a50cm", - "elevation": "elev-000-02" - }, - "speedConfidence": { - "heading": "unavailable", - "speed": "prec10ms", - "throttle": "unavailable" - } - }, - "currGNSSstatus": "80", - "crumbData": [ - { - "latOffset": 55735, - "lonOffset": 56164, - "elevationOffset": -1108, - "timeOffset": 64042, - "speed": 3721, - "posAccuracy": { - "semiMajor": 179, - "semiMinor": 198, - "orientation": 16353 - }, - "heading": 183 - } - ] - }, - "pathPrediction": { - "radiusOfCurve": -9574, - "confidence": 26 - }, - "propulsion": { - "animal": "animalDrawnCarriage" - }, - "useState": "20", - "crossRequest": true, - "crossState": true, - "clusterSize": "unavailable", - "clusterRadius": 26, - "eventResponderType": "fireAndEMSWorker", - "activityType": "08", - "activitySubType": "40", - "assistType": "10", - "sizing": "40", - "attachment": "unavailable", - "attachmentRadius": 65, - "animalType": "serviceUse", - "regional": [] -} \ No newline at end of file diff --git a/j2735-2024/build.gradle b/j2735-2024/build.gradle index 10c6342..5cc046a 100644 --- a/j2735-2024/build.gradle +++ b/j2735-2024/build.gradle @@ -51,4 +51,8 @@ test { jacocoTestReport { dependsOn test + reports { + xml.required = true + html.required = true + } } diff --git a/j2735-2024/src/test/java/j2735/PersonalSafetyMessage/PersonalSafetyMessageTest.java b/j2735-2024/src/test/java/j2735/PersonalSafetyMessage/PersonalSafetyMessageTest.java index 6b0a8e1..0799252 100644 --- a/j2735-2024/src/test/java/j2735/PersonalSafetyMessage/PersonalSafetyMessageTest.java +++ b/j2735-2024/src/test/java/j2735/PersonalSafetyMessage/PersonalSafetyMessageTest.java @@ -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(); @@ -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(); @@ -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); @@ -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)); } }