Im using Spring-Test (Not Spring project) for setting the JNDI at my unit test cases. But i cant get the ConnectionFactory implementation;
@Before
public static void setUp() throws NamingException {
SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
// I cant instance ConnectionFactory (its an interface)
ConnectionFactoryImplStub cf = new ConnectionFactoryImplStub();
builder.bind("ECI", cf);
}
So when i test my methods, the test dont gives error, but when the connection is builded, it doesnt do nothing, because "ConnectionFactoryImplStub" is a class made by me, that implements ConnectionFactory (and it overrides all ConnectionFactory methods).
Is there any other way i can make the setUp without ConnecionFactoryImplStub? Or any other way to solve this problem. PD: Legacy code, cant touch it.
Aucun commentaire:
Enregistrer un commentaire