Search in sources :

Example 1 with CandlepinParameterUnmarshaller

use of org.candlepin.resteasy.parameter.CandlepinParameterUnmarshaller in project candlepin by candlepin.

the class OwnerResourceTest method createKeyValueParam.

@QueryParam("test-attr")
@CandlepinParam(type = KeyValueParameter.class)
private KeyValueParameter createKeyValueParam(String key, String val) throws Exception {
    // Can't create the KeyValueParam directly as the parse method
    // is package protected -- create one via the unmarshaller so we don't have to
    // change the visibility of the parse method.
    Annotation[] annotations = this.getClass().getDeclaredMethod("createKeyValueParam", String.class, String.class).getAnnotations();
    CandlepinParameterUnmarshaller unmarshaller = new CandlepinParameterUnmarshaller();
    unmarshaller.setAnnotations(annotations);
    return (KeyValueParameter) unmarshaller.fromString(key + ":" + val);
}
Also used : KeyValueParameter(org.candlepin.resteasy.parameter.KeyValueParameter) CandlepinParameterUnmarshaller(org.candlepin.resteasy.parameter.CandlepinParameterUnmarshaller) Matchers.anyString(org.mockito.Matchers.anyString) Annotation(java.lang.annotation.Annotation) QueryParam(javax.ws.rs.QueryParam) CandlepinParam(org.candlepin.resteasy.parameter.CandlepinParam)

Aggregations

Annotation (java.lang.annotation.Annotation)1 QueryParam (javax.ws.rs.QueryParam)1 CandlepinParam (org.candlepin.resteasy.parameter.CandlepinParam)1 CandlepinParameterUnmarshaller (org.candlepin.resteasy.parameter.CandlepinParameterUnmarshaller)1 KeyValueParameter (org.candlepin.resteasy.parameter.KeyValueParameter)1 Matchers.anyString (org.mockito.Matchers.anyString)1