### Question:
ClassPropertyValuesResourceImpl extends XWikiResource implements ClassPropertyValuesResource { @Override public PropertyValues getClassPropertyValues(String wikiName, String className, String propertyName, Integer limit, List<String> filterParameters, Boolean isExactMatch) throws XWikiRestException { DocumentReference classReference = this.resolver.resolve(className, new WikiReference(wikiName)); ClassPropertyReference classPropertyReference = new ClassPropertyReference(propertyName, classReference); try { this.authorization.checkAccess(Right.VIEW, classPropertyReference); } catch (AccessDeniedException e) { throw new WebApplicationException(e, Status.UNAUTHORIZED); } if (!exists(classPropertyReference)) { throw new WebApplicationException(Status.NOT_FOUND); } URI propertyURI = Utils.createURI(this.uriInfo.getBaseUri(), ClassPropertyResource.class, wikiName, className, propertyName); Link propertyLink = this.objectFactory.createLink(); propertyLink.setHref(propertyURI.toString()); propertyLink.setRel(Relations.PROPERTY); PropertyValues propertyValues = new PropertyValues(); if (isExactMatch) { for (String filterParameter : filterParameters) { PropertyValue value = this.propertyValuesProvider.getValue(classPropertyReference, filterParameter); if (value != null) { propertyValues.getPropertyValues().add(value); } } } else { propertyValues = this.propertyValuesProvider .getValues(classPropertyReference, limit, filterParameters.toArray()); } propertyValues.getLinks().add(propertyLink); return propertyValues; }  @Override PropertyValues getClassPropertyValues(String wikiName, String className, String propertyName, Integer limit,
        List<String> filterParameters, Boolean isExactMatch);  }### Answer:
@Test public void getClassPropertyValuesUnauthorized() throws Exception { doThrow(new AccessDeniedException(xcontext.getUserReference(), this.propertyReference)).when( authorization).checkAccess(eq(Right.VIEW), eq(this.propertyReference)); try { this.resource.getClassPropertyValues("wiki", "Path.To.Class", "status", 6, Arrays.asList("text"), false); fail(); } catch (WebApplicationException expected) { assertEquals(Status.UNAUTHORIZED.getStatusCode(), expected.getResponse().getStatus()); } }
@Test public void getClassPropertyValuesNotFound() throws Exception { try { this.resource.getClassPropertyValues("wiki", "Path.To.Class", "status", 6, Arrays.asList("text"), false); fail(); } catch (WebApplicationException expected) { assertEquals(Status.NOT_FOUND.getStatusCode(), expected.getResponse().getStatus()); } }
@Test public void getClassPropertyValues() throws Exception { when(this.xclass.get("status")).thenReturn(new DBListClass()); PropertyValues values = new PropertyValues(); ClassPropertyValuesProvider propertyValuesProvider = this.componentManager .getInstance(ClassPropertyValuesProvider.class); when(propertyValuesProvider.getValues(this.propertyReference, 6, "one", "two")).thenReturn(values); assertSame(values, this.resource.getClassPropertyValues("wiki", "Path.To.Class", "status", 6, Arrays.asList("one", "two"), false)); assertEquals(1, values.getLinks().size()); Link propertyLink = values.getLinks().get(0); assertEquals("/xwiki/rest/wikis/wiki/classes/Path.To.Class/properties/status", propertyLink.getHref()); assertEquals(Relations.PROPERTY, propertyLink.getRel()); }