Tag: java
All the articles with the tag "java".
-
Expanding Test Coverage to Multiple Actions and the Spring Controller
Using ChatGPT to scaffold unit tests for multiple Action classes and the CatanController, and investigating unexpected Spring request body serialization behavior with @RequestBody and custom DTOs.
-
Writing Unit Tests for PlaceSettlementAction
Writing unit tests for PlaceSettlementAction by thinking through meaningful test cases, setting up game state fixtures, and using ChatGPT to scaffold new test files based on existing IAction test patterns.
-
Implementing the New FSM Transition Design with Regression Testing
Translating existing States, Glides, and Transitions into the simplified Transition-first FSM design, introducing ActionEnum.NOOP for free transitions, and manually regression testing the results through CLI automation scripts.
-
Simplifying the FSM by Removing Glides and Adopting ActionEnum.NOOP
Redesigning the Finite State Machine to eliminate Glides and StateBase, representing free transitions with ActionEnum.NOOP, and adopting a strategy-pattern ActionEnum that delegates to concrete action implementations.
-
Printing the FSM Definition at Startup and Discovering a Design Code Smell
Adding startup logging to print all FSM transitions for visibility, then uncovering a design smell where Glides duplicate information from parent Actions—motivating a refactor that removes StateBase and replaces Glides with enriched Transitions.
-
Improving CatanGraph Test Coverage and Catching a HashMap Overwrite Bug
Expanding CatanGraph unit tests to cover all branches, overriding equals and hashCode on ResourceBundle for readable assertions, and discovering a real bug where Road adjacency entries were silently overwritten by Hexagon entries in a HashMap.
-
Introducing ResourceBundle for Player Resources and Expanding Unit Test Coverage
Creating a ResourceBundle class to encapsulate each player's resource cards, using Jackson's @JsonUnwrapped for clean JSON serialization, and mocking random roll results in unit tests with Mockito's MockedStatic.
-
Refactoring Graph Data Structures and Loading Board Layout from Files
Updating CatanGraph to use full GraphNode objects as HashMap keys, adding Hexagons into the graph structure for easier adjacency lookups, and reading hardcoded board adjacency data from JSON resource files instead.