feat: add CalcFunctionFactory for calculator operations (#13) #14
1 Participants
Due Date
Notifications
Total Time Spent: 16 seconds
pitfriedrich
16 seconds
No due date set.
Dependencies
No dependencies set.
Reference: pitfriedrich/looptest#14
Reference in New Issue
Block a user
Delete Branch "ai/issue-13"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #13
What
Adds a factory to
com.example.utilso callers can obtain aCalcFunctionwithout knowing the implementation class.CalcOperation— enum of the available operations (ADD,SUBTRACT,MULTIPLY,DIVIDE,POWER).CalcFunctionFactory.create(CalcOperation)— returns the matchingCalcFunction. Exhaustive switch over the enum, so adding an operation without wiring it up is a compile error. ThrowsIllegalArgumentExceptiononnull.LoopTestApplicationnow iteratesCalcOperation.values()and resolves each function through the factory instead of calling constructors directly.Tests
CalcFunctionFactoryTestcovers each operation's mapping, full coverage overvalues(), that a created function actually calculates, and the null rejection../mvnw verify— 30 tests, 0 failures.