Add Java GSDK unit tests and CI workflow#195
Merged
dgkanatsios merged 3 commits intomainfrom Mar 3, 2026
Merged
Conversation
Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Add 84 unit tests across 8 test classes covering: - ConnectedPlayer data class - SessionHostHeartbeatInfo getters/setters and JSON deserialization - SessionConfig including ToMapAllStrings - Operation enum Gson serialization with @SerializedName casings - MaintenanceSchedule/MaintenanceEvent deserialization - JsonFileConfiguration config file parsing and validation - GameHostHealth/SessionHostStatus enum values - GameserverSDK public API constant keys Add .github/workflows/java-tests.yml CI workflow to run tests on PRs. Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add unit tests for the Java GSDK
Add Java GSDK unit tests and CI workflow
Mar 3, 2026
dgkanatsios
approved these changes
Mar 3, 2026
Copilot AI
added a commit
that referenced
this pull request
Mar 19, 2026
* Initial plan * Initial plan for Java GSDK unit tests Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com> * Add Java GSDK unit tests and CI workflow Add 84 unit tests across 8 test classes covering: - ConnectedPlayer data class - SessionHostHeartbeatInfo getters/setters and JSON deserialization - SessionConfig including ToMapAllStrings - Operation enum Gson serialization with @SerializedName casings - MaintenanceSchedule/MaintenanceEvent deserialization - JsonFileConfiguration config file parsing and validation - GameHostHealth/SessionHostStatus enum values - GameserverSDK public API constant keys Add .github/workflows/java-tests.yml CI workflow to run tests on PRs. Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copilot AI
added a commit
that referenced
this pull request
Mar 19, 2026
* Initial plan * Initial plan for Java GSDK unit tests Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com> * Add Java GSDK unit tests and CI workflow Add 84 unit tests across 8 test classes covering: - ConnectedPlayer data class - SessionHostHeartbeatInfo getters/setters and JSON deserialization - SessionConfig including ToMapAllStrings - Operation enum Gson serialization with @SerializedName casings - MaintenanceSchedule/MaintenanceEvent deserialization - JsonFileConfiguration config file parsing and validation - GameHostHealth/SessionHostStatus enum values - GameserverSDK public API constant keys Add .github/workflows/java-tests.yml CI workflow to run tests on PRs. Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
dgkanatsios
added a commit
that referenced
this pull request
Mar 19, 2026
* Initial plan * Initial plan for Java GSDK unit tests Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com> * Add Java GSDK unit tests and CI workflow Add 84 unit tests across 8 test classes covering: - ConnectedPlayer data class - SessionHostHeartbeatInfo getters/setters and JSON deserialization - SessionConfig including ToMapAllStrings - Operation enum Gson serialization with @SerializedName casings - MaintenanceSchedule/MaintenanceEvent deserialization - JsonFileConfiguration config file parsing and validation - GameHostHealth/SessionHostStatus enum values - GameserverSDK public API constant keys Add .github/workflows/java-tests.yml CI workflow to run tests on PRs. Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Adds 84 unit tests for the Java GSDK and a GitHub Actions workflow to run them on PRs. Mirrors the approach taken for C# (#191) and C++ (#192).
Tests — 8 test classes in
java/gameserverSDK/src/test/java/com/microsoft/azure/gaming/:OperationTest(20) — Gson@SerializedNamedeserialization across all casings (continue,Continue,CONTINUE)JsonFileConfigurationTest(17) — Config file parsing, alternate key casings, validation errors for missing endpoint/serverIdSessionHostHeartbeatInfoTest(14) — Heartbeat response model + Gson deserialization withZonedDateTimeGameserverSDKConstantsTest(10) — Public API key constants stabilitySessionConfigTest(7) —ToMapAllStrings(), JSON round-tripMaintenanceScheduleTest(7) — Schedule/event deserialization, multi-event/resource scenariosEnumTest(5) —GameHostHealth,SessionHostStatusvalues and serializationConnectedPlayerTest(4) — Data class edge casesCI workflow —
.github/workflows/java-tests.yml:java/**ubuntu-latestto matchsourceCompatibility = 1.8:gameserverSDK:testOther:
.gitignoreupdated to excludeGSDK_output_*.txtlog files generated during test runs.Special notes for your reviewer:
JsonFileConfigurationTestuses reflection to set environment variables (System.getenv()internal map) since the production code reads config file paths from env vars directly. This works reliably on JDK 8 which is the target. A cleaner approach would require refactoringJsonFileConfigurationto accept an injectable config source (similar to C#'sISystemOperations), but that's a larger change.If applicable:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.