Dependency Injection while Unit Testing Normally with Drupal 8 I can use dependency injection like this: 

&lt;?php 

class ExampleController extends ControllerBase {

  private $http_client;

  public function __construct(HttpClient $http_client) {
    $this-&gt;http_client = $http_client;
  }

  public function create(ContainerInterface $container) {
    $http_client = $container-&gt;get('http_client');
  }

  public function getResource() {
     $response = $this-&gt;http_client-&gt;get('http://biebertunes.com?q=selena');
     return $response-&gt;getBody();
  }

}


I can then use the $http_client property's methods. 

Now in my testing class I'm already extending the UnitTestCase class, so I don't have access to the create method for dependency injection. 

&lt;?php 

class ExampleTest extends UnitTestCase {   
  public function testGetResource() {
    $mock = $this-&gt;getMock('\Drupal\Example\ExampleController');
  }
}


Now when I run my unit tests it complains that I don't have the $http_client parameter. So how can I inject $http_client into the unit test without the create method?
I have few thoughts about this situation: 


Controllers should not contain business logic, services should. Therefor unit testing a controller is not a good idea in the first place.
If you are unit testing your controllers "getResource" method, why do mock the controller itself? You should mock the HttpClient. (that's the strong part of DI)
First you mock the classes which your constructor needs as arguments. Then you just create your object, which will you test like this: $example_controller = new ExampleController($http_client_mock); And that's it.