EncodingAnnotationHandler extends StringBasedAnnotationHandler<Encoding> { @Override public void handleInterfaceAnnotation(Encoding annotation, InterfaceConfigBuilder builder) { builder.setMethodsCharset(Charset.forName(ph(annotation.value()))); } EncodingAnnotationHandler(CRestConfig crestConfig); @Override void handleInterfaceAnnotation(Encoding annotation, InterfaceConfigBuilder builder); @Override void handleMethodAnnotation(Encoding annotation, MethodConfigBuilder builder);  }
@Test public void handleInterfaceAnnotationShouldSetMethodsCharset() throws Exception { when(mockAnnotation.value()).thenReturn(Values.ISO_8859_1_STR); toTest.handleInterfaceAnnotation(mockAnnotation, mockInterfaceConfigBuilder); verify(mockAnnotation).value(); verify(mockInterfaceConfigBuilder).setMethodsCharset(Values.ISO_8859_1); }
@Test public void handleInterfaceAnnotationShouldMergePlaceholdersAndSetMethodsCharset() throws Exception { placeholders.put(Pattern.compile("\\{" + Pattern.quote("ph.3") + "\\}"), Values.ISO_8859_1_STR); when(mockAnnotation.value()).thenReturn("{ph.3}"); toTest.handleInterfaceAnnotation(mockAnnotation, mockInterfaceConfigBuilder); verify(mockAnnotation).value(); verify(mockInterfaceConfigBuilder).setMethodsCharset(Values.ISO_8859_1); }