use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.fixture.TestLookupCall in project scout.rt by eclipse.
the class SmartFieldLookupTest method testSubtreeLookupExceptions_InBackground.
@SuppressWarnings("unchecked")
@Test
public void testSubtreeLookupExceptions_InBackground() throws InterruptedException {
final IBlockingCondition bc = Jobs.newBlockingCondition(true);
m_field.setLookupCall(new TestLookupCall());
when(m_mock_service.getDataByRec(any(ILookupCall.class))).thenThrow(new PlatformException("lookup error"));
IFuture<List<ILookupRow<Long>>> rows = m_field.callSubTreeLookupInBackground(1L, TriState.TRUE, false);
rows.whenDone(new IDoneHandler<List<ILookupRow<Long>>>() {
@Override
public void onDone(DoneEvent<List<ILookupRow<Long>>> event) {
assertTrue(event.getException() instanceof RuntimeException);
assertEquals("lookup error", event.getException().getMessage());
bc.setBlocking(false);
}
}, ClientRunContexts.copyCurrent());
bc.waitFor();
}
use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.fixture.TestLookupCall in project scout.rt by eclipse.
the class SmartFieldLookupTest method testSubtreeLookup_BrowseLimit.
@Test
public void testSubtreeLookup_BrowseLimit() {
m_field.setLookupCall(new TestLookupCall());
m_field.setBrowseMaxRowCount(2);
List<? extends ILookupRow<Long>> rows = m_field.callSubTreeLookup(1L, TriState.FALSE);
assertEquals(2, rows.size());
}
use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.fixture.TestLookupCall in project scout.rt by eclipse.
the class SmartFieldLookupTest method testSubtreeLookup_WithMasterField.
@Test
public void testSubtreeLookup_WithMasterField() {
IValueField<Long> masterField = new AbstractValueField<Long>() {
};
masterField.setValue(testMasterValue);
m_field.setLookupCall(new TestLookupCall());
m_field.setMasterField(masterField);
List<? extends ILookupRow<Long>> rows2 = m_field.callSubTreeLookup(1L);
assertEquals(2, rows2.size());
}
use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.fixture.TestLookupCall in project scout.rt by eclipse.
the class SmartFieldLookupTest method testSubtreeLookup_FilterResult.
@Test
public void testSubtreeLookup_FilterResult() {
ISmartField<Long> field = new AbstractSmartField<Long>() {
@Override
protected void execFilterRecLookupResult(ILookupCall<Long> call, List<ILookupRow<Long>> result) {
result.clear();
}
};
field.setLookupCall(new TestLookupCall());
List<? extends ILookupRow<Long>> rows2 = field.callSubTreeLookup(1L);
assertEquals(0, rows2.size());
}
Aggregations