| package edu.psu.swe.scim.client.filter; |
| |
| import java.io.UnsupportedEncodingException; |
| import java.net.URLDecoder; |
| |
| import org.junit.Before; |
| import org.junit.Test; |
| |
| import edu.psu.swe.scim.spec.protocol.filter.FilterParseException; |
| import edu.psu.swe.scim.spec.protocol.search.Filter; |
| import lombok.extern.slf4j.Slf4j; |
| |
| @Slf4j |
| public class FilterBuilderStringTests { |
| |
| @Test |
| public void testEndsWith() throws UnsupportedEncodingException, FilterParseException { |
| String encoded = FilterClient.builder().endsWith("address.streetAddress", "Way").toString(); |
| Filter filter = new Filter(decode(encoded)); |
| } |
| |
| @Test |
| public void testStartsWith() throws UnsupportedEncodingException, FilterParseException { |
| String encoded = FilterClient.builder().startsWith("address.streetAddress", "133").toString(); |
| Filter filter = new Filter(decode(encoded)); |
| } |
| |
| @Test |
| public void testContains() throws UnsupportedEncodingException, FilterParseException { |
| String encoded = FilterClient.builder().contains("address.streetAddress", "MacDuff").toString(); |
| Filter filter = new Filter(decode(encoded)); |
| } |
| |
| private String decode(String encoded) throws UnsupportedEncodingException { |
| |
| log.info(encoded); |
| |
| String decoded = URLDecoder.decode(encoded, "UTF-8").replace("%20", " "); |
| |
| log.info(decoded); |
| |
| return decoded; |
| } |
| } |