No, you can't. A
is an interface, and only classes can be instantiated.
What you can do is to use a library/helper that uses some trickery to create a class that implements the interface and instantiates that. The JDK's Proxy
class contains static methods to do just that. There are also tools that can do it which are custom-geared for test-related use cases: mockito, for instance.
These tools do exactly what you hint at in this question's title: rather than instantiating the interface, they generate a new class that implements the interface, and then instantiate that class.