Issue #1243: Unsafe casts have been suppressed in UTs which use reflection
This commit is contained in:
parent
6ec212bb5e
commit
cc1b2e99c3
|
|
@ -450,6 +450,7 @@ public class ConfigurationLoaderTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testLoadConfiguration_URISyntaxException() throws CheckstyleException {
|
||||
mockStatic(ConfigurationLoader.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -469,6 +469,7 @@ public class MainTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testListFiles_notFile() throws Exception {
|
||||
Class<?>[] param = new Class<?>[1];
|
||||
param[0] = File.class;
|
||||
|
|
@ -485,6 +486,7 @@ public class MainTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testListFiles_DirectoryWithNull() throws Exception {
|
||||
Class<?>[] param = new Class<?>[1];
|
||||
param[0] = File.class;
|
||||
|
|
|
|||
|
|
@ -91,11 +91,10 @@ public class PackageNamesLoaderTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testPackagesWithDots() throws Exception {
|
||||
|
||||
Constructor<PackageNamesLoader> constructor =
|
||||
(Constructor<PackageNamesLoader>) PackageNamesLoader.class
|
||||
.getDeclaredConstructors()[0];
|
||||
Constructor<PackageNamesLoader> constructor = PackageNamesLoader.class.getDeclaredConstructor();
|
||||
constructor.setAccessible(true);
|
||||
PackageNamesLoader loader = constructor.newInstance();
|
||||
|
||||
|
|
@ -111,6 +110,7 @@ public class PackageNamesLoaderTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testPackagesWithSaxException() throws Exception {
|
||||
|
||||
final URLConnection mockConnection = Mockito.mock(URLConnection.class);
|
||||
|
|
@ -136,6 +136,7 @@ public class PackageNamesLoaderTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testPackagesWithIoException() throws Exception {
|
||||
|
||||
final URLConnection mockConnection = Mockito.mock(URLConnection.class);
|
||||
|
|
@ -161,6 +162,7 @@ public class PackageNamesLoaderTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testPackagesWithIoException_getResources() throws Exception {
|
||||
|
||||
ClassLoader classLoader = mock(ClassLoader.class);
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ public class PropertyCacheFileTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testException_NoSuchAlgorithmException() throws Exception {
|
||||
|
||||
Configuration config = new DefaultConfiguration("myname");
|
||||
|
|
|
|||
Loading…
Reference in New Issue