From 9b561829520fb601fd1e723875afb903e7b8c8ad Mon Sep 17 00:00:00 2001 From: Rob Johansen Date: Fri, 8 Sep 2023 09:14:06 +0100 Subject: [PATCH] fix NPE for Optional lookup in MockProblemChangeDirector (#2871) --- .../test/api/solver/change/MockProblemChangeDirector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optaplanner-test/src/main/java/org/optaplanner/test/api/solver/change/MockProblemChangeDirector.java b/optaplanner-test/src/main/java/org/optaplanner/test/api/solver/change/MockProblemChangeDirector.java index 5afc7550785..55e8abda188 100644 --- a/optaplanner-test/src/main/java/org/optaplanner/test/api/solver/change/MockProblemChangeDirector.java +++ b/optaplanner-test/src/main/java/org/optaplanner/test/api/solver/change/MockProblemChangeDirector.java @@ -100,7 +100,7 @@ public EntityOrProblemFact lookUpWorkingObjectOrFail(Entit @Override public Optional lookUpWorkingObject(EntityOrProblemFact externalObject) { - return Optional.of((EntityOrProblemFact) lookUpTable.get(externalObject)); + return Optional.ofNullable((EntityOrProblemFact) lookUpTable.get(externalObject)); } @Override