JAVA-13634 Cleanup
This commit is contained in:
parent
143d5f6eed
commit
92d27acdb3
|
@ -1,27 +1,13 @@
|
|||
package com.baeldung.mockito;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.baeldung.mockito.MyList;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MockFinalsUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenMockFinalClassMockWorks() {
|
||||
|
||||
FinalList finalList = new FinalList();
|
||||
|
||||
FinalList mock = mock(FinalList.class);
|
||||
when(mock.size()).thenReturn(2);
|
||||
|
||||
assertNotEquals(mock.size(), finalList.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenMockFinalMethodMockWorks() {
|
||||
|
||||
|
@ -30,8 +16,17 @@ public class MockFinalsUnitTest {
|
|||
MyList mock = mock(MyList.class);
|
||||
when(mock.finalMethod()).thenReturn(1);
|
||||
|
||||
assertNotEquals(mock.finalMethod(), myList.finalMethod());
|
||||
assertThat(mock.finalMethod()).isNotEqualTo(myList.finalMethod());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenMockFinalClassMockWorks() {
|
||||
|
||||
FinalList finalList = new FinalList();
|
||||
|
||||
FinalList mock = mock(FinalList.class);
|
||||
when(mock.size()).thenReturn(2);
|
||||
|
||||
assertThat(mock.size()).isNotEqualTo(finalList.size());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue