CookieParamAnnotationHandler extends StringBasedAnnotationHandler<CookieParam> { @Override public void handleParameterAnnotation(CookieParam annotation, ParamConfigBuilder builder) { builder.setType(COOKIE).setName(ph(annotation.value())); } CookieParamAnnotationHandler(CRestConfig crestConfig); @Override void handleParameterAnnotation(CookieParam annotation, ParamConfigBuilder builder);  }
@Test public void handleParameterAnnotationShouldFillNameWithAnnotationValue() throws Exception { when(mockAnnotation.value()).thenReturn("a"); when(mockParamConfigBuilder.setType(COOKIE)).thenReturn(mockParamConfigBuilder); when(mockParamConfigBuilder.setName("a")).thenReturn(mockParamConfigBuilder); toTest.handleParameterAnnotation(mockAnnotation, mockParamConfigBuilder); verify(mockAnnotation).value(); verify(mockParamConfigBuilder).setType(COOKIE); verify(mockParamConfigBuilder).setName("a"); }
@Test public void handleParameterAnnotationShouldMergePlaceholdersAndFillNameWithAnnotationValue() throws Exception { when(mockAnnotation.value()).thenReturn(VAL_WITH_PH); when(mockParamConfigBuilder.setType(COOKIE)).thenReturn(mockParamConfigBuilder); when(mockParamConfigBuilder.setName(EXPECTED_MERGE_VAL)).thenReturn(mockParamConfigBuilder); toTest.handleParameterAnnotation(mockAnnotation, mockParamConfigBuilder); verify(mockAnnotation).value(); verify(mockParamConfigBuilder).setType(COOKIE); verify(mockParamConfigBuilder).setName(EXPECTED_MERGE_VAL); }