### Question:
DefaultClassPropertyValuesProvider implements ClassPropertyValuesProvider { @Override public PropertyValues getValues(ClassPropertyReference propertyReference, int limit, Object... filterParameters) throws XWikiRestException { return getDedicatedProvider(getPropertyType(propertyReference)).getValues(propertyReference, limit, filterParameters); }  @Override PropertyValues getValues(ClassPropertyReference propertyReference, int limit, Object... filterParameters); @Override PropertyValue getValue(ClassPropertyReference propertyReference, Object rawValue);  }### Answer:
@Test public void getValues() throws Exception { ClassPropertyReference propertyReference = new ClassPropertyReference("category", this.classReference); ClassPropertyValuesProvider dbListValuesProvider = mock(ClassPropertyValuesProvider.class); ComponentManager contextComponentManager = this.mocker.getInstance(ComponentManager.class, "context"); PropertyValues values = new PropertyValues(); when(contextComponentManager.getInstance(ClassPropertyValuesProvider.class, "DBList")) .thenReturn(dbListValuesProvider); when(dbListValuesProvider.getValues(propertyReference, 13, "one", "two")).thenReturn(values); assertSame(values, this.mocker.getComponentUnderTest().getValues(propertyReference, 13, "one", "two")); }
@Test public void getValuesForMissingProperty() throws Exception { ClassPropertyReference propertyReference = new ClassPropertyReference("status", this.classReference); EntityReferenceSerializer<String> entityReferenceSerializer = this.mocker.getInstance(EntityReferenceSerializer.TYPE_STRING); when(entityReferenceSerializer.serialize(propertyReference)).thenReturn("status reference"); try { this.mocker.getComponentUnderTest().getValues(propertyReference, 13); fail(); } catch (XWikiRestException expected) { assertEquals("No such property [status reference].", expected.getMessage()); } }
@Test public void getValuesWithMissingProvider() throws Exception { ClassPropertyReference propertyReference = new ClassPropertyReference("category", this.classReference); ComponentManager contextComponentManager = this.mocker.getInstance(ComponentManager.class, "context"); when(contextComponentManager.getInstance(ClassPropertyValuesProvider.class, "DBList")) .thenThrow(new ComponentLookupException("Component not found.")); try { this.mocker.getComponentUnderTest().getValues(propertyReference, 13, "one"); fail(); } catch (XWikiRestException expected) { assertEquals("There's no value provider registered for the [DBList] property type.", expected.getMessage()); } }