@Test public void initialize_returned_result_as_expected() { assertTrue(strategyToTest.initialize("intranet-hostname-ends-with:xxx")); assertTrue(strategyToTest.initialize("intranet-hostname-ends-with: xxx")); assertTrue(strategyToTest.initialize("intranet-hostname-ends-with: xxx,yyy")); assertFalse(strategyToTest.initialize("")); assertFalse(strategyToTest.initialize(null)); assertFalse(strategyToTest.initialize("xxx,yyy")); assertFalse(strategyToTest.initialize("ends-with xxx,yyy")); assertFalse(strategyToTest.initialize(" intranet-hostname-ends-with:xxx")); assertFalse(strategyToTest.initialize("intranet-hostname-ends-with:")); }
public boolean initialize(String uriPattern) { if (uriPattern==null) { return false; } if (!uriPattern.startsWith(PREFIX)) { return false; } String values = uriPattern.substring(PREFIX.length()).trim(); if (values.isEmpty()) { return false; } String[] uriEndings = values.split(","); for (String uriEnding: uriEndings) { endsWithList.add(uriEnding.trim()); } return true; }
IntranetEndsWithURITargetResolveStrategy implements URITargetResolveStrategy { public boolean initialize(String uriPattern) { if (uriPattern==null) { return false; } if (!uriPattern.startsWith(PREFIX)) { return false; } String values = uriPattern.substring(PREFIX.length()).trim(); if (values.isEmpty()) { return false; } String[] uriEndings = values.split(","); for (String uriEnding: uriEndings) { endsWithList.add(uriEnding.trim()); } return true; } }
IntranetEndsWithURITargetResolveStrategy implements URITargetResolveStrategy { public boolean initialize(String uriPattern) { if (uriPattern==null) { return false; } if (!uriPattern.startsWith(PREFIX)) { return false; } String values = uriPattern.substring(PREFIX.length()).trim(); if (values.isEmpty()) { return false; } String[] uriEndings = values.split(","); for (String uriEnding: uriEndings) { endsWithList.add(uriEnding.trim()); } return true; }  }
IntranetEndsWithURITargetResolveStrategy implements URITargetResolveStrategy { public boolean initialize(String uriPattern) { if (uriPattern==null) { return false; } if (!uriPattern.startsWith(PREFIX)) { return false; } String values = uriPattern.substring(PREFIX.length()).trim(); if (values.isEmpty()) { return false; } String[] uriEndings = values.split(","); for (String uriEnding: uriEndings) { endsWithList.add(uriEnding.trim()); } return true; }  boolean initialize(String uriPattern); @Override Target resolveTargetFor(URI uri); }
IntranetEndsWithURITargetResolveStrategy implements URITargetResolveStrategy { public boolean initialize(String uriPattern) { if (uriPattern==null) { return false; } if (!uriPattern.startsWith(PREFIX)) { return false; } String values = uriPattern.substring(PREFIX.length()).trim(); if (values.isEmpty()) { return false; } String[] uriEndings = values.split(","); for (String uriEnding: uriEndings) { endsWithList.add(uriEnding.trim()); } return true; }  boolean initialize(String uriPattern); @Override Target resolveTargetFor(URI uri); static final String PREFIX; }