@Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TaskPreference that = (TaskPreference) o;

        if (!taskConfig.equals(that.taskConfig)) return false;
        if (!taskView.equals(that.taskView)) return false;

        return true;
    }
@Test
    public void shouldTestEquals() throws Exception {
        Task task1 = mock(Task.class);
        TaskConfig config1 = new TaskConfig();
        TaskView taskView1 = mock(TaskView.class);
        when(task1.config()).thenReturn(config1);
        when(task1.view()).thenReturn(taskView1);
        TaskPreference taskPreference1 = new TaskPreference(task1);

        Task task2 = mock(Task.class);
        TaskConfig config2 = new TaskConfig();
        TaskView taskView2 = mock(TaskView.class);
        when(task2.config()).thenReturn(config2);
        when(task2.view()).thenReturn(taskView2);
        TaskPreference taskPreference2 = new TaskPreference(task2);

        TaskPreference taskPreference3 = new TaskPreference(task1);

        Task task3 = mock(Task.class);
        when(task3.config()).thenReturn(config1);
        when(task3.view()).thenReturn(taskView1);

        TaskPreference taskPreference4 = new TaskPreference(task3);

        Task task5 = mock(Task.class);
        TaskView taskView5 = mock(TaskView.class);
        when(task5.config()).thenReturn(config1);
        when(task5.view()).thenReturn(taskView5);
        TaskPreference taskPreference5 = new TaskPreference(task5);

        assertThat(taskPreference1.equals(taskPreference2), is(false));
        assertThat(taskPreference1.equals(taskPreference3), is(true));
        assertThat(taskPreference1.equals(taskPreference4), is(true));
        assertThat(taskPreference1.equals(taskPreference5), is(false));
    }