Skip to content

Commit f57f801

Browse files
committed
Merge branch 'master' of git://github.com/scijava/scijava-common
2 parents 03f3257 + ce2fa6b commit f57f801

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

src/test/java/org/scijava/ContextCreationTest.java

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public void testOptionalMissingTransitive() {
182182
@SuppressWarnings("unchecked")
183183
@Test
184184
public void testClassOrder() {
185-
int expectedSize = 2;
185+
final int expectedSize = 2;
186186

187187
// Same order, Base first
188188
Context c =
@@ -216,14 +216,14 @@ public void testClassOrder() {
216216
@SuppressWarnings("unchecked")
217217
@Test
218218
public void testAbstractClasslist() {
219-
Context cAbstract =
219+
final Context cAbstract =
220220
createContext(pluginIndex(BaseImpl.class, ExtensionImpl.class), services(
221221
AbstractBase.class, AbstractExtension.class));
222-
223-
Context cService =
224-
createContext(pluginIndex(BaseImpl.class, ExtensionImpl.class), services(
225-
BaseService.class, ExtensionService.class));
226-
222+
223+
final Context cService =
224+
createContext(pluginIndex(BaseImpl.class, ExtensionImpl.class), services(
225+
BaseService.class, ExtensionService.class));
226+
227227
assertEquals(cService.getServiceIndex().size(), cAbstract.getServiceIndex()
228228
.size());
229229
}
@@ -235,11 +235,12 @@ public void testAbstractClasslist() {
235235
@Test
236236
public void testNoServicesCtor() {
237237
// create a 2-service context
238-
PluginIndex index = pluginIndex(BaseImpl.class, ExtensionImpl.class);
238+
final PluginIndex index = pluginIndex(BaseImpl.class, ExtensionImpl.class);
239239
// Add another service, that is not indexed under Service.class
240240
index.add(new PluginInfo<SciJavaPlugin>(ThreadService.class.getName(),
241241
SciJavaPlugin.class));
242-
Context c = new Context(pluginIndex(BaseImpl.class, ExtensionImpl.class));
242+
final Context c =
243+
new Context(pluginIndex(BaseImpl.class, ExtensionImpl.class));
243244
assertEquals(2, c.getServiceIndex().size());
244245
}
245246

@@ -295,7 +296,9 @@ public void testNonRequiredMissingService() {
295296
* Checks the expected order vs. the order in the provided Context's
296297
* ServiceIndex
297298
*/
298-
private void verifyServiceOrder(Class<?>[] expected, Context context) {
299+
private void verifyServiceOrder(final Class<?>[] expected,
300+
final Context context)
301+
{
299302
assertEquals(expected.length, context.getServiceIndex().size());
300303
int index = 0;
301304
for (final Service service : context.getServiceIndex()) {
@@ -304,22 +307,22 @@ private void verifyServiceOrder(Class<?>[] expected, Context context) {
304307
}
305308

306309
/**
307-
* Initializes and returns a Context given the provided PluginIndex and
308-
* array of services.
310+
* Initializes and returns a Context given the provided PluginIndex and array
311+
* of services.
309312
*/
310-
private Context createContext(PluginIndex index,
311-
Class<? extends Service>[] services)
313+
private Context createContext(final PluginIndex index,
314+
final Class<? extends Service>[] services)
312315
{
313316
return new Context(Arrays.<Class<? extends Service>> asList(services),
314317
index);
315318
}
316-
319+
317320
/**
318321
* Convenience method since you can't instantiate a Class<? extends Service>
319322
* array.
320323
*/
321324
private Class<? extends Service>[] services(
322-
Class<? extends Service>... serviceClasses)
325+
final Class<? extends Service>... serviceClasses)
323326
{
324327
return serviceClasses;
325328
}
@@ -328,9 +331,9 @@ private Class<? extends Service>[] services(
328331
* Creates a PluginIndex and adds all the provided classes as plugins, indexed
329332
* under Service.class
330333
*/
331-
private PluginIndex pluginIndex(Class<?>... plugins) {
332-
PluginIndex index = new PluginIndex(null);
333-
for (Class<?> c : plugins) {
334+
private PluginIndex pluginIndex(final Class<?>... plugins) {
335+
final PluginIndex index = new PluginIndex(null);
336+
for (final Class<?> c : plugins) {
334337
index.add(new PluginInfo<Service>(c.getName(), Service.class));
335338
}
336339
return index;
@@ -374,14 +377,14 @@ public static interface OptionalMissingService extends Service, Optional {
374377
/** Abstract implementation of {@link BaseService}. */
375378
public static abstract class AbstractBase extends AbstractService implements
376379
BaseService
377-
{
380+
{
378381
// NB: No implementation needed.
379382
}
380383

381384
/** Abstract implementation of {@link ExtensionService}. */
382385
public static abstract class AbstractExtension extends AbstractService
383386
implements ExtensionService
384-
{
387+
{
385388
// NB: No implementation needed.
386389
}
387390

0 commit comments

Comments
 (0)