Browse Source

Tests: JNI-147 - "Utils: add a method to check two URIs for equality"

JNI-147
heck 1 year ago
parent
commit
d4cccefd67
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      src/java/foundation/pEp/jniadapter/Utils.java

+ 12
- 0
src/java/foundation/pEp/jniadapter/Utils.java View File

@ -4,6 +4,8 @@ import java.io.UnsupportedEncodingException;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Utils {
private Utils() { }
@ -112,4 +114,14 @@ public class Utils {
return result;
}
public static boolean URIEqual(String left, String right) {
Pattern pattern = Pattern.compile("^.*?://");
Matcher leftMatcher = pattern.matcher(left.trim());
String leftRelevant = leftMatcher.replaceAll("");
Matcher rightMatcher = pattern.matcher(right.trim());
String rightRelevant = rightMatcher.replaceAll("");
return rightRelevant.equals(leftRelevant);
}
}

Loading…
Cancel
Save