Skip to content

Commit

Permalink
Fix some warnings (#511)
Browse files Browse the repository at this point in the history
* Remove unused imports

* Remove unnecessary semicolons

* Remove redundant interface modifiers
  • Loading branch information
hansjoachim authored and raphw committed Jul 28, 2016
1 parent 2e1e51c commit f6f60e5
Show file tree
Hide file tree
Showing 51 changed files with 15 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.mockito.Incubating;
import org.mockito.exceptions.base.MockitoSerializationIssue;
import org.mockito.internal.configuration.plugins.Plugins;
import org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.ForWriteReplace;
import org.mockito.internal.util.MockUtil;
import org.mockito.mock.MockCreationSettings;
import org.mockito.mock.MockName;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/mockito/internal/runners/StrictRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import org.junit.runner.manipulation.NoTestsRemainException;
import org.junit.runner.notification.RunNotifier;
import org.mockito.Mockito;
import org.mockito.MockitoFramework;
import org.mockito.internal.runners.util.FailureDetecter;
import org.mockito.internal.runners.util.FrameworkUsageValidator;

/**
* Created by sfaber on 7/22/16.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;

/**
* Implementation of JUnit run listener that knows when any of the tests failed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.*;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void equals_should_return_true_when_equal_to_method() throws Exception {

private interface Something {

public Object someMethod(Object param);
Object someMethod(Object param);

public Object otherMethod(Object param);
Object otherMethod(Object param);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private static boolean explicitGCEnabled() {
if (inputArgument.contains("-XX:+DisableExplicitGC")) {
return false;
}
};
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void describeMismatch(Object item, Description mismatchDescription) {}
public void describeTo(Description description) {}
}

private static interface IMatcher extends Matcher<Integer> {}
private interface IMatcher extends Matcher<Integer> {}

//non-generic matcher implementing the interface
private static class SubclassGenericMatcherFromInterface extends BaseMatcher<Integer> implements Serializable, Cloneable, IMatcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ public void should_validate_throwable() throws Throwable {
}

@SuppressWarnings("serial")
class MyException extends RuntimeException {};
class MyException extends RuntimeException {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.*;

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import static org.mockito.BDDMockito.doAnswer;
import static org.mockito.BDDMockito.*;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private void finalizeResume(ImportLogBean importLogBean) {
}

private interface ImportLogDao {
public boolean anyImportRunningOrRunnedToday(int importType, Date currentDate);
boolean anyImportRunningOrRunnedToday(int importType, Date currentDate);

void include(ImportLogBean importLogBean);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String getSurname() {
}

public interface PeopleRepository {
public void save(Person capture);
void save(Person capture);
}

@Mock PeopleRepository peopleRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@SuppressWarnings("unchecked")
public class MocksCreationTest extends TestBase {

private class HasPrivateConstructor {};
private class HasPrivateConstructor {}

@Test
public void shouldCreateMockWhenConstructorIsPrivate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import java.util.Observable;

import static junit.framework.TestCase.*;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
import static org.mockitoutil.SimpleSerializationUtil.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import static junit.framework.TestCase.*;
import static org.junit.Assume.assumeFalse;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;
import static org.mockitoutil.SimpleSerializationUtil.*;

Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/mockitousage/basicapi/ResetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.mockitoutil.TestBase;

import static junit.framework.TestCase.*;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;

public class ResetTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyVararg;
import static org.mockito.Mockito.*;

public class UsingVarargsTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.junit.Test;
import org.mockitoutil.TestBase;

import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;

//see bug 116
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.mockitoutil.TestBase;

import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.*;

public class ActualInvocationHasNullArgumentNPEBugTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Object call() throws Exception {
}

public interface ITarget {
public String targetMethod(String arg);
String targetMethod(String arg);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
public class InheritedGenericsPolimorphicCallTest extends TestBase {

protected interface MyIterable<T> extends Iterable<T> {
public MyIterator<T> iterator();
MyIterator<T> iterator();
}

protected interface MyIterator<T> extends Iterator<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public class MultithreadedStubbingHalfManualTest {
* Class with two methods, one of them is repeatedly mocked while another is repeatedly called.
*/
public interface ToMock {
public Integer getValue(Integer param);
Integer getValue(Integer param);

public List<Integer> getValues(Integer param);
List<Integer> getValues(Integer param);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.anyVararg;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;

//see issue 62
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/mockitousage/examples/use/ExampleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

import java.util.Arrays;

import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;

@RunWith(MockitoJUnitRunner.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import java.util.List;

import static junit.framework.TestCase.*;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;

public class CapturingArgumentsTest extends TestBase {
Expand Down
18 changes: 0 additions & 18 deletions src/test/java/org/mockitousage/matchers/MatchersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,7 @@
import static junit.framework.TestCase.*;
import static org.mockito.AdditionalMatchers.*;
import static org.mockito.AdditionalMatchers.eq;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyByte;
import static org.mockito.Matchers.anyChar;
import static org.mockito.Matchers.anyDouble;
import static org.mockito.Matchers.anyFloat;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyShort;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Matchers.isNotNull;
import static org.mockito.Matchers.isNull;
import static org.mockito.Matchers.matches;
import static org.mockito.Matchers.notNull;
import static org.mockito.Matchers.same;
import static org.mockito.Matchers.startsWith;
import static org.mockito.Mockito.*;


Expand Down
4 changes: 0 additions & 4 deletions src/test/java/org/mockitousage/matchers/NewMatchersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
import java.util.HashSet;

import static junit.framework.TestCase.assertEquals;
import static org.mockito.Matchers.anyCollection;
import static org.mockito.Matchers.anyList;
import static org.mockito.Matchers.anyMap;
import static org.mockito.Matchers.anySet;
import static org.mockito.Mockito.*;

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.startsWith;
import static org.mockito.Mockito.*;

public class VerificationAndStubbingUsingMatchersTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
import java.util.Observer;

import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.*;

public class DetectingMisusedMatchersTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

public class MockingPackageProtectedTest extends TestBase {

static class Foo {};
static class Foo {}

class Bar {};
class Bar {}

@Test
public void shouldMockPackageProtectedClasses() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.List;

import static junit.framework.TestCase.*;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.*;

public class SpyingOnRealObjectsTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.mockitoutil.TestBase;

import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;

public class ClickableStackTracesWhenFrameworkMisusedTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.LinkedList;
import java.util.List;

import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.*;

@Ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.mockitoutil.TestBase;

import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.*;

@RunWith(MockitoJUnitRunner.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.mockitoutil.TestBase;

import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.*;

//This is required to make sure stack trace is well filtered when runner is ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;

public class BasicStubbingTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.mockitoutil.TestBase;

import static junit.framework.TestCase.assertEquals;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;

public class CallingRealMethodTest extends TestBase {
Expand Down
3 changes: 0 additions & 3 deletions src/test/java/org/mockitousage/stubbing/DeepStubbingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

import static junit.framework.TestCase.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.io.IOException;

import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;

@SuppressWarnings("serial")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.AdditionalAnswers.*;
import static org.mockito.BDDMockito.*;
import static org.mockito.Matchers.anyVararg;

@RunWith(MockitoJUnitRunner.class)
public class StubbingWithAdditionalAnswersTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.Set;

import static junit.framework.TestCase.*;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;

public class StubbingWithCustomAnswerTest extends TestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.util.List;

import static junit.framework.TestCase.fail;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.*;

public class AtLeastXVerificationTest extends TestBase {
Expand Down

0 comments on commit f6f60e5

Please sign in to comment.