Skip to content

Commit

Permalink
Clean-up deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
krmahadevan committed Dec 27, 2023
1 parent 94bf011 commit 092c97d
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 711 deletions.
16 changes: 1 addition & 15 deletions testng-core-api/src/main/java/org/testng/IInjectorFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,8 @@

/** Allows customization of the {@link Injector} creation when working with dependency injection. */
public interface IInjectorFactory {
/**
* Note that {@link #getInjector(Injector, Stage, Module...)} should be used instead.
*
* @param stage - A {@link Stage} object that defines the appropriate stage
* @param modules - An array of {@link Module}
* @return - An {@link com.google.inject.Injector} instance that can be used to perform dependency
* injection.
* @deprecated - As of TestNG <code>7.5.0</code>
*/
@Deprecated
Injector getInjector(Stage stage, Module... modules);

/**
* Adding this method breaks existing implementations therefore for the time being (until
* deprecated method is removed) it calls the existing method.
*
* @param parent - Parent {@link com.google.inject.Injector} instance that was built with parent
* injector
* @param stage - A {@link Stage} object that defines the appropriate stage
Expand All @@ -31,6 +17,6 @@ public interface IInjectorFactory {
* injection.
*/
default Injector getInjector(@Nullable Injector parent, Stage stage, Module... modules) {
return getInjector(stage, modules);
throw new UnsupportedOperationException("Not implemented");
}
}
12 changes: 0 additions & 12 deletions testng-core-api/src/main/java/org/testng/IObjectFactory.java

This file was deleted.

23 changes: 0 additions & 23 deletions testng-core-api/src/main/java/org/testng/IObjectFactory2.java

This file was deleted.

6 changes: 0 additions & 6 deletions testng-core-api/src/main/java/org/testng/ISuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ public interface ISuite extends IAttributes {
/** @return The object factory used to create all test instances. */
ITestObjectFactory getObjectFactory();

@Deprecated
/** @deprecated - This interface stands deprecated as of TestNG 7.5.0 */
default IObjectFactory2 getObjectFactory2() {
return null;
}

/** @return The output directory used for the reports. */
String getOutputDirectory();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ public static String getTestClasspath() {
return System.getProperty(TEST_CLASSPATH);
}

public static boolean useOldTestNGEmailableReporter() {
return System.getProperty("oldTestngEmailableReporter") != null;
}

public static boolean useEmailableReporter() {
return System.getProperty("noEmailableReporter") == null;
}
Expand Down
16 changes: 0 additions & 16 deletions testng-core-api/src/main/java/org/testng/xml/XmlSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.testng.collections.Maps;
import org.testng.internal.RuntimeBehavior;
import org.testng.internal.Utils;
import org.testng.internal.objects.InstanceCreator;
import org.testng.util.Strings;

/** This class describes the tag &lt;suite&gt; in testng.xml. */
Expand Down Expand Up @@ -237,16 +236,6 @@ public String getGuiceStage() {
return m_guiceStage;
}

/**
* @deprecated - This method stands deprecated as of TestNG <code>7.5.0</code>. Use {@link
* XmlSuite#getObjectFactoryClass()} instead.
* @return - A {@link ITestObjectFactory} instance.
*/
@Deprecated
public ITestObjectFactory getObjectFactory() {
return InstanceCreator.newInstance(getObjectFactoryClass());
}

public Class<? extends ITestObjectFactory> getObjectFactoryClass() {
return m_objectFactoryClass;
}
Expand All @@ -267,11 +256,6 @@ public boolean isShareThreadPoolForDataProviders() {
return shareThreadPoolForDataProviders;
}

@Deprecated
public void setObjectFactory(ITestObjectFactory objectFactory) {
setObjectFactoryClass(objectFactory.getClass());
}

public void setObjectFactoryClass(Class<? extends ITestObjectFactory> objectFactoryClass) {
m_objectFactoryClass = objectFactoryClass;
}
Expand Down

This file was deleted.

5 changes: 1 addition & 4 deletions testng-core/src/main/java/org/testng/TestNG.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.testng.internal.thread.graph.SuiteWorkerFactory;
import org.testng.junit.JUnitTestFinder;
import org.testng.log4testng.Logger;
import org.testng.reporters.EmailableReporter;
import org.testng.reporters.EmailableReporter2;
import org.testng.reporters.FailedReporter;
import org.testng.reporters.JUnitReportReporter;
Expand Down Expand Up @@ -964,9 +963,7 @@ private void initializeDefaultListeners() {
} else {
addReporter(XMLReporter.class);
}
if (RuntimeBehavior.useOldTestNGEmailableReporter()) {
addReporter(EmailableReporter.class);
} else if (RuntimeBehavior.useEmailableReporter()) {
if (RuntimeBehavior.useEmailableReporter()) {
addReporter(EmailableReporter2.class);
}
addReporter(JUnitReportReporter.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

/** Methods that bind parameters declared in testng.xml to actual values used to invoke methods. */
public class Parameters {
@Deprecated public static final String NULL_VALUE = org.testng.annotations.Parameters.NULL_VALUE;

private static final List<Class<? extends Annotation>> annotationList =
Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
import org.testng.IInjectorFactory;

public class GuiceBackedInjectorFactory implements IInjectorFactory {
@Deprecated
@Override
public Injector getInjector(Stage stage, Module... modules) {
return getInjector(null, stage, modules);
}

@Override
public Injector getInjector(@Nullable Injector parent, Stage stage, Module... modules) {
Expand Down

0 comments on commit 092c97d

Please sign in to comment.