/
MockAnnotationProcessorTest.java
49 lines (39 loc) · 1.51 KB
/
MockAnnotationProcessorTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* Copyright (c) 2020 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.configuration;
import java.util.List;
import org.junit.Test;
import org.mockito.MockedStatic;
import org.mockito.exceptions.base.MockitoException;
import static org.assertj.core.api.Assertions.*;
public class MockAnnotationProcessorTest {
@SuppressWarnings("unused")
private MockedStatic<Void> nonGeneric;
@SuppressWarnings("unused")
private MockedStatic<List<?>> generic;
@SuppressWarnings({"raw", "unused"})
private MockedStatic raw;
@Test
public void testNonGeneric() throws Exception {
Class<?> type =
MockAnnotationProcessor.inferStaticMock(
MockAnnotationProcessorTest.class
.getDeclaredField("nonGeneric")
.getGenericType(),
"nonGeneric");
assertThat(type).isEqualTo(Void.class);
}
@Test(expected = MockitoException.class)
public void testGeneric() throws Exception {
MockAnnotationProcessor.inferStaticMock(
MockAnnotationProcessorTest.class.getDeclaredField("generic").getGenericType(),
"generic");
}
@Test(expected = MockitoException.class)
public void testRaw() throws Exception {
MockAnnotationProcessor.inferStaticMock(
MockAnnotationProcessorTest.class.getDeclaredField("raw").getGenericType(), "raw");
}
}