title: Junit tests are failing after I upgrade the spring boot dependencies
body: <p>I have the following code that is running fine when I had spring boot dependencies 2.3.3.</p>
  <p><a href="https://i.stack.imgur.com/7sXVl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7sXVl.png" alt="spring boot 2.3.3 deps" /></a></p>
  <pre><code>class Details {
     String pin;
     State state;
  }
  
  class DetailsDto {
     String pin;
     StateDto stateDto;
  }
  
  class State {
  }
  
  class StateDto {
  }
  
  @Named
  class TestClass {
      private final StateConverter converter;
  
      @Inject
      public TestClass(StateConverter converter) {
          this.converter= converter;
      }
  
      public DetailsDto getDetails(Details details) {
          DetailsDto dto = new DetailsDto();
          dto.setPin(details.getPin());
          dto.setState(converter.convert(details.getState());
      }
  
  }
  
  import static org.hamcrest.MatcherAssert.assertThat;
  import static org.hamcrest.core.IsEqual.equalTo;
  import static org.mockito.BDDMockito.given;
  import static org.mockito.Mockito.mock;
  import static org.mockito.Mockito.verify;
  
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.mockito.InjectMocks;
  import org.mockito.Mock;
  import org.mockito.junit.MockitoJUnitRunner;
  
  @RunWith(MockitoJUnitRunner.class)
  public class TestClassTest {
  
    @Mock
    private StateConverter converter;
  
    @InjectMocks
    private TestClass testClass;
  
    @Test
    public final void testSomething() {
      final String pin = &quot;12345&quot;;
      final State state = mock(State.class);
  
      Details details = mock(Details.class);
  
      given(details.getPin()).willReturn(pin);
      given(details.getState()).willReturn(state);
  
      StateDto stateDto = mock(StateDto.class);
      given(converter.convert(state)).willReturn(stateDto);
      
      DetailsDto deatilsDto = testClass.getDetails(details);
  
      assertThat(deatilsDto.getPin(), equalTo(pin));
      verify(converter).convert(state);
      assertThat(deatilsDto.getState(), equalTo(stateDto));
    }
  }
  </code></pre>
  <p>The same test case I am running with spring boot dependencies 2.6.2 like this. The changes I have done are
  I am using jupiter.api.test instead of junit.test, using ExtendWith instead of RunWith, using MockitoExtension instead of MockitoJUnitRunner</p>
  <p>I am getting nullpointer exception when converter.convert is called</p>
  <p><a href="https://i.stack.imgur.com/2rUzA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2rUzA.png" alt="spring boot 2.6.2 deps" /></a></p>
  <pre><code>import static org.hamcrest.MatcherAssert.assertThat;
  import static org.hamcrest.core.IsEqual.equalTo;
  import static org.mockito.BDDMockito.given;
  import static org.mockito.Mockito.mock;
  import static org.mockito.Mockito.verify;
  
  import org.junit.jupiter.api.Test;
  import org.junit.jupiter.api.extension.ExtendWith;
  import org.mockito.InjectMocks;
  import org.mockito.Mock;
  import org.mockito.junit.jupiter.MockitoExtension;
  
  @ExtendWith(MockitoExtension.class)
  public class TestClassTest {
  
    @Mock
    private StateConverter converter;
  
    @InjectMocks
    private TestClass testClass;
  
    @Test
    public final void testSomething() {
      final String pin = &quot;12345&quot;;
      final State state = mock(State.class);
  
      Details details = mock(Details.class);
  
      given(details.getPin()).willReturn(pin);
      given(details.getState()).willReturn(state);
  
      StateDto stateDto = mock(StateDto.class);
      given(converter.convert(state)).willReturn(stateDto);
      
      DetailsDto deatilsDto = testClass.getDetails(details);
      assertThat(deatilsDto.getPin(), equalTo(pin));
      verify(converter).convert(state);
      assertThat(deatilsDto.getState(), equalTo(stateDto));
    }
  }
  </code></pre>