use of com.xpn.xwiki.objects.StringListProperty in project xwiki-platform by xwiki.
the class PropertyConverterTest method multipleToSingleSelectOnEmptyDBList.
@Test
public void multipleToSingleSelectOnEmptyDBList() throws Exception {
// The Database List property that was switched from multiple select to single select.
DBListClass dbListClass = mock(DBListClass.class);
when(dbListClass.isMultiSelect()).thenReturn(false);
StringListProperty emptyListProperty = mock(StringListProperty.class);
when(emptyListProperty.getValue()).thenReturn(Arrays.asList());
assertNull(this.mocker.getComponentUnderTest().convertProperty(emptyListProperty, dbListClass));
}
use of com.xpn.xwiki.objects.StringListProperty in project xwiki-platform by xwiki.
the class PropertyConverterTest method multipleToSingleSelectOnDBList.
@Test
public void multipleToSingleSelectOnDBList() throws Exception {
// The Database List property that was switched from multiple select to single select.
DBListClass dbListClass = mock(DBListClass.class);
when(dbListClass.isMultiSelect()).thenReturn(false);
StringProperty stringProperty = mock(StringProperty.class);
when(dbListClass.newProperty()).thenReturn(stringProperty);
StringListProperty stringListProperty = mock(StringListProperty.class);
when(stringListProperty.getValue()).thenReturn(Arrays.asList("one", "two"));
assertEquals(stringProperty, this.mocker.getComponentUnderTest().convertProperty(stringListProperty, dbListClass));
verify(stringProperty).setValue("one");
}
use of com.xpn.xwiki.objects.StringListProperty in project xwiki-platform by xwiki.
the class PropertyConverterTest method singleToMultipleSelectOnDBList.
@Test
public void singleToMultipleSelectOnDBList() throws Exception {
// The Database List property that was switched from single select to multiple select.
DBListClass dbListClass = mock(DBListClass.class);
when(dbListClass.isMultiSelect()).thenReturn(true);
StringListProperty stringListProperty = mock(StringListProperty.class);
when(dbListClass.newProperty()).thenReturn(stringListProperty);
StringProperty stringProperty = mock(StringProperty.class);
when(stringProperty.getValue()).thenReturn("one");
assertEquals(stringListProperty, this.mocker.getComponentUnderTest().convertProperty(stringProperty, dbListClass));
verify(stringListProperty).setValue(Arrays.asList("one"));
}
Aggregations