LimitedSupportedEncodings implements SupportedEncodings<E> { @Override public boolean isEncodingSupported( E requestType, String encoding ) { if ( getEnabledEncodingsPerRequestType().containsKey( requestType ) ) { Set<String> enabledEncodings = getEnabledEncodingsPerRequestType().get( requestType ); for ( String enabledEncoding : enabledEncodings ) { if ( enabledEncoding.equalsIgnoreCase( encoding ) ) return true; } } return false; } LimitedSupportedEncodings(); void addEnabledEncodings( E requestType, Set<String> enabledEncodingsPerRequestType ); @Override boolean isEncodingSupported( E requestType, String encoding ); Map<E, Set<String>> getEnabledEncodingsPerRequestType();  }
@Test public void testIsEncodingSupportedUnsupportedRequestType() { assertFalse( limitedSupportedEncodings.isEncodingSupported( GetFeatureWithLock, "xml" ) ); assertFalse( limitedSupportedEncodings.isEncodingSupported( GetFeatureWithLock, "kvp" ) ); assertFalse( limitedSupportedEncodings.isEncodingSupported( GetFeatureWithLock, "soap" ) ); }
@Test public void testIsEncodingSupportedSupportedRequestType() { assertTrue( limitedSupportedEncodings.isEncodingSupported( GetCapabilities, "xml" ) ); assertTrue( limitedSupportedEncodings.isEncodingSupported( GetCapabilities, "kvp" ) ); assertTrue( limitedSupportedEncodings.isEncodingSupported( GetCapabilities, "soap" ) ); }
@Test public void testIsEncodingSupportedPartlySupportedRequestType() { assertFalse( limitedSupportedEncodings.isEncodingSupported( DescribeFeatureType, "xml" ) ); assertTrue( limitedSupportedEncodings.isEncodingSupported( DescribeFeatureType, "kvp" ) ); assertTrue( limitedSupportedEncodings.isEncodingSupported( DescribeFeatureType, "soap" ) ); }