• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2007 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockitousage.bugs;
6 
7 import org.junit.Test;
8 import org.mockito.InjectMocks;
9 import org.mockito.Mock;
10 import org.mockito.MockitoAnnotations;
11 
12 import java.nio.charset.Charset;
13 
14 // issue 327
15 public class FinalHashCodeAndEqualsRaiseNPEInInitMocksTest {
16     @Mock private Charset charset;
17     @InjectMocks private FieldCharsetHolder fieldCharsetHolder;
18     @InjectMocks private ConstructorCharsetHolder constructorCharsetHolder;
19 
20     @Test
dont_raise_NullPointerException()21     public void dont_raise_NullPointerException() throws Exception {
22         MockitoAnnotations.initMocks(this);
23     }
24 
25     private static class FieldCharsetHolder {
26         private Charset charset;
27     }
28 
29     private static class ConstructorCharsetHolder {
ConstructorCharsetHolder(Charset charset)30         public ConstructorCharsetHolder(Charset charset) {
31         }
32     }
33 }
34