source: class PhrServiceImplTest {
  
      @Rule
      public ExpectedException thrown;
      @Mock
      private PhrServiceDefault phrServiceDefault;
      @Mock
      private PhrServiceClientCredentials phrServiceClientCredentials;
      @InjectMocks
      private PhrServiceImpl sut;
  
      @Test
      public void testFindPatientProfileById_Use_Client_Credentials_False_Throws_FeignException() throws Exception {
  
target:         // Arrange
          final boolean useClientCredentials = false;
          final Long patientId = 5L;
          final PatientDto patientDto = mock(PatientDto.class);
          FeignException e = mock(FeignException.class);
          when(e.status()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR.value());
          when(phrServiceDefault.findPatientProfileById(patientId)).thenThrow(e);
          thrown.expect(FeignException.class);
  
          // Act
          final PatientDto response = sut.findPatientProfileById(patientId, useClientCredentials);
  
          // Assert
          assertEquals(patientDto, response);
          verify(phrServiceDefault, times(1)).findPatientProfileById(patientId);
          verify(phrServiceClientCredentials, times(0)).findPatientProfileById(patientId);
      }
  
  }