Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ private void closedInstance(DataSourceImpl instance) {
}

/**
* A builder for feature flag configurations to be used with {@link TestData}.
*
* A builder for feature flag configurations to be used with {@link TestData} and {@link TestDataV2}.
*
* @see TestData#flag(String)
* @see TestData#update(FlagBuilder)
*/
Expand All @@ -269,18 +269,20 @@ public static final class FlagBuilder {
final Map<ContextKind, Map<Integer, ImmutableSet<String>>> targets = new TreeMap<>(); // TreeMap enforces ordering for test determinacy
final List<FlagRuleBuilder> rules = new ArrayList<>();

private FlagBuilder(String key) {
FlagBuilder(String key) {
this.key = key;
this.on = true;
this.variations = new CopyOnWriteArrayList<>();
}

private FlagBuilder(FlagBuilder from) {
FlagBuilder(FlagBuilder from) {
Comment thread
cursor[bot] marked this conversation as resolved.
this.key = from.key;
this.offVariation = from.offVariation;
this.on = from.on;
this.fallthroughVariation = from.fallthroughVariation;
this.variations = new CopyOnWriteArrayList<>(from.variations);
this.samplingRatio = from.samplingRatio;
this.migrationCheckRatio = from.migrationCheckRatio;
for (ContextKind contextKind: from.targets.keySet()) {
this.targets.put(contextKind, new TreeMap<>(from.targets.get(contextKind)));
}
Expand Down Expand Up @@ -811,6 +813,8 @@ private static int variationForBoolean(boolean value) {
* {@link #thenReturn(int)} to finish defining the rule.
*/
public final class FlagRuleBuilder {
// TODO: Move FlagRuleBuilder to TestDataV2 when TestData is deprecated

final List<Clause> clauses = new ArrayList<>();
int variation;

Expand Down
Loading