Skip to content

Commit

Permalink
Issue checkstyle#3958: Modified GenericWhitespaceCheckTest.java and m…
Browse files Browse the repository at this point in the history
…oved its input files to genericwhitespace subdirectory
  • Loading branch information
Subbu Dantu authored and rnveach committed Mar 14, 2017
1 parent 1e46f09 commit 069bf8e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 24 deletions.
Expand Up @@ -56,13 +56,13 @@ public void setUp() {
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "whitespace" + File.separator + filename);
+ "whitespace" + File.separator + "genericwhitespace" + File.separator + filename);
}

@Override
protected String getNonCompilablePath(String filename) throws IOException {
return super.getNonCompilablePath("checks" + File.separator
+ "whitespace" + File.separator + filename);
+ "whitespace" + File.separator + "genericwhitespace" + File.separator + filename);
}

@Test
Expand Down Expand Up @@ -105,13 +105,13 @@ public void testDefault() throws Exception {
"60:60: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "&"),
"63:60: " + getCheckMessage(MSG_WS_FOLLOWED, ">"),
};
verify(checkConfig, getPath("InputGenericWhitespace.java"), expected);
verify(checkConfig, getPath("InputGenericWhitespaceDefault.java"), expected);
}

@Test
public void testGh47() throws Exception {
public void testList() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputGh47.java"), expected);
verify(checkConfig, getPath("InputGenericWhitespaceList.java"), expected);
}

@Test
Expand All @@ -123,15 +123,15 @@ public void testInnerClass() throws Exception {
@Test
public void testMethodReferences() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputMethodReferences3.java"), expected);
verify(checkConfig, getPath("InputGenericWhitespaceMethodRef1.java"), expected);
}

@Test
public void testMethodReferences2() throws Exception {
final String[] expected = {
"10:70: " + getCheckMessage(MSG_WS_FOLLOWED, ">"),
};
verify(checkConfig, getPath("InputGenericWhitespaceMethodRef.java"), expected);
verify(checkConfig, getPath("InputGenericWhitespaceMethodRef2.java"), expected);
}

@Test
Expand Down

This file was deleted.

@@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace;
package com.puppycrawl.tools.checkstyle.checks.whitespace.genericwhitespace;

import java.io.Serializable;
import java.util.ArrayList;
Expand All @@ -7,7 +7,7 @@
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.Collections;
class InputGenericWhitespace implements Comparable<InputGenericWhitespace>, Serializable
class InputGenericWhitespaceDefault implements Comparable<InputGenericWhitespaceDefault>, Serializable
{
void meth()
{
Expand All @@ -17,7 +17,7 @@ void meth()
List < List < Integer > > b = new ArrayList < List < Integer > > ();
}
//always 0
public int compareTo(InputGenericWhitespace aObject)
public int compareTo(InputGenericWhitespaceDefault aObject)
{
return 0;
}
Expand All @@ -43,11 +43,11 @@ public int getConstructor(Class<?>... parameterTypes)
return 666;
}

<T> InputGenericWhitespace(List<T> things, int i)
<T> InputGenericWhitespaceDefault(List<T> things, int i)
{
}

public <T> InputGenericWhitespace(List<T> things)
public <T> InputGenericWhitespaceDefault(List<T> things)
{
}

Expand Down
@@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace;
package com.puppycrawl.tools.checkstyle.checks.whitespace.genericwhitespace;

public class InputGenericWhitespaceEndsTheLine {
public boolean returnsGenericObjectAtEndOfLine(Object otherObject) {
Expand Down
@@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace;
package com.puppycrawl.tools.checkstyle.checks.whitespace.genericwhitespace;

import java.util.List;

Expand Down
@@ -0,0 +1,8 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace.genericwhitespace;

import java.util.List;

public class InputGenericWhitespaceList
{
public List<List<String>[]> listOfListOFArrays;
}
@@ -0,0 +1,20 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace.genericwhitespace;
import java.util.function.Supplier;
public class InputGenericWhitespaceMethodRef1
{
public static class SomeClass {
public static class Nested<V> {
private Nested() {
}
}
}

public static class Nested2<V> {
}

public <V> void methodName(V value) {
Supplier<?> t = Nested2<V>::new;
Supplier<SomeClass.Nested<V>> passes = SomeClass.Nested::new;
Supplier<SomeClass.Nested<V>> fails = SomeClass.Nested<V>::new;
}
}
@@ -1,10 +1,10 @@
package com.puppycrawl.tools.checkstyle.checks.whitespace;
package com.puppycrawl.tools.checkstyle.checks.whitespace.genericwhitespace;

import java.util.Optional;
import java.util.function.Supplier;


public class InputGenericWhitespaceMethodRef
public class InputGenericWhitespaceMethodRef2
{
final Supplier<Optional<Integer>> function1 = Optional::<Integer>empty;
final Supplier<Optional<Integer>> function2 = Optional::<Integer> empty;
Expand Down

0 comments on commit 069bf8e

Please sign in to comment.