Add a test demostrating bug in indentation check
This commit is contained in:
parent
711c0feac6
commit
be8b1ceab1
|
|
@ -0,0 +1,21 @@
|
|||
package com.puppycrawl.tools.checkstyle.indentation;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.jar.JarInputStream;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
class InputValidTryResourcesIndent
|
||||
{
|
||||
// Taken from JDK7 java.lang.Package src code.
|
||||
private static Manifest loadManifest(String fn) {
|
||||
try (FileInputStream fis = new FileInputStream(fn);
|
||||
JarInputStream jis = new JarInputStream(fis, false))
|
||||
{
|
||||
return jis.getManifest();
|
||||
} catch (IOException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -731,4 +731,16 @@ public class IndentationCheckTest extends BaseCheckTestSupport
|
|||
final String[] expected = {};
|
||||
verify(checkConfig, getPath("Input15Extensions.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTryResources() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(IndentationCheck.class);
|
||||
final String[] expected = {
|
||||
"something is expected, but there is a NullPointerException",
|
||||
};
|
||||
verify(checkConfig, getPath("indentation/InputValidTryResourcesIndent.java"),
|
||||
expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue