use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.fixture.TestLookupCall in project scout.rt by eclipse.
the class SmartFieldLookupTest method testRecLookupWithExceptions.
@Test(expected = PlatformException.class)
public void testRecLookupWithExceptions() {
m_field.setLookupCall(new TestLookupCall());
throwOnRecLookup();
m_field.callSubTreeLookup(1L, TriState.TRUE);
}
use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.fixture.TestLookupCall in project scout.rt by eclipse.
the class SmartFieldLookupTest method testTextLookupWithExceptions.
@SuppressWarnings("unchecked")
@Test(expected = PlatformException.class)
public void testTextLookupWithExceptions() {
m_field.setLookupCall(new TestLookupCall());
when(m_mock_service.getDataByText(any(ILookupCall.class))).thenThrow(new PlatformException("lookup error"));
m_field.callTextLookup("test", 10);
}
use of org.eclipse.scout.rt.client.ui.form.fields.smartfield.fixture.TestLookupCall in project scout.rt by eclipse.
the class SmartFieldLookupTest method testTextLookupExceptions_InBackground.
@SuppressWarnings("unchecked")
@Test
public void testTextLookupExceptions_InBackground() throws InterruptedException {
m_field.setLookupCall(new TestLookupCall());
final String errorText = "lookup error";
when(m_mock_service.getDataByText(any(ILookupCall.class))).thenThrow(new PlatformException(errorText));
final IBlockingCondition bc = Jobs.newBlockingCondition(true);
ILookupRowFetchedCallback callback = new ILookupRowFetchedCallback<Long>() {
@Override
public void onSuccess(List<? extends ILookupRow<Long>> rows) {
Assert.fail("no exception thrown");
bc.setBlocking(false);
}
@Override
public void onFailure(RuntimeException exception) {
assertTrue(exception instanceof PlatformException);
assertEquals(errorText, exception.getMessage());
bc.setBlocking(false);
}
};
m_field.callTextLookupInBackground("", 10, callback);
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 testSubteeLookup_WithPrepare.
@Test
public void testSubteeLookup_WithPrepare() {
ISmartField<Long> field = new AbstractSmartField<Long>() {
@Override
protected void execPrepareLookup(ILookupCall<Long> call) {
call.setMaster(testMasterValue);
}
};
field.setLookupCall(new TestLookupCall());
List<? extends ILookupRow<Long>> rows2 = 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_NullParent.
@Test
public void testSubtreeLookup_NullParent() {
m_field.setLookupCall(new TestLookupCall());
List<? extends ILookupRow<Long>> rows = m_field.callSubTreeLookup(null);
assertEquals(0, rows.size());
}
Aggregations