Skip to content

Commit

Permalink
Complete
Browse files Browse the repository at this point in the history
  • Loading branch information
FriggaHel committed May 2, 2024
1 parent 4168e4d commit e38fb31
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions visual-java/src/main/java/com/saucelabs/visual/VisualApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,40 +371,40 @@ public void sauceVisualCheck(String snapshotName, CheckOptions options) {
}
}

private DiffingOptionsIn.Builder setValue(DiffingOptionsIn.Builder builder, DiffingOption key, boolean value) {
private DiffingOptionsIn.Builder setDiffingOptionValue(DiffingOptionsIn.Builder builder, DiffingOption key, boolean value) {
switch (key) {
case Content:
builder.withContent(value);
break;
case Dimensions:
builder.withDimensions(value);
break;
case Position:
builder.withPosition(value);
break;
case Structure:
builder.withStructure(value);
break;
case Style:
builder.withStyle(value);
break;
case Visual:
builder.withVisual(value);
break;
case Content:
return builder.withContent(value);
case Dimensions:
return builder.withDimensions(value);
case Position:
return builder.withPosition(value);
case Structure:
return builder.withStructure(value);
case Style:
return builder.withStyle(value);
case Visual:
return builder.withVisual(value);
}
return builder;
}

private Optional<DiffingOptionsIn> generateDiffingOptions(List<DiffingOption> enableOnly, List<DiffingOption> disableOnly) {
if (enableOnly != null && !enableOnly.isEmpty()) {
DiffingOptionsIn.Builder builder = DiffingOptionsIn.builder();

for (DiffingOption option : DiffingOption.values()) {
setDiffingOptionValue(builder, option, enableOnly.contains(option));
}
return Optional.of(builder.build());
}

if (disableOnly != null && !disableOnly.isEmpty()) {

DiffingOptionsIn.Builder builder = DiffingOptionsIn.builder();
for (DiffingOption option : DiffingOption.values()) {
setDiffingOptionValue(builder, option, !disableOnly.contains(option));
}
return Optional.of(builder.build());
}

return Optional.empty();
}

Expand All @@ -414,6 +414,8 @@ private static DiffingMethod toDiffingMethod(CheckOptions options) {
}

switch (options.getDiffingMethod()) {
case BALANCED:
return DiffingMethod.BALANCED;
case EXPERIMENTAL:
return DiffingMethod.EXPERIMENTAL;
default:
Expand Down

0 comments on commit e38fb31

Please sign in to comment.