Migrating Tests from 1.5 to 2.0 [message #1466873] |
Sun, 09 November 2014 15:51 |
|
Hi RAP team,
We're in the process of migrating our code base from RAP 1.5 to 2.0.
One part that needs adjustments is the way we run our tests.
As we understand in 2.0 we don't need RAP JUnit test to run our tests
instead we can use plain JUnit
To prove it we run a very small test below which always fails:
public class TestComposite
{
private Display display;
private Shell shell;
@Before
public void setUp() throws Exception
{
Fixture.setUp();
Fixture.fakePhase(PhaseId.PROCESS_ACTION);
display = new Display();
shell = new Shell(display, SWT.NONE);
}
@After
public void tearDown() throws Exception {Fixture.tearDown();}
@Test
public void testSelectionAdapterInvocation() throws Exception
{
Button button = new Button(shell, SWT.CHECK);
SelectionListener listener = mock(SelectionListener.class);
button.addSelectionListener(listener);
shell.open();
button.setSelection(true);
verify(listener).widgetSelected(any(SelectionEvent.class));
shell.close();
}
}
Do we miss something ?
Any help would be greatly appreciated.
Thanks & Regards,
Setya
|
|
|
Re: Migrating Tests from 1.5 to 2.0 [message #1473977 is a reply to message #1466873] |
Sat, 15 November 2014 03:04 |
|
Hi Team,
Anyone can reproduce the problem ?
Regards,
Setya
On 11/09/2014 10:51 PM, Setya wrote:
> Hi RAP team,
>
> We're in the process of migrating our code base from RAP 1.5 to 2.0.
>
> One part that needs adjustments is the way we run our tests.
>
> As we understand in 2.0 we don't need RAP JUnit test to run our tests
> instead we can use plain JUnit
>
> To prove it we run a very small test below which always fails:
>
> public class TestComposite
> {
> private Display display;
> private Shell shell;
>
> @Before
> public void setUp() throws Exception
> {
> Fixture.setUp();
> Fixture.fakePhase(PhaseId.PROCESS_ACTION);
> display = new Display();
> shell = new Shell(display, SWT.NONE);
> }
>
> @After
> public void tearDown() throws Exception {Fixture.tearDown();}
>
> @Test
> public void testSelectionAdapterInvocation() throws Exception
> {
> Button button = new Button(shell, SWT.CHECK);
>
> SelectionListener listener = mock(SelectionListener.class);
> button.addSelectionListener(listener);
>
> shell.open();
> button.setSelection(true);
> verify(listener).widgetSelected(any(SelectionEvent.class));
> shell.close();
> }
> }
>
> Do we miss something ?
>
> Any help would be greatly appreciated.
>
> Thanks & Regards,
> Setya
|
|
|
|
Powered by
FUDForum. Page generated in 0.03156 seconds