Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
MockedConstruction should behave like MockedStatic when we use @mock on it. Co-authored-by: gbovyn <gatien.bovyn@gmail.com>
- Loading branch information
1 parent
bf480c3
commit e8f26b3
Showing
2 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...JupiterInlineMockMakerExtensionTest/src/test/java/org/mockitousage/CloseOnDemandTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2021 Mockito contributors | ||
* This program is made available under the terms of the MIT License. | ||
*/ | ||
package org.mockitousage; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.Mock; | ||
import org.mockito.MockedConstruction; | ||
import org.mockito.MockedStatic; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
/** | ||
* Tests to assert that ScopedMock mocks are properly closed on scope exit. | ||
*/ | ||
@ExtendWith(MockitoExtension.class) | ||
class CloseOnDemandTest { | ||
|
||
@Test | ||
void create_mocked_static_1(@Mock MockedStatic<String> mockedStatic) { | ||
assertNotNull(mockedStatic); | ||
} | ||
|
||
@Test | ||
void create_mocked_static_2(@Mock MockedStatic<String> mockedStatic) { | ||
assertNotNull(mockedStatic); | ||
} | ||
|
||
@Test | ||
void create_mocked_construction_1(@Mock MockedConstruction<String> mockConstruction) { | ||
assertNotNull(mockConstruction); | ||
} | ||
|
||
@Test | ||
void create_mocked_construction_2(@Mock MockedConstruction<String> mockConstruction) { | ||
assertNotNull(mockConstruction); | ||
} | ||
} |