No - this is exactly the static connection that you must develop from your classes to make them verifiable.
You will need to provide SecurityInterface through the provider or factory that you enter: then you can enter an instance that calls new in your production code, and an instance that returns the layout in your test code.
class MyClass { void doSomething(SecurityInterfaceSupplier supplier) { Object port = supplier.get().getSecurityPortType(); } } interface SecurityInterfaceSupplier { SecurityInterface get(); } class ProductionSecurityInterfaceSupplier implements SecurityInterfaceSupplier { @Override public SecurityInterface get() { return new SecurityInterface(); } } class TestingSecurityInterfaceSupplier implements SecurityInterfaceSupplier { @Override public SecurityInterface get() { return mockSecurityInterface; } }
source share