JAVA-13721 Fixing the formatting
This commit is contained in:
parent
e5985b3739
commit
7b8fad5dc9
|
@ -29,14 +29,12 @@
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
<version>${spring-framework.version}</version>
|
<version>${spring-framework.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- utils -->
|
<!-- utils -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>${commons-lang3.version}</version>
|
<version>${commons-lang3.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- test scoped -->
|
<!-- test scoped -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.baeldung.mockito.argumentcaptor;
|
package com.baeldung.mockito.argumentcaptor;
|
||||||
|
|
||||||
public enum Format {
|
public enum Format {
|
||||||
TEXT_ONLY,
|
TEXT_ONLY, HTML
|
||||||
HTML
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ public class MessageMatcher implements ArgumentMatcher<Message> {
|
||||||
return left.getFrom().equals(right.getFrom()) &&
|
return left.getFrom().equals(right.getFrom()) &&
|
||||||
left.getTo().equals(right.getTo()) &&
|
left.getTo().equals(right.getTo()) &&
|
||||||
left.getText().equals(right.getText()) &&
|
left.getText().equals(right.getText()) &&
|
||||||
right.getDate() != null &&
|
right.getDate() != null && right.getId() != null;
|
||||||
right.getId() != null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,7 +24,8 @@ class MockitoExceptionUnitTest {
|
||||||
@Test
|
@Test
|
||||||
void givenVoidReturnType_whenUsingDoThrow_thenExceptionIsThrown() {
|
void givenVoidReturnType_whenUsingDoThrow_thenExceptionIsThrown() {
|
||||||
MyDictionary dictMock = mock(MyDictionary.class);
|
MyDictionary dictMock = mock(MyDictionary.class);
|
||||||
doThrow(IllegalStateException.class).when(dictMock).add(anyString(), anyString());
|
doThrow(IllegalStateException.class).when(dictMock)
|
||||||
|
.add(anyString(), anyString());
|
||||||
|
|
||||||
assertThrows(IllegalStateException.class, () -> dictMock.add("word", "meaning"));
|
assertThrows(IllegalStateException.class, () -> dictMock.add("word", "meaning"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,8 @@ class MockitoVoidMethodsUnitTest {
|
||||||
assertEquals(3, arg0);
|
assertEquals(3, arg0);
|
||||||
assertEquals("answer me", arg1);
|
assertEquals("answer me", arg1);
|
||||||
return null;
|
return null;
|
||||||
}).when(myList).add(any(Integer.class), any(String.class));
|
}).when(myList)
|
||||||
|
.add(any(Integer.class), any(String.class));
|
||||||
|
|
||||||
myList.add(3, "answer me");
|
myList.add(3, "answer me");
|
||||||
}
|
}
|
||||||
|
@ -80,7 +81,8 @@ class MockitoVoidMethodsUnitTest {
|
||||||
void givenDoCallRealMethod_whenAddCalled_thenRealMethodCalled() {
|
void givenDoCallRealMethod_whenAddCalled_thenRealMethodCalled() {
|
||||||
MyList myList = mock(MyList.class);
|
MyList myList = mock(MyList.class);
|
||||||
|
|
||||||
doCallRealMethod().when(myList).add(any(Integer.class), any(String.class));
|
doCallRealMethod().when(myList)
|
||||||
|
.add(any(Integer.class), any(String.class));
|
||||||
myList.add(1, "real");
|
myList.add(1, "real");
|
||||||
|
|
||||||
verify(myList, times(1)).add(1, "real");
|
verify(myList, times(1)).add(1, "real");
|
||||||
|
|
Loading…
Reference in New Issue