Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Win stage2 #87

Merged
merged 3 commits into from
Dec 18, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public boolean isValid(String value, ConstraintValidatorContext context) {
final long length = value.length();
final long padding = calculatePadding(value);
final long size = (long) ((double) length * 0.75) - padding;
//Ändern des <= auf ein >= um so einen Test auszulösen der fehlschlägt.
return (size >= minLength && size <= maxLength);
//return (size >= minLength && size >= maxLength);
}

private long calculatePadding(String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Base64Validator implements ConstraintValidator<Base64, String> {
/**
* Base64 validation regular expression.
*/
private static final Pattern BASE64_PATTERN = Pattern.compile("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$");
private static final Pattern BASE64_PATTERN = Pattern.compile("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Ga-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$");

@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void isValid_withPadding0_thenTrue() {
final String base64 = createBase64StringForPadding(0);
Assertions.assertTrue(validator.isValid(base64, null));
}

//@WINStage2: Test isValid_withPadding1_thenTruealse() will fail because of a broken CodePart
@Test
void isValid_withPadding1_thenTruealse() {
final String base64 = createBase64StringForPadding(1);
Expand Down