Skip to content

Commit

Permalink
spotless:apply
Browse files Browse the repository at this point in the history
  • Loading branch information
mcculls committed Jan 7, 2024
1 parent ba4cd7f commit 550bd96
Show file tree
Hide file tree
Showing 26 changed files with 99 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
@Target( value = { ElementType.METHOD } )
@Retention( RetentionPolicy.RUNTIME )
@Documented
public @interface PostConstruct {
public @interface PostConstruct
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
@Target( value = { ElementType.METHOD } )
@Retention( RetentionPolicy.RUNTIME )
@Documented
public @interface PreDestroy {
public @interface PreDestroy
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ final class LifecycleBuilder
boolean hasJsr250Annotations;
try
{
hasJsr250Annotations = javax.annotation.PostConstruct.class.isAnnotation()
&& javax.annotation.PreDestroy.class.isAnnotation();
hasJsr250Annotations =
javax.annotation.PostConstruct.class.isAnnotation() && javax.annotation.PreDestroy.class.isAnnotation();
}
catch ( final LinkageError e )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
/**
* Marks base tests that don't depend on Guice or injection.
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Tag("base")
@Target( { ElementType.TYPE, ElementType.METHOD } )
@Retention( RetentionPolicy.RUNTIME )
@Tag( "base" )
public @interface BaseTests
{
// marker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class DefaultBeanLocatorTest
Injector child4;

@BeforeEach
public void setUp() throws Exception
public void setUp()
throws Exception
{
parent = Guice.createInjector( new AbstractModule()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class ImplementationsTest
Injector injector;

@BeforeEach
void setUp() throws Exception
void setUp()
throws Exception
{
injector = Guice.createInjector( new AbstractModule()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public Bean get()
Injector injector;

@BeforeEach
void setUp() throws Exception
void setUp()
throws Exception
{
injector = Guice.createInjector( new AbstractModule()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ void testLogging()
}

@Test
void testProductionLogging() throws Exception
void testProductionLogging()
throws Exception
{
try
{
Expand Down Expand Up @@ -59,7 +60,8 @@ protected synchronized Class<?> loadClass( final String name, final boolean reso
}

@Test
void testFallBackToJDKLogging() throws Exception
void testFallBackToJDKLogging()
throws Exception
{
final Logger rootLogger = Logger.getLogger( "" );

Expand Down Expand Up @@ -102,7 +104,8 @@ protected synchronized Class<?> loadClass( final String name, final boolean reso
}

@Test
void testConsoleLogging() throws Exception
void testConsoleLogging()
throws Exception
{
System.setProperty( "org.eclipse.sisu.log", "console" );
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void testWeakElements()
testElements( false );
}

private static void testElements(final boolean soft)
private static void testElements( final boolean soft )
{
final Collection<String> names = new MildElements<String>( new ArrayList<Reference<String>>(), soft );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void testWeakKeys()
testKeys( false );
}

private static void testKeys(final boolean soft)
private static void testKeys( final boolean soft )
{
final Map<String, String> names =
new MildKeys<String, String>( new LinkedHashMap<Reference<String>, String>(), soft );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void testWeakValues()
testValues( false );
}

private static void testValues(final boolean soft)
private static void testValues( final boolean soft )
{
final Map<String, String> names =
new MildValues<String, String>( new LinkedHashMap<String, Reference<String>>(), soft );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public List call()
}
}

@SuppressWarnings("rawtypes")
@SuppressWarnings( "rawtypes" )
@Test
void testIsAssignableFrom()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class WatchedBeansTest
Injector child3;

@BeforeEach
void setUp() throws Exception
void setUp()
throws Exception
{
parent = Guice.createInjector( new AbstractModule()
{
Expand Down Expand Up @@ -101,7 +102,7 @@ public void remove( final BeanEntry<Named, Bean> entry, final RankedSequence<Str
}
}

@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings( { "rawtypes", "unchecked" } )
@Test
void testWatchedBeans()
{
Expand Down Expand Up @@ -205,7 +206,7 @@ public void remove( final BeanEntry<Named, Bean> entry, final Object watcher )
}
}

@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings( { "rawtypes", "unchecked" } )
@Test
void testBrokenWatcher()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void remove( final BeanEntry<Annotation, Item> bean, final AnnotatedItemW

@BeforeEach
public void setUp()
throws Exception
throws Exception
{
final ClassSpace space =
new URLClassSpace( getClass().getClassLoader(), new URL[] { getClass().getResource( "" ) } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class BundleClassSpaceTest
private Framework framework;

@BeforeEach
void setUp() throws Exception
void setUp()
throws Exception
{

final Map<String, String> configuration = new HashMap<String, String>();
Expand All @@ -64,14 +65,16 @@ void setUp() throws Exception
}

@AfterEach
void tearDown() throws Exception
void tearDown()
throws Exception
{
framework.stop();
framework.waitForStop( 0 );
}

@Test
void testHashCodeAndEquals() throws Exception
void testHashCodeAndEquals()
throws Exception
{
final Bundle testBundle = framework.getBundleContext().installBundle( LOGGING_BUNDLE.toString() );
final ClassSpace space = new BundleClassSpace( testBundle );
Expand Down Expand Up @@ -113,7 +116,8 @@ public Enumeration<URL> findEntries( final String path, final String glob, final
}

@Test
void testClassSpaceResources() throws Exception
void testClassSpaceResources()
throws Exception
{
final Bundle testBundle1 = framework.getBundleContext().installBundle( LOGGING_BUNDLE.toString() );
final ClassSpace space1 = new BundleClassSpace( testBundle1 );
Expand Down Expand Up @@ -176,7 +180,8 @@ void testClassSpaceResources() throws Exception
}

@Test
void testDeferredClass() throws Exception
void testDeferredClass()
throws Exception
{
final Bundle testBundle = framework.getBundleContext().installBundle( LOGGING_BUNDLE.toString() );
final ClassSpace space = new BundleClassSpace( testBundle );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class DeferredClassTest
URLClassLoader testLoader;

@BeforeEach
void setUp() throws MalformedURLException
void setUp()
throws MalformedURLException
{
testLoader =
URLClassLoader.newInstance( new URL[] { new File( "target/test-classes" ).toURI().toURL() }, null );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
class FileEntryIteratorTest
{
@Test
void testURLtoFile() throws MalformedURLException
void testURLtoFile()
throws MalformedURLException
{
assertEquals( "test", FileEntryIterator.toFile( new URL( "file:test" ) ).getPath() );
assertEquals( "A B C", FileEntryIterator.toFile( new URL( "file:A B C" ) ).getPath() );
Expand All @@ -47,7 +48,8 @@ void testURLtoFile() throws MalformedURLException
}

@Test
void testNoSuchFile() throws Exception
void testNoSuchFile()
throws Exception
{
final Iterator<String> i = new FileEntryIterator( new URL( "file:UNKNOWN" ), "", true );
assertFalse( i.hasNext() );
Expand All @@ -62,7 +64,8 @@ void testNoSuchFile() throws Exception
}

@Test
void testEmptyFolder() throws Exception
void testEmptyFolder()
throws Exception
{
final Iterator<String> i = new FileEntryIterator( expand( resource( "empty.zip" ) ), "", true );
assertFalse( i.hasNext() );
Expand All @@ -77,7 +80,8 @@ void testEmptyFolder() throws Exception
}

@Test
void testTrivialFolder() throws Exception
void testTrivialFolder()
throws Exception
{
final Iterator<String> i = new FileEntryIterator( expand( resource( "empty.jar" ) ), "", true );
assertTrue( i.hasNext() );
Expand All @@ -96,7 +100,8 @@ void testTrivialFolder() throws Exception
}

@Test
void testSimpleFolder() throws Exception
void testSimpleFolder()
throws Exception
{
final Iterator<String> i = new FileEntryIterator( expand( resource( "simple.jar" ) ), "", true );

Expand Down Expand Up @@ -126,7 +131,8 @@ void testSimpleFolder() throws Exception
}

@Test
void testNoRecursion() throws Exception
void testNoRecursion()
throws Exception
{
final Iterator<String> i = new FileEntryIterator( expand( resource( "simple.jar" ) ), "", false );

Expand All @@ -147,7 +153,8 @@ void testNoRecursion() throws Exception
}

@Test
void testSubPath() throws Exception
void testSubPath()
throws Exception
{
final Iterator<String> i = new FileEntryIterator( expand( resource( "simple.jar" ) ), "a/b", true );

Expand All @@ -165,7 +172,8 @@ void testSubPath() throws Exception
}

@Test
void testRemoveNotSupported() throws IOException
void testRemoveNotSupported()
throws IOException
{
final Iterator<String> i = new FileEntryIterator( new URL( "file:" ), "", false );
try
Expand All @@ -184,15 +192,15 @@ static URL expand( final URL url )
final File jar = new File( url.toURI() );
final File dir = new File( jar.getParentFile(), jar.getName() + "_expanded" );

try( final ZipFile zip = new ZipFile( jar ) )
try ( final ZipFile zip = new ZipFile( jar ) )
{
for ( final Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); )
{
final ZipEntry entry = e.nextElement();
final File path = new File( dir, entry.getName() );
if ( !path.toPath().normalize().startsWith( dir.toPath().normalize() ) )
{
throw new IOException("Bad zip entry");
throw new IOException( "Bad zip entry" );
}
if ( entry.isDirectory() )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ void testIndexedScanning()
}

@Test
void testBrokenScanning() throws IOException
void testBrokenScanning()
throws IOException
{
final ClassSpace space =
new URLClassSpace( getClass().getClassLoader(), new URL[] { getClass().getResource( "" ) } );
Expand Down Expand Up @@ -287,7 +288,8 @@ public Enumeration<URL> findEntries( final String path, final String glob, final
}

@Test
void testSourceDetection() throws MalformedURLException
void testSourceDetection()
throws MalformedURLException
{
final TestListener listener = new TestListener();

Expand Down Expand Up @@ -329,7 +331,8 @@ void testSourceDetection() throws MalformedURLException
}

@Test
void testOptionalLogging() throws Exception
void testOptionalLogging()
throws Exception
{
final Level level = Logger.getLogger( "" ).getLevel();
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public String call()
private Injector injector;

@BeforeEach
void setUp() throws Exception
void setUp()
throws Exception
{
final ClassSpace space =
new URLClassSpace( getClass().getClassLoader(), new URL[] { getClass().getResource( "" ) } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class ResourceEnumerationTest
ZipEntryIteratorTest.class.getResource( "commons-logging-1.1.1.jar" );

@Test
void testResourceEnumeration() throws Exception
void testResourceEnumeration()
throws Exception
{
final Enumeration<URL> e =
new ResourceEnumeration( null, null, true,
Expand Down Expand Up @@ -188,7 +189,8 @@ void testNonRecursiveSubPathEnumeration()
}

@Test
void testBrokenUrlEnumeration() throws Exception
void testBrokenUrlEnumeration()
throws Exception
{
final Enumeration<URL> e =
new ResourceEnumeration( null, null, true, new URL[] { expand( COMMONS_LOGGING_JAR ) } );
Expand All @@ -200,6 +202,8 @@ void testBrokenUrlEnumeration() throws Exception
nextEntryName.setAccessible( true );
nextEntryName.set( e, "foo:" );

assertThrows( IllegalStateException.class, () -> { e.nextElement(); } );
assertThrows( IllegalStateException.class, () -> {
e.nextElement();
} );
}
}
Loading

0 comments on commit 550bd96

Please sign in to comment.