package org.westmalle.wayland.core;

import org.junit.Test;

public class CursorTest {

    @Test
    public void testHide() throws Exception {
        throw new UnsupportedOperationException();
    }

    @Test
    public void testShow() throws Exception {
        throw new UnsupportedOperationException();
    }

    @Test
    public void testUpdatePosition() throws Exception {
        throw new UnsupportedOperationException();
    }
}
package org.westmalle.wayland.core;

import org.freedesktop.wayland.server.WlBufferResource;
import org.freedesktop.wayland.server.WlSurfaceResource;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.westmalle.wayland.protocol.WlSurface;

import java.util.Optional;

import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class CursorTest {

    @Mock
    private Surface   surface;
    @Mock
    private WlSurface wlSurface;

    @Mock
    private WlSurfaceResource wlSurfaceResource;
    @Mock
    private Point             hotspot;
    @InjectMocks
    private Cursor            cursor;

    @Before
    public void setUp() {
        when(this.wlSurfaceResource.getImplementation()).thenReturn(this.wlSurface);
        when(this.wlSurface.getSurface()).thenReturn(this.surface);
    }

    @Test
    public void testHide() throws Exception {
        //given
        final SurfaceState surfaceState = SurfaceState.builder()
                                                      .build();
        when(this.surface.getState()).thenReturn(surfaceState);
        //when
        this.cursor.hide();
        //then
        verify(this.surface).setState(eq(SurfaceState.builder()
                                                     .buffer(Optional.<WlBufferResource>empty())
                                                     .build()));
        assertThat(this.cursor.isHidden()).isTrue();
    }

    @Test
    public void testUpdatePosition() throws Exception {
        //given
        final Point point = Point.create(123,
                                         456);
        //when
        this.cursor.updatePosition(point);
        //then
        verify(this.surface).setPosition(eq(Point.create(123,
                                                         456)));
    }
}
implement cursor unit tests