/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */

package org.mockitousage.bugs;

import org.junit.Test;
import org.mockito.Mock;
import org.mockitoutil.TestBase;

import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import static org.mockito.Mockito.*;

//see issue 184
public class ShouldMocksCompareToBeConsistentWithEqualsTest extends TestBase {

    @Test
    public void shouldCompareToBeConsistentWithEquals() {
        //given
        Date today    = mock(Date.class);
        Date tomorrow = mock(Date.class);

        //when
        Set<Date> set = new TreeSet<Date>();
        set.add(today);
        set.add(tomorrow);

        //then
        assertEquals(2, set.size());
    }

    @Test
    public void shouldCompareToTreatAsEqualMocksWithTheSameReferences() {
        //given
        Date today    = mock(Date.class);

        //when
        Set<Date> set = new TreeSet<Date>();
        set.add(today);
        set.add(today);

        //then
        assertEquals(1, set.size());
    }

    @Test
    public void shouldAllowStubbingAndVerifyingCompareTo() {
        //given
        Date mock    = mock(Date.class);
        when(mock.compareTo(any(Date.class))).thenReturn(10);

        //when
        mock.compareTo(new Date());

        //then
        assertEquals(10, mock.compareTo(new Date()));
        verify(mock, atLeastOnce()).compareTo(any(Date.class));
    }

    @Test
    public void shouldResetNotRemoveDefaultStubbing() {
        //given
        Date mock    = mock(Date.class);
        reset(mock);

        //then
        assertEquals(1, mock.compareTo(new Date()));
    }
}
@@ -489,28 +489,32 @@
 d should
-C
+_c
 ompare
-ToBeC
+_to_be_c
 onsisten
@@ -510,29 +510,31 @@
 e_consistent
-WithE
+_with_e
 quals() %7B%0A  
@@ -839,54 +839,79 @@
 ould
-C
+_c
 ompare
-ToTreatAsEqualMocksWithTheSameR
+_to_be_consistent_with_equals_when_comparing_the_same_r
 eference
 s() 
@@ -906,17 +906,16 @@
 eference
-s
 () %7B%0A   
@@ -1174,33 +1174,37 @@
 ould
-A
+_a
 llow
-S
+_s
 tubbing
-AndV
+_and_v
 erifying
 Comp
@@ -1199,24 +1199,26 @@
 erifying
-C
+_c
 ompare
-T
+_t
 o() %7B%0A  
@@ -1563,30 +1563,35 @@
 ould
-R
+_r
 eset
-NotR
+_not_r
 emove
-D
+_d
 efault
-S
+_s
 tubb

Rename tests Introduce snake case instead of camel case for tests names in ShouldMocksCompareToBeConsistentWithEqualsTest class