alexruiz / fest-assert-1.x

FEST Fluent Assertions
http://fest.easytesting.org
Apache License 2.0
14 stars 8 forks source link

Comparision of Iterator fails #2

Open opensource21 opened 11 years ago

opensource21 commented 11 years ago

I have the follwing test using Mockito and fest-assert Version 1.4. Assert.assertEquals is the normal JUnit-assert.

   @Test
    public void bugReport() {
        // Arrange
        final Iterator<String> result = mock(Iterator.class);
        final List<String> listMock = mock(List.class);
        when(listMock.iterator()).thenReturn(result);

        // Act
        final Iterator<String> testResult = listMock.iterator();
        // Assert
        Assert.assertSame(result, testResult);
        assertThat(testResult).isEqualTo(result);
    }

It fails at the last line. The problem is that is compares a org.fest.assertions.IteratorAssert.PrettyPrintIterator with result. This fails.

opensource21 commented 11 years ago

Same for Type java.util.ListIterator<String>.