Skip to content

Commit

Permalink
Merge pull request #733 from AlexElin/replace_Preconditions
Browse files Browse the repository at this point in the history
replace Preconditions.checkNotNull with Objects.requireNonNull
  • Loading branch information
hcoles authored Feb 12, 2020
2 parents 9ec6836 + 8402956 commit 5e6eedc
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
* See the License for the specific language governing permissions and limitations under the License.
*/

import java.util.Objects;
import java.util.function.Predicate;

import org.pitest.functional.prelude.Prelude;
import org.pitest.mutationtest.config.TestPluginArguments;
import org.pitest.util.Glob;
import org.pitest.util.Preconditions;

public class CoverageOptions implements Serializable {

Expand All @@ -38,7 +38,7 @@ public class CoverageOptions implements Serializable {
public CoverageOptions(final Collection<String> include, final Collection<String> exclude,
final TestPluginArguments pitConfig, final boolean verbose,
final int maxDependencyDistance) {
Preconditions.checkNotNull(pitConfig);
Objects.requireNonNull(pitConfig);
this.include = include;
this.exclude = exclude;
this.verbose = verbose;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import java.util.Collection;

import org.pitest.extension.common.CompoundTestSuiteFinder;
import java.util.Objects;
import java.util.Optional;
import org.pitest.help.Help;
import org.pitest.help.PitHelpError;
import org.pitest.testapi.Configuration;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.testapi.TestSuiteFinder;
import org.pitest.testapi.TestUnitFinder;
import org.pitest.util.Preconditions;

public class JUnitCompatibleConfiguration implements Configuration {

Expand All @@ -37,7 +37,7 @@ public class JUnitCompatibleConfiguration implements Configuration {

public JUnitCompatibleConfiguration(TestGroupConfig config, Collection<String> excludedRunners,
Collection<String> includedTestMethods) {
Preconditions.checkNotNull(config);
Objects.requireNonNull(config);
this.config = config;
this.excludedRunners = excludedRunners;
this.includedTestMethods = includedTestMethods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
Expand All @@ -45,7 +46,6 @@
import org.pitest.testapi.TestUnit;
import org.pitest.testapi.TestUnitFinder;
import org.pitest.util.IsolationUtils;
import org.pitest.util.Preconditions;

public class JUnitCustomRunnerTestUnitFinder implements TestUnitFinder {

Expand All @@ -59,7 +59,7 @@ public class JUnitCustomRunnerTestUnitFinder implements TestUnitFinder {

JUnitCustomRunnerTestUnitFinder(TestGroupConfig config, final Collection<String> excludedRunners,
final Collection<String> includedTestMethods) {
Preconditions.checkNotNull(config);
Objects.requireNonNull(config);
this.config = config;
this.excludedRunners = excludedRunners;
this.includedTestMethods = includedTestMethods;
Expand Down
4 changes: 2 additions & 2 deletions pitest/src/main/java/org/pitest/junit/JUnitTestPlugin.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.pitest.junit;

import java.util.Collection;
import java.util.Objects;

import org.pitest.classinfo.ClassByteArraySource;
import org.pitest.testapi.Configuration;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.testapi.TestPluginFactory;
import org.pitest.util.Preconditions;

/**
* Plugin that provides support for both JUnit 3, 4
Expand Down Expand Up @@ -34,7 +34,7 @@ public String description() {
@Override
public Configuration createTestFrameworkConfiguration(TestGroupConfig config,
ClassByteArraySource source, Collection<String> excludedRunners, Collection<String> includedTestMethods) {
Preconditions.checkNotNull(config);
Objects.requireNonNull(config);
return new JUnitCompatibleConfiguration(config, excludedRunners, includedTestMethods);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;

import org.pitest.junit.JUnitTestPlugin;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.util.Preconditions;

public class TestPluginArguments implements Serializable {

Expand All @@ -23,9 +23,9 @@ public TestPluginArguments(String testPlugin,
Collection<String> excludedRunners,
Collection<String> includedTestMethods,
boolean skipFailingTests) {
Preconditions.checkNotNull(testPlugin);
Preconditions.checkNotNull(groupConfig);
Preconditions.checkNotNull(excludedRunners);
Objects.requireNonNull(testPlugin);
Objects.requireNonNull(groupConfig);
Objects.requireNonNull(excludedRunners);
this.testPlugin = testPlugin;
this.groupConfig = groupConfig;
this.excludedRunners = excludedRunners;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

import org.pitest.classinfo.ClassName;
import org.pitest.coverage.ClassLine;
import org.pitest.coverage.TestInfo;
import org.pitest.util.Preconditions;
import org.pitest.util.StringUtil;

/**
Expand Down Expand Up @@ -50,7 +50,7 @@ public MutationDetails(final MutationIdentifier id, final String filename,
final String description, final int lineNumber, final int block,
final boolean isInFinallyBlock, final PoisonStatus poison) {
this.id = id;
this.description = Preconditions.checkNotNull(description);
this.description = Objects.requireNonNull(description);
this.filename = defaultFilenameIfNotSupplued(filename);
this.lineNumber = lineNumber;
this.block = block;
Expand Down
10 changes: 0 additions & 10 deletions pitest/src/main/java/org/pitest/util/Preconditions.java

This file was deleted.

0 comments on commit 5e6eedc

Please sign in to comment.