@@ -0,0 +1,2565 @@
+package eu.ydp.empiria.player.client.module.textentry;%0A%0Aimport static org.mockito.Mockito.doReturn;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.verifyNoMoreInteractions;%0Aimport static org.mockito.Mockito.verifyZeroInteractions;%0A%0Aimport org.junit.AfterClass;%0Aimport org.junit.Before;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport org.mockito.Mockito;%0A%0Aimport com.google.gwt.event.dom.client.BlurEvent;%0Aimport com.google.gwt.event.dom.client.ChangeEvent;%0Aimport com.google.gwt.event.dom.client.DropEvent;%0Aimport com.google.gwt.junit.GWTMockUtilities;%0Aimport com.google.gwt.user.client.ui.TextBox;%0A%0Aimport eu.ydp.empiria.player.client.module.gap.GapBase.PresenterHandler;%0Aimport eu.ydp.empiria.player.client.util.dom.drag.DroppableObject;%0A%0A@SuppressWarnings(%22PMD%22)%0Apublic class TextBoxChangeHandlerJUnitTest %7B%0A%0A%0A%09private DroppableObject%3CTextBox%3E object;%0A%09private TextBox textBox;%0A%09private PresenterHandler presenterHandler;%0A%09private final TextBoxChangeHandler instance = new TextBoxChangeHandler();%0A%0A%09@BeforeClass%0A%09public static void disarm() %7B%0A%09%09GWTMockUtilities.disarm();%0A%09%7D%0A%0A%09@AfterClass%0A%09public static void rearm() %7B%0A%09%09GWTMockUtilities.restore();%0A%09%7D%0A%0A%09@Before%0A%09public void before() %7B%0A%09%09object = mock(DroppableObject.class);%0A%09%09textBox = mock(TextBox.class);%0A%09%09presenterHandler = mock(PresenterHandler.class);%0A%09%09doReturn(textBox).when(object).getOriginalWidget();%0A%09%7D%0A%0A%09@Test%0A%09public void bindNoPresenterHandlerTest()%7B%0A%09%09instance.bind(object, null);%0A%09%09verifyZeroInteractions(object);%0A%09%7D%0A%0A%09@Test%0A%09public void bindTest()%7B%0A%09%09instance.bind(object, presenterHandler);%0A%09%09verify(textBox).addChangeHandler(Mockito.eq(instance));%0A%09%09verify(textBox).addBlurHandler(Mockito.eq(instance));%0A%09%09verify(object).addDropHandler(Mockito.eq(instance));%0A%09%7D%0A%0A%0A%09@Test%0A%09public void onDropTest()%7B%0A%09%09instance.bind(object, presenterHandler);%0A%09%09DropEvent event = mock(DropEvent.class);%0A%09%09instance.onDrop(event);%0A%09%09verify(presenterHandler).onChange(Mockito.any(ChangeEvent.class));%0A%09%7D%0A%0A%09@Test%0A%09public void onChangeTest()%7B%0A%09%09instance.bind(object, presenterHandler);%0A%09%09ChangeEvent event = mock(ChangeEvent.class);%0A%09%09instance.onChange(event);%0A%09%09verify(presenterHandler).onChange(Mockito.eq(event));%0A%09%09verifyNoMoreInteractions(presenterHandler);%0A%0A%09%7D%0A%0A%09@Test%0A%09public void onBlurTest()%7B%0A%09%09instance.bind(object, presenterHandler);%0A%09%09BlurEvent blurEvent = mock(BlurEvent.class);%0A%09%09instance.onBlur(blurEvent);%0A%09%09verify(presenterHandler).onBlur(Mockito.eq(blurEvent));%0A%09%09verifyNoMoreInteractions(presenterHandler);%0A%09%7D%0A%0A%7D%0A

add drop handler for textBox : tests issue YPUB-5340