How to create a unit test for a class which uses a trait? Simple as this:
class A {
  use StringTranslationTrait;
  
  public function something() {
    $b = 1+2;
    $this-&gt;t($b);
    return $b;
  }
}

I would like to unit test the something() method, but I can't since the StringTranslation trait uses a static container call:
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$containe is not initialized yet. \Drupal::setContainer() must be called with a real container.

What do you suggest?
Following on Bedir's answer, here is an example.
I have a test that is using the class DurationService. DurationService uses the StringTranslationTrait as follows:
class DurationService implements DurationServiceInterface {
  use StringTranslationTrait;
  ...

To test this, I am doing the following (note, using a class that extends UnitTestCase):
$duration_service = new DurationService();
$duration_service-&gt;setStringTranslation($this-&gt;getStringTranslationStub());

This calls StringTranslationTrait::setStringTranslation() passing it the response from UnitTestCase::getStringTranslationStub().