public void testCreate_Post__WithUriDirective() {
HttpHeaders headers = createNiceMock(HttpHeaders.class);
UriInfo uriInfo = createNiceMock(UriInfo.class);
RequestBody body = createNiceMock(RequestBody.class);
ResourceInstance resource = createNiceMock(ResourceInstance.class);
ResourceDefinition resourceDefinition = createNiceMock(ResourceDefinition.class);
@SuppressWarnings("unchecked")
MultivaluedMap<String, String> mapQueryParams = createMock(MultivaluedMap.class);
Map<String, List<String>> mapProps = new HashMap<String, List<String>>();
mapProps.put("foo", Collections.singletonList("bar"));
Map<String, String> requestInfoMap = new HashMap<String, String>();
//expectations
expect(uriInfo.getQueryParameters()).andReturn(mapQueryParams).anyTimes();
expect(mapQueryParams.entrySet()).andReturn(mapProps.entrySet()).anyTimes();
expect(resource.getResourceDefinition()).andReturn(resourceDefinition).anyTimes();
expect(resourceDefinition.getCreateDirectives()).andReturn(Collections.singleton("foo"));
expect(body.getQueryString()).andReturn(null);
expect(body.getRequestInfoProperties()).andReturn(requestInfoMap).anyTimes();
replay(headers, uriInfo, body, resource, mapQueryParams, resourceDefinition);