private static IWeaveXml getInstance() { if (testMode) { //Donot resort to caching when running Unit tests for TestNG, because we have to check //both implementations. If we cache the instance, then its not possible to do that. return attemptDefaultImplementationInstantiation(); } return instantiateIfRequired(); }
private static IWeaveXml getInstance() { if (testMode) { // Donot resort to caching when running Unit tests for TestNG, because we have to check // both implementations. If we cache the instance, then its not possible to do that. return attemptDefaultImplementationInstantiation(); } return instantiateIfRequired(); }
private static IWeaveXml instantiateIfRequired() { if (instance != null) { return instance; } instance = attemptDefaultImplementationInstantiation(); if (instance != null) { return instance; } Class<?> clazz = ClassHelper.forName(getClassName()); boolean isValid = ReflectionRecipes.isOrImplementsInterface(IWeaveXml.class, clazz); if (!isValid) { String msg = "In order for " + getClassName() + " to be used by TestNG for generating suite/test xmls, " + getClassName() + " needs to implement " + IWeaveXml.class.getName(); throw new TestNGException(msg); } instance = (IWeaveXml) ClassHelper.newInstance(clazz); return instance; }
private static IWeaveXml instantiateIfRequired() { if (instance != null) { return instance; } instance = attemptDefaultImplementationInstantiation(); if (instance != null) { return instance; } Class<?> clazz = ClassHelper.forName(getClassName()); boolean isValid = ReflectionRecipes.isOrImplementsInterface(IWeaveXml.class, clazz); if (!isValid) { String msg = "In order for " + getClassName() + " to be used by TestNG for generating suite/test xmls, " + getClassName() + " needs to implement " + IWeaveXml.class.getName(); throw new TestNGException(msg); } instance = (IWeaveXml) ClassHelper.newInstance(clazz); return instance; }