Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.20</version>
<version>2.25</version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but good to bump. It also fixes some dependency conflicts when running Java 21 (on my local machine, at least)

<executions>
<execution>
<phase>validate</phase>
Expand Down
15 changes: 15 additions & 0 deletions sdk-java/src/main/java/com/spotify/confidence/ConfidenceStub.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ public <T> T getValue(String key, T defaultValue) {
return defaultValue;
}

@Override
public Confidence withContext(ConfidenceValue.Struct context) {
// No-op
return this;
}

@Override
public Confidence withContext(Map<String, ConfidenceValue> context) {
// No-op
return this;
}

@Override
public <T> FlagEvaluation<T> getEvaluation(String key, T defaultValue) {
// Use getValue to retrieve the configured value or default
Expand All @@ -78,6 +90,9 @@ public <T> FlagEvaluation<T> getEvaluation(String key, T defaultValue) {
final FlagEvaluationConfig config =
evaluationConfigMap.getOrDefault(key, new FlagEvaluationConfig("stub", "MOCK", null, null));
// Return a FlagEvaluation with the retrieved value and additional fields
if (config.errorType == null && config.errorMessage == null) {
return new FlagEvaluation<>(value, config.variant, config.reason);
}
return new FlagEvaluation<>(
value, config.variant, config.reason, config.errorType, config.errorMessage);
}
Expand Down