http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/ClassHierarchyDeserializationTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/ClassHierarchyDeserializationTest.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/ClassHierarchyDeserializationTest.java index af9648a..de9522d 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/ClassHierarchyDeserializationTest.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/ClassHierarchyDeserializationTest.java @@ -42,7 +42,7 @@ public class ClassHierarchyDeserializationTest { private final ClassHierarchySerializer classHierarchySerializer = new AvroClassHierarchySerializer(); /** - * generate task.bin from running .Net ClassHierarchyBuilder.exe + * generate task.bin from running .Net ClassHierarchyBuilder.exe. */ @Test public void testDeserializationForTasks() { @@ -52,11 +52,15 @@ public class ClassHierarchyDeserializationTest { // TODO: Use AvroClassHierarchySerializer instead (REEF-400) final ClassHierarchyProto.Node root = ClassHierarchyProto.Node.parseFrom(chin); final ClassHierarchy ch = new ProtocolBufferClassHierarchy(root); - Node n1 = ch.getNode("Org.Apache.REEF.Examples.Tasks.StreamingTasks.StreamTask1, Org.Apache.REEF.Examples.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); - Assert.assertTrue(n1.getFullName().equals("Org.Apache.REEF.Examples.Tasks.StreamingTasks.StreamTask1, Org.Apache.REEF.Examples.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")); + Node n1 = ch.getNode("Org.Apache.REEF.Examples.Tasks.StreamingTasks.StreamTask1, " + + "Org.Apache.REEF.Examples.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); + Assert.assertTrue(n1.getFullName().equals("Org.Apache.REEF.Examples.Tasks.StreamingTasks.StreamTask1, " + + "Org.Apache.REEF.Examples.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")); - Node n2 = ch.getNode("Org.Apache.REEF.Examples.Tasks.HelloTask.HelloTask, Org.Apache.REEF.Examples.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); - Assert.assertTrue(n2.getFullName().equals("Org.Apache.REEF.Examples.Tasks.HelloTask.HelloTask, Org.Apache.REEF.Examples.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")); + Node n2 = ch.getNode("Org.Apache.REEF.Examples.Tasks.HelloTask.HelloTask, " + + "Org.Apache.REEF.Examples.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); + Assert.assertTrue(n2.getFullName().equals("Org.Apache.REEF.Examples.Tasks.HelloTask.HelloTask, " + + "Org.Apache.REEF.Examples.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")); final ConfigurationBuilder taskConfigurationBuilder1 = Tang.Factory.getTang() .newConfigurationBuilder(ch); @@ -73,7 +77,7 @@ public class ClassHierarchyDeserializationTest { } /** - * This is to test CLR protocol Buffer class hierarchy merge + * This is to test CLR protocol Buffer class hierarchy merge. */ @Test public void testProtocolClassHierarchyMerge() { @@ -108,7 +112,7 @@ public class ClassHierarchyDeserializationTest { } /** - * generate event.bin from .Net Tang test case TestSerilization.TestGenericClass + * generate event.bin from .Net Tang test case TestSerilization.TestGenericClass. */ @Test public void testDeserializationForEvent() { @@ -127,14 +131,16 @@ public class ClassHierarchyDeserializationTest { } @Test - //Test bindSetEntry(NamedParameterNode<Set<T>> iface, String impl) in ConfigurationBuilderImpl with deserialized class hierarchy + // Test bindSetEntry(NamedParameterNode<Set<T>> iface, String impl) in ConfigurationBuilderImpl + // with deserialized class hierarchy public void testBindSetEntryWithSetOfT() throws IOException { final ClassHierarchy ns1 = Tang.Factory.getTang().getDefaultClassHierarchy(); ns1.getNode(SetOfClasses.class.getName()); final ClassHierarchy ns2 = classHierarchySerializer.fromString(classHierarchySerializer.toString(ns1)); final ConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder(ns2); - final NamedParameterNode<Set<Number>> n2 = (NamedParameterNode<Set<Number>>) ns1.getNode(SetOfClasses.class.getName()); + final NamedParameterNode<Set<Number>> n2 = + (NamedParameterNode<Set<Number>>) ns1.getNode(SetOfClasses.class.getName()); final Node fn = ns1.getNode(Float.class.getName()); cb.bindSetEntry(n2, fn); @@ -142,7 +148,8 @@ public class ClassHierarchyDeserializationTest { } @Test - //Test public <T> void bindParameter(NamedParameterNode<T> name, String value) in ConfigurationBuilderImpl with deserialized class hierarchy + // Test public <T> void bindParameter(NamedParameterNode<T> name, String value) in ConfigurationBuilderImpl + // with deserialized class hierarchy public void testBindSetEntryWithSetOfString() throws IOException { final ClassHierarchy ns1 = Tang.Factory.getTang().getDefaultClassHierarchy(); ns1.getNode(SetOfStrings.class.getName()); @@ -151,7 +158,8 @@ public class ClassHierarchyDeserializationTest { cb.bindSetEntry(SetOfStrings.class.getName(), "four"); cb.bindSetEntry(SetOfStrings.class.getName(), "five"); - final NamedParameterNode<Set<String>> n2 = (NamedParameterNode<Set<String>>) ns1.getNode(SetOfStrings.class.getName()); + final NamedParameterNode<Set<String>> n2 = + (NamedParameterNode<Set<String>>) ns1.getNode(SetOfStrings.class.getName()); cb.bindSetEntry(n2, "six"); final Configuration c = configurationSerializer.fromString(configurationSerializer.toString(cb.build()), ns2);
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestBindSingleton.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestBindSingleton.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestBindSingleton.java index 3157f0a..23e6b5b 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestBindSingleton.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestBindSingleton.java @@ -101,14 +101,16 @@ public class TestBindSingleton { final Injector i1 = Tang.Factory.getTang().newInjector(cb.build()); final Injector i2 = Tang.Factory.getTang().newInjector(cb.build()); - assertTrue("Different injectors should return different singleton object instances", i1.getInstance(AA.class) != i2.getInstance(AA.class)); + assertTrue("Different injectors should return different singleton object instances", + i1.getInstance(AA.class) != i2.getInstance(AA.class)); final Configuration c = cb.build(); final Injector i3 = Tang.Factory.getTang().newInjector(c); final Injector i4 = Tang.Factory.getTang().newInjector(c); - assertTrue("Different injectors should return different singleton object instances", i3.getInstance(AA.class) != i4.getInstance(AA.class)); + assertTrue("Different injectors should return different singleton object instances", + i3.getInstance(AA.class) != i4.getInstance(AA.class)); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestClassLoaders.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestClassLoaders.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestClassLoaders.java index a53d2b0..f352853 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestClassLoaders.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestClassLoaders.java @@ -98,8 +98,10 @@ public class TestClassLoaders { "../tang-test-jarA/target/tang-test-jarA-1.0-SNAPSHOT.jar").toURI() .toURL()); - Assert.assertEquals(1, ((ClassNode<?>) (cbA1.getClassHierarchy().getNode("org.apache.reef.tang.examples.A"))).getInjectableConstructors().length); - Assert.assertEquals(0, ((ClassNode<?>) (cbAother.getClassHierarchy().getNode("org.apache.reef.tang.examples.A"))).getInjectableConstructors().length); + Assert.assertEquals(1, ((ClassNode<?>) (cbA1.getClassHierarchy().getNode("org.apache.reef.tang.examples.A"))) + .getInjectableConstructors().length); + Assert.assertEquals(0, ((ClassNode<?>) (cbAother.getClassHierarchy().getNode("org.apache.reef.tang.examples.A"))) + .getInjectableConstructors().length); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestConfFileParser.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestConfFileParser.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestConfFileParser.java index 79dc5db..cf648f7 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestConfFileParser.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestConfFileParser.java @@ -95,7 +95,7 @@ public class TestConfFileParser { } @NamedParameter(doc = "remote id.") - private final static class RemoteIdentifier implements Name<String> { + private static final class RemoteIdentifier implements Name<String> { } @NamedParameter() http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestImplicitConversions.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestImplicitConversions.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestImplicitConversions.java index 1e10daa..b62570d 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestImplicitConversions.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestImplicitConversions.java @@ -44,7 +44,8 @@ public class TestImplicitConversions { ConfigurationFile.addConfiguration(b2, s); Configuration c2 = b2.build(); - Assert.assertEquals("b://b", c2.getNamedParameter((NamedParameterNode<?>) c2.getClassHierarchy().getNode(ReflectionUtilities.getFullName(IdName.class)))); + Assert.assertEquals("b://b", c2.getNamedParameter( + (NamedParameterNode<?>) c2.getClassHierarchy().getNode(ReflectionUtilities.getFullName(IdName.class)))); Injector i = Tang.Factory.getTang().newInjector(c2); Assert.assertEquals("b://b", i.getNamedInstance(IdName.class).toString()); @@ -52,8 +53,6 @@ public class TestImplicitConversions { } - ; - @SuppressWarnings("unchecked") @Test public void testBindSubclassFromString() throws BindException, InjectionException { @@ -68,7 +67,8 @@ public class TestImplicitConversions { ConfigurationFile.addConfiguration(b2, s); Configuration c2 = b2.build(); - Assert.assertEquals("b://b", c2.getNamedParameter((NamedParameterNode<?>) c2.getClassHierarchy().getNode(ReflectionUtilities.getFullName(BIdName.class)))); + Assert.assertEquals("b://b", c2.getNamedParameter( + (NamedParameterNode<?>) c2.getClassHierarchy().getNode(ReflectionUtilities.getFullName(BIdName.class)))); Injector i = Tang.Factory.getTang().newInjector(c2); Assert.assertEquals("b://b", i.getNamedInstance(BIdName.class).toString()); @@ -84,8 +84,6 @@ public class TestImplicitConversions { b.bindNamedParameter(AIdName.class, "b://b"); } - ; - @Test(expected = InjectionException.class) public void testInjectUnboundParsable() throws BindException, InjectionException { @SuppressWarnings("unchecked") @@ -93,17 +91,15 @@ public class TestImplicitConversions { Tang.Factory.getTang().newInjector(b.build()).getNamedInstance(IdName.class); } - static interface Identifier { + interface Identifier { } - ; - - static interface AIdentifier extends Identifier { + interface AIdentifier extends Identifier { } - static interface BIdentifier extends Identifier { + interface BIdentifier extends Identifier { } @@ -136,11 +132,13 @@ public class TestImplicitConversions { } static class IdentifierParser implements ExternalConstructor<Identifier> { - final Identifier id; + private final Identifier id; @Inject public IdentifierParser(String id) { - this.id = id.startsWith("a://") ? new AIdentifierImpl(id) : id.startsWith("b://") ? new BIdentifierImpl(id) : null; + this.id = id.startsWith("a://") ? new AIdentifierImpl(id) : + id.startsWith("b://") ? new BIdentifierImpl(id) : + null; if (this.id == null) { throw new IllegalArgumentException("Need string that starts with a:// or b://!"); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestInjectionFuture.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestInjectionFuture.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestInjectionFuture.java index 1ce3610..eb2a50b 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestInjectionFuture.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestInjectionFuture.java @@ -119,30 +119,30 @@ public class TestInjectionFuture { @DefaultImplementation(Futurist.class) public static class Futurist { - private final InjectionFuture<FlyingCar> f_car; + private final InjectionFuture<FlyingCar> fCar; @Inject public Futurist(InjectionFuture<FlyingCar> car) { - this.f_car = car; + this.fCar = car; } public FlyingCar getMyCar() { - FlyingCar c = f_car.get(); + FlyingCar c = fCar.get(); return c; } } public static class PickyFuturist extends Futurist { - private final InjectionFuture<FlyingCar> f_car; + private final InjectionFuture<FlyingCar> fCar; @Inject public PickyFuturist(@Parameter(MyFlyingCar.class) InjectionFuture<FlyingCar> myFlyingCar) { super(myFlyingCar); - f_car = myFlyingCar; + fCar = myFlyingCar; } public FlyingCar getMyCar() { - FlyingCar c = f_car.get(); + FlyingCar c = fCar.get(); return c; } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestListInjection.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestListInjection.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestListInjection.java index b4908bd..81fbdfb 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestListInjection.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestListInjection.java @@ -40,7 +40,7 @@ import java.util.List; public class TestListInjection { /** - * Test code for injecting default list with string elements + * Test code for injecting default list with string elements. * * @throws InjectionException */ @@ -55,7 +55,7 @@ public class TestListInjection { } /** - * Test code for injecting default list with non-string values + * Test code for injecting default list with non-string values. * * @throws InjectionException */ @@ -70,7 +70,7 @@ public class TestListInjection { } /** - * Test code for injecting default list with implementations + * Test code for injecting default list with implementations. * * @throws InjectionException */ @@ -90,7 +90,7 @@ public class TestListInjection { } /** - * Test code for injecting list with String elements + * Test code for injecting list with String elements. * * @throws InjectionException */ @@ -111,7 +111,7 @@ public class TestListInjection { } /** - * Test code for injecting list with parsable non-string values + * Test code for injecting list with parsable non-string values. * * @throws InjectionException */ @@ -133,7 +133,7 @@ public class TestListInjection { } /** - * Test code for injecting list with implementations + * Test code for injecting list with implementations. * * @throws InjectionException */ @@ -201,7 +201,7 @@ public class TestListInjection { } /** - * Test code for injecting list of strings with ConfigurationBuilder + * Test code for injecting list of strings with ConfigurationBuilder. * * @throws InjectionException */ @@ -225,7 +225,7 @@ public class TestListInjection { } /** - * Test code for injecting list of implementations with ConfigurationBuilder + * Test code for injecting list of implementations with ConfigurationBuilder. * * @throws InjectionException */ @@ -254,7 +254,7 @@ public class TestListInjection { } /** - * Test code for injectiong list with ConfigurationModule + * Test code for injectiong list with ConfigurationModule. * * @throws InjectionException */ http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestNamedParameterRoundTrip.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestNamedParameterRoundTrip.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestNamedParameterRoundTrip.java index 12732ed..e6f62e9 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestNamedParameterRoundTrip.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestNamedParameterRoundTrip.java @@ -38,54 +38,49 @@ public class TestNamedParameterRoundTrip { b.bindNamedParameter(Eps.class, String.valueOf(eps)); final Configuration conf = b.build(); - { - final Injector i = Tang.Factory.getTang().newInjector(conf); + final Injector i1 = Tang.Factory.getTang().newInjector(conf); - final int readD = i.getNamedInstance(Dimensionality.class).intValue(); - final double readEps = i.getNamedInstance(Eps.class).doubleValue(); + final int readD1 = i1.getNamedInstance(Dimensionality.class).intValue(); + final double readEps1 = i1.getNamedInstance(Eps.class).doubleValue(); - assertEquals(eps, readEps, 1e-12); - assertEquals(d, readD); - } + assertEquals(eps, readEps1, 1e-12); + assertEquals(d, readD1); - { - JavaConfigurationBuilder roundTrip = Tang.Factory.getTang().newConfigurationBuilder(); - ConfigurationFile.addConfiguration(roundTrip, ConfigurationFile.toConfigurationString(conf)); - final Injector i = Tang.Factory.getTang().newInjector(roundTrip.build()); + JavaConfigurationBuilder roundTrip2 = Tang.Factory.getTang().newConfigurationBuilder(); + ConfigurationFile.addConfiguration(roundTrip2, ConfigurationFile.toConfigurationString(conf)); + final Injector i2 = Tang.Factory.getTang().newInjector(roundTrip2.build()); - final int readD = i.getNamedInstance(Dimensionality.class).intValue(); - final double readEps = i.getNamedInstance(Eps.class).doubleValue(); + final int readD2 = i2.getNamedInstance(Dimensionality.class).intValue(); + final double readEps2 = i2.getNamedInstance(Eps.class).doubleValue(); - assertEquals(eps, readEps, 1e-12); - assertEquals(d, readD); - } + assertEquals(eps, readEps2, 1e-12); + assertEquals(d, readD2); - { - final Injector parent = Tang.Factory.getTang().newInjector(Tang.Factory.getTang().newConfigurationBuilder().build()); - final Injector i = parent.forkInjector(conf); - final int readD = i.getNamedInstance(Dimensionality.class).intValue(); - final double readEps = i.getNamedInstance(Eps.class).doubleValue(); + final Injector parent3 = + Tang.Factory.getTang().newInjector(Tang.Factory.getTang().newConfigurationBuilder().build()); + final Injector i3 = parent3.forkInjector(conf); - assertEquals(eps, readEps, 1e-12); - assertEquals(d, readD); - } + final int readD3 = i3.getNamedInstance(Dimensionality.class).intValue(); + final double readEps3 = i3.getNamedInstance(Eps.class).doubleValue(); - { - final Injector parent = Tang.Factory.getTang().newInjector(Tang.Factory.getTang().newConfigurationBuilder().build()); - final JavaConfigurationBuilder roundTrip = Tang.Factory.getTang().newConfigurationBuilder(); - ConfigurationFile.addConfiguration(roundTrip, - ConfigurationFile.toConfigurationString(conf)); - final Injector i = parent.forkInjector(roundTrip.build()); + assertEquals(eps, readEps3, 1e-12); + assertEquals(d, readD3); - final int readD = i.getNamedInstance(Dimensionality.class).intValue(); - final double readEps = i.getNamedInstance(Eps.class).doubleValue(); - assertEquals(eps, readEps, 1e-12); - assertEquals(d, readD); - } + final Injector parent4 = + Tang.Factory.getTang().newInjector(Tang.Factory.getTang().newConfigurationBuilder().build()); + final JavaConfigurationBuilder roundTrip4 = Tang.Factory.getTang().newConfigurationBuilder(); + ConfigurationFile.addConfiguration(roundTrip4, + ConfigurationFile.toConfigurationString(conf)); + final Injector i4 = parent4.forkInjector(roundTrip4.build()); + final int readD4 = i4.getNamedInstance(Dimensionality.class).intValue(); + final double readEps4 = i4.getNamedInstance(Eps.class).doubleValue(); + + assertEquals(eps, readEps4, 1e-12); + assertEquals(d, readD4); } @NamedParameter() http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTang.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTang.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTang.java index 21e8efb..0503aff 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTang.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTang.java @@ -127,14 +127,16 @@ public class TestTang { @Test public void testOneNamedFailArgs() throws InjectionException { thrown.expect(InjectionException.class); - thrown.expectMessage("Cannot inject org.apache.reef.tang.OneNamedSingletonArgs: org.apache.reef.tang.OneNamedSingletonArgs missing argument org.apache.reef.tang.OneNamedSingletonArgs$A"); + thrown.expectMessage("Cannot inject org.apache.reef.tang.OneNamedSingletonArgs: " + + "org.apache.reef.tang.OneNamedSingletonArgs missing argument org.apache.reef.tang.OneNamedSingletonArgs$A"); tang.newInjector().getInstance(OneNamedSingletonArgs.class); } @Test public void testOneNamedOKArgs() throws InjectionException { thrown.expect(InjectionException.class); - thrown.expectMessage("Cannot inject org.apache.reef.tang.OneNamedSingletonArgs: org.apache.reef.tang.OneNamedSingletonArgs missing argument org.apache.reef.tang.OneNamedSingletonArgs$A"); + thrown.expectMessage("Cannot inject org.apache.reef.tang.OneNamedSingletonArgs: " + + "org.apache.reef.tang.OneNamedSingletonArgs missing argument org.apache.reef.tang.OneNamedSingletonArgs$A"); tang.newInjector().getInstance(OneNamedSingletonArgs.class); } @@ -142,7 +144,8 @@ public class TestTang { @Test public void testOneNamedSingletonFailArgs() throws InjectionException { thrown.expect(InjectionException.class); - thrown.expectMessage("Cannot inject org.apache.reef.tang.OneNamedSingletonArgs: org.apache.reef.tang.OneNamedSingletonArgs missing argument org.apache.reef.tang.OneNamedSingletonArgs$A"); + thrown.expectMessage("Cannot inject org.apache.reef.tang.OneNamedSingletonArgs: " + + "org.apache.reef.tang.OneNamedSingletonArgs missing argument org.apache.reef.tang.OneNamedSingletonArgs$A"); tang.newInjector().getInstance(OneNamedSingletonArgs.class); } @@ -189,7 +192,8 @@ public class TestTang { public void testOneNamedStringArgCantRebind() throws BindException, InjectionException { thrown.expect(BindException.class); - thrown.expectMessage("Attempt to re-bind named parameter org.apache.reef.tang.OneNamedStringArg$A. Old value was [not default] new value is [volatile]"); + thrown.expectMessage("Attempt to re-bind named parameter org.apache.reef.tang.OneNamedStringArg$A. " + + " Old value was [not default] new value is [volatile]"); JavaConfigurationBuilder cb = tang.newConfigurationBuilder(); OneNamedStringArg a = tang.newInjector(cb.build()).getInstance( OneNamedStringArg.class); @@ -265,7 +269,8 @@ public class TestTang { public void testTwoNamedStringArgsReBindVolatileFail() throws BindException, InjectionException { thrown.expect(BindException.class); - thrown.expectMessage("Attempt to re-bind named parameter org.apache.reef.tang.TwoNamedStringArgs$A. Old value was [not defaultA] new value is [not defaultA]"); + thrown.expectMessage("Attempt to re-bind named parameter org.apache.reef.tang.TwoNamedStringArgs$A. " + + " Old value was [not defaultA] new value is [not defaultA]"); JavaConfigurationBuilder cb = tang.newConfigurationBuilder(); TwoNamedStringArgs a = tang.newInjector(cb.build()).getInstance( TwoNamedStringArgs.class); @@ -344,7 +349,8 @@ public class TestTang { @Test public void testWrongNamedImpl() throws BindException { thrown.expect(BindException.class); - thrown.expectMessage("Name<org.apache.reef.tang.NamedImpl$A> org.apache.reef.tang.NamedImpl$AImplName cannot take non-subclass org.apache.reef.tang.NamedImpl$Cimpl"); + thrown.expectMessage("Name<org.apache.reef.tang.NamedImpl$A> " + + "org.apache.reef.tang.NamedImpl$AImplName cannot take non-subclass org.apache.reef.tang.NamedImpl$Cimpl"); JavaConfigurationBuilder cb = tang.newConfigurationBuilder(); cb.bindNamedParameter((Class) NamedImpl.AImplName.class, (Class) NamedImpl.Cimpl.class); } @@ -360,7 +366,8 @@ public class TestTang { @Test public void testMissedUnit() throws BindException, InjectionException { thrown.expect(InjectionException.class); - thrown.expectMessage("Cannot inject org.apache.reef.tang.MissOuterUnit$InA: No known implementations / injectable constructors for org.apache.reef.tang.MissOuterUnit$InA"); + thrown.expectMessage("Cannot inject org.apache.reef.tang.MissOuterUnit$InA: " + + "No known implementations / injectable constructors for org.apache.reef.tang.MissOuterUnit$InA"); Injector inj = tang.newInjector(); MissOuterUnit.InA a = inj.getInstance(MissOuterUnit.InA.class); } @@ -368,7 +375,8 @@ public class TestTang { @Test public void testMissedUnitButWithInjectInnerClass() throws BindException, InjectionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Cannot @Inject non-static member class unless the enclosing class an @Unit. Nested class is:org.apache.reef.tang.MissOuterUnit$InB"); + thrown.expectMessage("Cannot @Inject non-static member class unless the enclosing class an @Unit. " + + " Nested class is:org.apache.reef.tang.MissOuterUnit$InB"); Injector inj = tang.newInjector(); MissOuterUnit.InB b = inj.getInstance(MissOuterUnit.InB.class); } @@ -405,8 +413,8 @@ public class TestTang { @Test public void testThreeConstructorsAmbiguous() throws BindException, InjectionException { thrown.expect(InjectionException.class); - thrown.expectMessage("Cannot inject org.apache.reef.tang.ThreeConstructors Ambigous subplan org.apache.reef.tang.ThreeConstructors"); -// thrown.expectMessage("Cannot inject org.apache.reef.tang.ThreeConstructors Multiple ways to inject org.apache.reef.tang.ThreeConstructors"); + thrown.expectMessage("Cannot inject org.apache.reef.tang.ThreeConstructors " + + "Ambiguous subplan org.apache.reef.tang.ThreeConstructors"); final JavaConfigurationBuilder cb = tang.newConfigurationBuilder(); cb.bindNamedParameter(TCString.class, "s"); @@ -420,7 +428,8 @@ public class TestTang { @Test public void testTwoConstructorsAmbiguous() throws BindException, InjectionException { thrown.expect(InjectionException.class); - thrown.expectMessage("Cannot inject org.apache.reef.tang.TwoConstructors: Multiple infeasible plans: org.apache.reef.tang.TwoConstructors:"); + thrown.expectMessage("Cannot inject org.apache.reef.tang.TwoConstructors: " + + "Multiple infeasible plans: org.apache.reef.tang.TwoConstructors:"); final JavaConfigurationBuilder cb = tang.newConfigurationBuilder(); cb.bindNamedParameter(TCString.class, "s"); cb.bindNamedParameter(TCInt.class, "1"); @@ -439,7 +448,8 @@ public class TestTang { @Test public void testCantGetInstanceOfNamedParameter() throws BindException, InjectionException { thrown.expect(InjectionException.class); - thrown.expectMessage("getInstance() called on Name org.apache.reef.tang.IfaceWithDefaultName Did you mean to call getNamedInstance() instead?"); + thrown.expectMessage("getInstance() called on Name org.apache.reef.tang.IfaceWithDefaultName " + + "Did you mean to call getNamedInstance() instead?"); ConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder(); Injector i = Tang.Factory.getTang().newInjector(cb.build()); @SuppressWarnings("unused") @@ -523,7 +533,8 @@ public class TestTang { @Test public void testGenericEventHandlerDefaultsBadTreeIndirection() throws BindException, InjectionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("class org.apache.reef.tang.XNameDAA defines a default class org.apache.reef.tang.XCC with a raw type that does not extend of its target's raw type class org.apache.reef.tang.XBB"); + thrown.expectMessage("class org.apache.reef.tang.XNameDAA defines a default class org.apache.reef.tang.XCC " + + "with a raw type that does not extend of its target's raw type class org.apache.reef.tang.XBB"); JavaConfigurationBuilder cba = Tang.Factory.getTang().newConfigurationBuilder(); Tang.Factory.getTang().newInjector(cba.build()).getNamedInstance(XNameDAA.class); @@ -538,7 +549,9 @@ public class TestTang { @Test public void testGenericUnrelatedGenericTypeParameters() throws BindException, InjectionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("class org.apache.reef.tang.WaterBottleName defines a default class org.apache.reef.tang.GasCan with a type that does not extend its target's type org.apache.reef.tang.Bottle<org.apache.reef.tang.Water"); + thrown.expectMessage("class org.apache.reef.tang.WaterBottleName defines a default class " + + "org.apache.reef.tang.GasCan with a type that does not extend its target's type " + + "org.apache.reef.tang.Bottle<org.apache.reef.tang.Water"); JavaConfigurationBuilder cba = Tang.Factory.getTang().newConfigurationBuilder(); Tang.Factory.getTang().newInjector(cba.build()).getNamedInstance(WaterBottleName.class); @@ -559,7 +572,8 @@ public class TestTang { @Test public void testGenericInterfaceUnboundTypeParametersIface() throws BindException, InjectionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("interface org.apache.reef.tang.MyEventHandlerIface declares its default implementation to be non-subclass class org.apache.reef.tang.MyEventHandler"); + thrown.expectMessage("interface org.apache.reef.tang.MyEventHandlerIface declares its default implementation " + + "to be non-subclass class org.apache.reef.tang.MyEventHandler"); JavaConfigurationBuilder cba = Tang.Factory.getTang().newConfigurationBuilder(); Tang.Factory.getTang().newInjector(cba.build()).isInjectable(MyEventHandlerIface.class); @@ -613,7 +627,8 @@ public class TestTang { @Test public void testUnitMixedCantInject() throws BindException, InjectionException { thrown.expect(InjectionException.class); - thrown.expectMessage("Cannot inject org.apache.reef.tang.OuterUnitWithStatic$InnerStaticClass: No known implementations / injectable constructors for org.apache.reef.tang.OuterUnitWithStatic$InnerStaticClass"); + thrown.expectMessage("Cannot inject org.apache.reef.tang.OuterUnitWithStatic$InnerStaticClass: No known " + + "implementations / injectable constructors for org.apache.reef.tang.OuterUnitWithStatic$InnerStaticClass"); //testing that you should be able to have @Unit and also static inner classes not included JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder(); @@ -678,7 +693,8 @@ public class TestTang { /** * This is to test multiple inheritance case. * When CheckChildImplImpl is bound to an interface, the CheckChildImplImpl instance will be created in injection - * When CheckChildImpl is then bound to the same interface, even class hierarchy already knows it has an subclass CheckChildImplImpl, + * When CheckChildImpl is then bound to the same interface, even class hierarchy already knows + * it has an subclass CheckChildImplImpl, * Tang will only look at the constructors in CheckChildImpl * * @throws BindException @@ -713,6 +729,7 @@ class Pass { } } +@SuppressWarnings("checkstyle:hideutilityclassconstructor") class IsFuture { static boolean instantiated; @@ -789,6 +806,7 @@ class Impl implements Interf { } } +@SuppressWarnings("checkstyle:hideutilityclassconstructor") class MustBeSingleton { static boolean alreadyInstantiated; @@ -946,10 +964,10 @@ class LegacyConstructor { } class NamedImpl { - static interface A { + interface A { } - static interface C { + interface C { } @@ -1280,7 +1298,8 @@ class WantSomeFutureHandlers { class WantSomeFutureHandlersUnit { @Inject - WantSomeFutureHandlersUnit(InjectionFuture<DefaultHandlerUnit.AHandler> a, InjectionFuture<DefaultHandlerUnit.BHandler> b) { + WantSomeFutureHandlersUnit(InjectionFuture<DefaultHandlerUnit.AHandler> a, + InjectionFuture<DefaultHandlerUnit.BHandler> b) { } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTweetExample.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTweetExample.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTweetExample.java index 721b004..a378702 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTweetExample.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/TestTweetExample.java @@ -29,7 +29,7 @@ import org.junit.*; import javax.inject.Inject; public class TestTweetExample { - Tang tang; + private Tang tang; @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -50,16 +50,17 @@ public class TestTweetExample { @Test public void test() throws Exception { - Tweeter tw = (Tweeter) tang.newInjector(TweetConfig.CONF.set(TweetConfig.PHONE_NUMBER, new Long(867 - 5309)).build()).getInstance(Tweeter.class); + Tweeter tw = (Tweeter) tang.newInjector(TweetConfig.CONF.set(TweetConfig.PHONE_NUMBER, + new Long(867 - 5309)).build()).getInstance(Tweeter.class); tw.sendMessage(); } - static interface TweetFactory { - public String getTweet(); + interface TweetFactory { + String getTweet(); } - static interface SMS { - public void sendSMS(String msg, long phoneNumber); + interface SMS { + void sendSMS(String msg, long phoneNumber); } static class MockTweetFactory implements TweetFactory { @@ -88,9 +89,9 @@ public class TestTweetExample { } static class Tweeter { - final TweetFactory tw; - final SMS sms; - final long phoneNumber; + private final TweetFactory tw; + private final SMS sms; + private final long phoneNumber; @Inject public Tweeter(TweetFactory tw, SMS sms, http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerAvroRoundtripTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerAvroRoundtripTest.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerAvroRoundtripTest.java index 80727ec..db05bd5 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerAvroRoundtripTest.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerAvroRoundtripTest.java @@ -34,7 +34,8 @@ public final class AvroConfigurationSerializerAvroRoundtripTest extends RoundTri } @Override - public Configuration roundTrip(final Configuration configuration, final ClassHierarchy classHierarchy) throws Exception { + public Configuration roundTrip(final Configuration configuration, final ClassHierarchy classHierarchy) + throws Exception { final AvroConfiguration aConf = new AvroConfigurationSerializer().toAvro(configuration); return new AvroConfigurationSerializer().fromAvro(aConf, classHierarchy); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerStringRoundtripTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerStringRoundtripTest.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerStringRoundtripTest.java index db55193..0ef97f9 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerStringRoundtripTest.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/AvroConfigurationSerializerStringRoundtripTest.java @@ -33,7 +33,8 @@ public class AvroConfigurationSerializerStringRoundtripTest extends RoundTripTes } @Override - public Configuration roundTrip(final Configuration configuration, final ClassHierarchy classHierarchy) throws Exception { + public Configuration roundTrip(final Configuration configuration, final ClassHierarchy classHierarchy) + throws Exception { final AvroConfigurationSerializer serializer = new AvroConfigurationSerializer(); return serializer.fromString(serializer.toString(configuration), classHierarchy); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/ConfigurationFileTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/ConfigurationFileTest.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/ConfigurationFileTest.java index d68cc91..a793a11 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/ConfigurationFileTest.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/ConfigurationFileTest.java @@ -43,7 +43,8 @@ public final class ConfigurationFileTest extends RoundTripTest { } @Override - public Configuration roundTrip(final Configuration configuration, final ClassHierarchy classHierarchy) throws Exception { + public Configuration roundTrip(final Configuration configuration, final ClassHierarchy classHierarchy) + throws Exception { final File tempFile = java.io.File.createTempFile("TangTest", "txt"); final ConfigurationSerializer serializer = new AvroConfigurationSerializer(); serializer.toTextFile(configuration, tempFile); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestCommandLine.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestCommandLine.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestCommandLine.java index 0c518c8..03bbe95 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestCommandLine.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestCommandLine.java @@ -45,7 +45,7 @@ public final class TestCommandLine { } /** - * Tests for parseToConfiguration() with a named parameter that is set + * Tests for parseToConfiguration() with a named parameter that is set. * * @throws ParseException * @throws InjectionException @@ -62,7 +62,7 @@ public final class TestCommandLine { } /** - * Tests for parseToConfiguration() with a named parameter that is not set + * Tests for parseToConfiguration() with a named parameter that is not set. * * @throws ParseException * @throws InjectionException http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestConfigurationModule.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestConfigurationModule.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestConfigurationModule.java index d895a07..3e432fd 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestConfigurationModule.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/TestConfigurationModule.java @@ -224,7 +224,8 @@ public class TestConfigurationModule { @Test public void foreignSetTest() throws Throwable { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Unknown Impl/Param when setting RequiredImpl. Did you pass in a field from some other module?"); + thrown.expectMessage("Unknown Impl/Param when setting RequiredImpl. " + + " Did you pass in a field from some other module?"); try { // Pass in something from the wrong module, watch it fail. MultiBindConfigurationModule.CONF.set(MyConfigurationModule.THE_FOO, FooImpl.class); @@ -236,7 +237,8 @@ public class TestConfigurationModule { @Test public void foreignBindTest() throws Throwable { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Unknown Impl/Param when binding RequiredImpl. Did you pass in a field from some other module?"); + thrown.expectMessage("Unknown Impl/Param when binding RequiredImpl. " + + " Did you pass in a field from some other module?"); try { // Pass in something from the wrong module, watch it fail. new MyConfigurationModule().bindImplementation(Object.class, MultiBindConfigurationModule.THE_FOO); @@ -346,8 +348,8 @@ public class TestConfigurationModule { } - static interface Foo { - public int getFooness(); + interface Foo { + int getFooness(); } static class FooImpl implements Foo { @@ -406,7 +408,7 @@ class SetName implements Name<Set<String>> { } class SetConfigurationModule extends ConfigurationModuleBuilder { - public final static RequiredParameter<String> P = new RequiredParameter<>(); + public static final RequiredParameter<String> P = new RequiredParameter<>(); public static final ConfigurationModule CONF = new SetConfigurationModule() .bindSetEntry(SetName.class, SetConfigurationModule.P) @@ -418,7 +420,7 @@ class SetClass implements Name<Set<Super>> { } class SetClassConfigurationModule extends ConfigurationModuleBuilder { - public final static RequiredParameter<Super> P = new RequiredParameter<>(); + public static final RequiredParameter<Super> P = new RequiredParameter<>(); public static final ConfigurationModule CONF = new SetClassConfigurationModule() .bindSetEntry(SetClass.class, SetClassConfigurationModule.P) .build(); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/package-info.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/package-info.java new file mode 100644 index 0000000..48c003e --- /dev/null +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/formats/package-info.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * TODO: Document. + */ +package org.apache.reef.tang.formats; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/TestClassHierarchy.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/TestClassHierarchy.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/TestClassHierarchy.java index d5a5821..ed859a5 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/TestClassHierarchy.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/TestClassHierarchy.java @@ -92,7 +92,7 @@ public class TestClassHierarchy { public void testSimpleConstructors() throws NameResolutionException { ClassNode<?> cls = (ClassNode<?>) ns.getNode(s(SimpleConstructors.class)); Assert.assertTrue(cls.getChildren().size() == 0); - ConstructorDef<?> def[] = cls.getInjectableConstructors(); + ConstructorDef<?>[] def = cls.getInjectableConstructors(); Assert.assertEquals(3, def.length); } @@ -111,14 +111,17 @@ public class TestClassHierarchy { @Test public void testRepeatConstructorArg() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Repeated constructor parameter detected. Cannot inject constructor org.apache.reef.tang.implementation.RepeatConstructorArg(int,int)"); + thrown.expectMessage("Repeated constructor parameter detected. " + + " Cannot inject constructor org.apache.reef.tang.implementation.RepeatConstructorArg(int,int)"); ns.getNode(s(RepeatConstructorArg.class)); } @Test public void testRepeatConstructorArgClasses() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Repeated constructor parameter detected. Cannot inject constructor org.apache.reef.tang.implementation.RepeatConstructorArgClasses(org.apache.reef.tang.implementation.A,org.apache.reef.tang.implementation.A)"); + thrown.expectMessage("Repeated constructor parameter detected. " + + " Cannot inject constructor org.apache.reef.tang.implementation.RepeatConstructorArgClasses" + + "(org.apache.reef.tang.implementation.A,org.apache.reef.tang.implementation.A)"); ns.getNode(s(RepeatConstructorArgClasses.class)); } @@ -147,14 +150,17 @@ public class TestClassHierarchy { @Test public void testNamedParameterTypeMismatch() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Named parameter type mismatch in org.apache.reef.tang.implementation.NamedParameterTypeMismatch. Constructor expects a java.lang.String but Foo is a java.lang.Integer"); + thrown.expectMessage("Named parameter type mismatch in " + + "org.apache.reef.tang.implementation.NamedParameterTypeMismatch. " + + " Constructor expects a java.lang.String but Foo is a java.lang.Integer"); ns.getNode(s(NamedParameterTypeMismatch.class)); } @Test public void testUnannotatedName() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.UnannotatedName is missing its @NamedParameter annotation."); + thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.UnannotatedName " + + "is missing its @NamedParameter annotation."); ns.getNode(s(UnannotatedName.class)); } @@ -162,49 +168,56 @@ public class TestClassHierarchy { @Test public void testAnnotatedNotName() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Found illegal @NamedParameter org.apache.reef.tang.implementation.AnnotatedNotName does not implement Name<?>"); + thrown.expectMessage("Found illegal @NamedParameter org.apache.reef.tang.implementation.AnnotatedNotName " + + "does not implement Name<?>"); ns.getNode(s(AnnotatedNotName.class)); } @Test public void testAnnotatedNameWrongInterface() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Found illegal @NamedParameter org.apache.reef.tang.implementation.AnnotatedNameWrongInterface does not implement Name<?>"); + thrown.expectMessage("Found illegal @NamedParameter " + + "org.apache.reef.tang.implementation.AnnotatedNameWrongInterface does not implement Name<?>"); ns.getNode(s(AnnotatedNameWrongInterface.class)); } @Test public void testAnnotatedNameNotGenericInterface() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Found illegal @NamedParameter org.apache.reef.tang.implementation.AnnotatedNameNotGenericInterface does not implement Name<?>"); + thrown.expectMessage("Found illegal @NamedParameter " + + "org.apache.reef.tang.implementation.AnnotatedNameNotGenericInterface does not implement Name<?>"); ns.getNode(s(AnnotatedNameNotGenericInterface.class)); } @Test public void testAnnotatedNameMultipleInterfaces() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.AnnotatedNameMultipleInterfaces implements multiple interfaces. It is only allowed to implement Name<T>"); + thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.AnnotatedNameMultipleInterfaces " + + "implements multiple interfaces. It is only allowed to implement Name<T>"); ns.getNode(s(AnnotatedNameMultipleInterfaces.class)); } @Test public void testUnAnnotatedNameMultipleInterfaces() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.UnAnnotatedNameMultipleInterfaces is missing its @NamedParameter annotation."); + thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.UnAnnotatedNameMultipleInterfaces " + + "is missing its @NamedParameter annotation."); ns.getNode(s(UnAnnotatedNameMultipleInterfaces.class)); } @Test public void testNameWithConstructor() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.NameWithConstructor has a constructor. Named parameters must not declare any constructors."); + thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.NameWithConstructor has a constructor. " + + " Named parameters must not declare any constructors."); ns.getNode(s(NameWithConstructor.class)); } @Test public void testNameWithZeroArgInject() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.NameWithZeroArgInject has an injectable constructor. Named parameters must not declare any constructors."); + thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.NameWithZeroArgInject has " + + "an injectable constructor. Named parameters must not declare any constructors."); ns.getNode(s(NameWithZeroArgInject.class)); } @@ -315,7 +328,8 @@ public class TestClassHierarchy { @Test public void testBadUnitDecl() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Detected explicit constructor in class enclosed in @Unit org.apache.reef.tang.implementation.OuterUnitBad$InA Such constructors are disallowed."); + thrown.expectMessage("Detected explicit constructor in class enclosed in @Unit " + + "org.apache.reef.tang.implementation.OuterUnitBad$InA Such constructors are disallowed."); ns.getNode(s(OuterUnitBad.class)); } @@ -323,7 +337,8 @@ public class TestClassHierarchy { @Test public void nameCantBindWrongSubclassAsDefault() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("class org.apache.reef.tang.implementation.BadName defines a default class java.lang.Integer with a raw type that does not extend of its target's raw type class java.lang.String"); + thrown.expectMessage("class org.apache.reef.tang.implementation.BadName defines a default class " + + "java.lang.Integer with a raw type that does not extend of its target's raw type class java.lang.String"); ns.getNode(s(BadName.class)); } @@ -331,21 +346,24 @@ public class TestClassHierarchy { @Test public void ifaceCantBindWrongImplAsDefault() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("interface org.apache.reef.tang.implementation.BadIfaceDefault declares its default implementation to be non-subclass class java.lang.String"); + thrown.expectMessage("interface org.apache.reef.tang.implementation.BadIfaceDefault declares " + + "its default implementation to be non-subclass class java.lang.String"); ns.getNode(s(BadIfaceDefault.class)); } @Test public void testParseableDefaultClassNotOK() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.BadParsableDefaultClass defines default implementation for parsable type java.lang.String"); + thrown.expectMessage("Named parameter org.apache.reef.tang.implementation.BadParsableDefaultClass " + + "defines default implementation for parsable type java.lang.String"); ns.getNode(s(BadParsableDefaultClass.class)); } @Test public void testDanglingUnit() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("Class org.apache.reef.tang.implementation.DanglingUnit has an @Unit annotation, but no non-static inner classes. Such @Unit annotations would have no effect, and are therefore disallowed."); + thrown.expectMessage("Class org.apache.reef.tang.implementation.DanglingUnit has an @Unit annotation, " + + "but no non-static inner classes. Such @Unit annotations would have no effect, and are therefore disallowed."); ns.getNode(s(DanglingUnit.class)); @@ -354,7 +372,8 @@ public class TestClassHierarchy { @Test public void testNonInjectableParam() throws NameResolutionException { thrown.expect(ClassHierarchyException.class); - thrown.expectMessage("public org.apache.reef.tang.implementation.NonInjectableParam(int) is not injectable, but it has an @Parameter annotation."); + thrown.expectMessage("public org.apache.reef.tang.implementation.NonInjectableParam(int) is not injectable, " + + "but it has an @Parameter annotation."); ns.getNode(s(NonInjectableParam.class)); } @@ -392,17 +411,14 @@ class NamedParameterConstructors { public NamedParameterConstructors(String x, @Parameter(X.class) String y) { } - ; - @NamedParameter() class X implements Name<String> { } } class RepeatConstructorArg { - public @Inject - RepeatConstructorArg(int x, int y) { + public RepeatConstructorArg(int x, int y) { } } @@ -410,9 +426,8 @@ class A { } class RepeatConstructorArgClasses { - public @Inject - RepeatConstructorArgClasses(A x, A y) { + public RepeatConstructorArgClasses(A x, A y) { } } @@ -444,10 +459,9 @@ class BB implements Name<A> { } class NamedRepeatConstructorArgClasses { - public @Inject - NamedRepeatConstructorArgClasses(@Parameter(AA.class) A x, - @Parameter(BB.class) A y) { + public NamedRepeatConstructorArgClasses(@Parameter(AA.class) A x, + @Parameter(BB.class) A y) { } } @@ -497,7 +511,7 @@ class AnnotatedNameMultipleInterfaces implements Name<Object>, I1 { } @NamedParameter() -class NameWithConstructor implements Name<Object> { +final class NameWithConstructor implements Name<Object> { private NameWithConstructor(int i) { } } @@ -591,6 +605,7 @@ class Nested { } } +@SuppressWarnings("checkstyle:hideutilityclassconstructor") class AnonNested { static X x = new X() { @SuppressWarnings("unused") @@ -601,7 +616,7 @@ class AnonNested { int j; }; - static interface X { + interface X { } } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/avro/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/avro/package-info.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/avro/package-info.java new file mode 100644 index 0000000..ef641be --- /dev/null +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/avro/package-info.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * TODO: Document. + */ +package org.apache.reef.tang.implementation.avro; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestConfigurationBuilder.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestConfigurationBuilder.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestConfigurationBuilder.java index 8e13f55..e644ebb 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestConfigurationBuilder.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestConfigurationBuilder.java @@ -29,7 +29,7 @@ import org.junit.rules.ExpectedException; import javax.inject.Inject; /** - * TestConfigurationBuilder + * TestConfigurationBuilder. */ public class TestConfigurationBuilder { @Rule @@ -38,7 +38,8 @@ public class TestConfigurationBuilder { @Test public void nullStringVaueTest() { thrown.expect(IllegalStateException.class); - thrown.expectMessage("The value null set to the named parameter is illegal: class org.apache.reef.tang.implementation.java.TestConfigurationBuilder$NamedParamterNoDefault$NamedString"); + thrown.expectMessage("The value null set to the named parameter is illegal: class " + + "org.apache.reef.tang.implementation.java.TestConfigurationBuilder$NamedParamterNoDefault$NamedString"); Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(NamedParamterNoDefault.NamedString.class, (String) null) @@ -46,7 +47,7 @@ public class TestConfigurationBuilder { } static class NamedParamterNoDefault { - final private String str; + private final String str; @Inject NamedParamterNoDefault(@Parameter(NamedString.class) String str) { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestParameterParser.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestParameterParser.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestParameterParser.java index 9101a0d..a521f47 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestParameterParser.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/TestParameterParser.java @@ -89,7 +89,10 @@ public class TestParameterParser { @Test public void testBadMerge() throws BindException { thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("Conflict detected when merging parameter parsers! To parse org.apache.reef.tang.implementation.java.TestParameterParser$Foo I have a: org.apache.reef.tang.implementation.java.TestParameterParser$FooParser the other instance has a: org.apache.reef.tang.implementation.java.TestParameterParser$BarParser"); + thrown.expectMessage("Conflict detected when merging parameter parsers! To parse " + + "org.apache.reef.tang.implementation.java.TestParameterParser$Foo I have a: " + + "org.apache.reef.tang.implementation.java.TestParameterParser$FooParser the other instance has a: " + + "org.apache.reef.tang.implementation.java.TestParameterParser$BarParser"); ParameterParser old = new ParameterParser(); old.addParser(BarParser.class); ParameterParser nw = new ParameterParser(); http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/package-info.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/package-info.java new file mode 100644 index 0000000..669dd6d --- /dev/null +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/java/package-info.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * TODO: Document. + */ +package org.apache.reef.tang.implementation.java; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/package-info.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/package-info.java new file mode 100644 index 0000000..be446fd --- /dev/null +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/implementation/package-info.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * TODO: Document. + */ +package org.apache.reef.tang.implementation; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/package-info.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/package-info.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/package-info.java new file mode 100644 index 0000000..626ed1e --- /dev/null +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/package-info.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +/** + * TODO: Document. + */ +package org.apache.reef.tang; http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterface.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterface.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterface.java index 257a5c9..4e27cb2 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterface.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterface.java @@ -21,7 +21,7 @@ package org.apache.reef.tang.test; import org.apache.reef.tang.annotations.DefaultImplementation; /** - * An interface with a default implementation + * An interface with a default implementation. */ @DefaultImplementation(AnInterfaceImplementation.class) interface AnInterface { http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterfaceImplementation.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterfaceImplementation.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterfaceImplementation.java index 06565ea..18b6e86 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterfaceImplementation.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/AnInterfaceImplementation.java @@ -35,12 +35,18 @@ final class AnInterfaceImplementation implements AnInterface { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } AnInterfaceImplementation that = (AnInterfaceImplementation) o; - if (aMagicNumber != that.aMagicNumber) return false; + if (aMagicNumber != that.aMagicNumber) { + return false; + } return true; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependency.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependency.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependency.java index 670eb1d..4e2789a 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependency.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependency.java @@ -21,7 +21,7 @@ package org.apache.reef.tang.test; import javax.inject.Inject; /** - * Part of a cyclic dependency + * Part of a cyclic dependency. */ final class CyclicDependency { private final CyclicDependencyClassOne one; @@ -36,13 +36,21 @@ final class CyclicDependency { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } CyclicDependency that = (CyclicDependency) o; - if (!one.equals(that.one)) return false; - if (!two.equals(that.two)) return false; + if (!one.equals(that.one)) { + return false; + } + if (!two.equals(that.two)) { + return false; + } return true; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassOne.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassOne.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassOne.java index a0aa74e..1c56a6e 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassOne.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassOne.java @@ -21,7 +21,7 @@ package org.apache.reef.tang.test; import javax.inject.Inject; /** - * Part of a cyclic dependency + * Part of a cyclic dependency. */ final class CyclicDependencyClassOne { private final CyclicDependencyClassTwo other; @@ -33,12 +33,18 @@ final class CyclicDependencyClassOne { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } CyclicDependencyClassOne that = (CyclicDependencyClassOne) o; - if (!other.equals(that.other)) return false; + if (!other.equals(that.other)) { + return false; + } return true; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassTwo.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassTwo.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassTwo.java index 81d2eac..8823f97 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassTwo.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/CyclicDependencyClassTwo.java @@ -35,8 +35,12 @@ final class CyclicDependencyClassTwo { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } return true; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/Handler.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/Handler.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/Handler.java index e7dff97..9a750fb 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/Handler.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/Handler.java @@ -25,6 +25,6 @@ package org.apache.reef.tang.test; */ interface Handler<T> { - public void process(final T value); + void process(final T value); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/InjectableClass.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/InjectableClass.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/InjectableClass.java index fefb91c..c0e9392 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/InjectableClass.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/InjectableClass.java @@ -30,12 +30,18 @@ final class InjectableClass { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } InjectableClass that = (InjectableClass) o; - if (magicNumber != that.magicNumber) return false; + if (magicNumber != that.magicNumber) { + return false; + } return true; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfBaseTypes.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfBaseTypes.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfBaseTypes.java index fc94db0..b93ead5 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfBaseTypes.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfBaseTypes.java @@ -44,14 +44,24 @@ final class ListOfBaseTypes { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } ListOfBaseTypes that = (ListOfBaseTypes) o; - if (!doubles.equals(that.doubles)) return false; - if (!integers.equals(that.integers)) return false; - if (!strings.equals(that.strings)) return false; + if (!doubles.equals(that.doubles)) { + return false; + } + if (!integers.equals(that.integers)) { + return false; + } + if (!strings.equals(that.strings)) { + return false; + } return true; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfImplementations.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfImplementations.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfImplementations.java index c8fd118..fb8e826 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfImplementations.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ListOfImplementations.java @@ -34,12 +34,18 @@ public class ListOfImplementations { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } ListOfImplementations that = (ListOfImplementations) o; - if (!theInstances.equals(that.theInstances)) return false; + if (!theInstances.equals(that.theInstances)) { + return false; + } return true; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ObjectTreeTest.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ObjectTreeTest.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ObjectTreeTest.java index 98ba7ca..8aebdaa 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ObjectTreeTest.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/ObjectTreeTest.java @@ -53,8 +53,10 @@ public class ObjectTreeTest { @Test public void testTwoInstantiations() throws BindException, InjectionException { - final RootInterface firstRoot = Tang.Factory.getTang().newInjector(getConfiguration()).getInstance(RootInterface.class); - final RootInterface secondRoot = Tang.Factory.getTang().newInjector(getConfiguration()).getInstance(RootInterface.class); + final RootInterface firstRoot = + Tang.Factory.getTang().newInjector(getConfiguration()).getInstance(RootInterface.class); + final RootInterface secondRoot = + Tang.Factory.getTang().newInjector(getConfiguration()).getInstance(RootInterface.class); Assert.assertNotSame("Two instantiations of the object tree should not be the same", firstRoot, secondRoot); Assert.assertEquals("Two instantiations of the object tree should be equal", firstRoot, secondRoot); } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementation.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementation.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementation.java index 02ed14b..efd4c07 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementation.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementation.java @@ -115,35 +115,59 @@ final class RootImplementation implements RootInterface { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } RootImplementation that = (RootImplementation) o; - if (Double.compare(that.aDouble, aDouble) != 0) return false; - if (anInt != that.anInt) return false; - if (anInterface != null ? !anInterface.equals(that.anInterface) : that.anInterface != null) return false; - if (integerHandler != null ? !integerHandler.equals(that.integerHandler) : that.integerHandler != null) + if (Double.compare(that.aDouble, aDouble) != 0) { + return false; + } + if (anInt != that.anInt) { + return false; + } + if (anInterface != null ? !anInterface.equals(that.anInterface) : that.anInterface != null) { + return false; + } + if (integerHandler != null ? !integerHandler.equals(that.integerHandler) : that.integerHandler != null) { + return false; + } + if (optionalString != null ? !optionalString.equals(that.optionalString) : that.optionalString != null) { return false; - if (optionalString != null ? !optionalString.equals(that.optionalString) : that.optionalString != null) + } + if (requiredString != null ? !requiredString.equals(that.requiredString) : that.requiredString != null) { return false; - if (requiredString != null ? !requiredString.equals(that.requiredString) : that.requiredString != null) + } + if (stringHandler != null ? !stringHandler.equals(that.stringHandler) : that.stringHandler != null) { return false; - if (stringHandler != null ? !stringHandler.equals(that.stringHandler) : that.stringHandler != null) return false; - if (unit != null ? !unit.equals(that.unit) : that.unit != null) return false; - if (injectableClass != null ? !injectableClass.equals(that.injectableClass) : that.injectableClass != null) + } + if (unit != null ? !unit.equals(that.unit) : that.unit != null) { return false; - if (setOfImplementations != null ? !setOfImplementations.equals(that.setOfImplementations) : that.setOfImplementations != null) + } + if (injectableClass != null ? !injectableClass.equals(that.injectableClass) : that.injectableClass != null) { return false; - if (setOfBaseTypes != null ? !setOfBaseTypes.equals(that.setOfBaseTypes) : that.setOfBaseTypes != null) + } + if (setOfImplementations != null ? !setOfImplementations.equals(that.setOfImplementations) + : that.setOfImplementations != null) { return false; - if (listOfImplementations != null ? !listOfImplementations.equals(that.listOfImplementations) : that - .listOfImplementations != null) + } + if (setOfBaseTypes != null ? !setOfBaseTypes.equals(that.setOfBaseTypes) : that.setOfBaseTypes != null) { return false; - if (listOfBaseTypes != null ? !listOfBaseTypes.equals(that.listOfBaseTypes) : that.listOfBaseTypes != null) + } + if (listOfImplementations != null ? !listOfImplementations.equals(that.listOfImplementations) + : that.listOfImplementations != null) { return false; - if (cyclicDependency != null ? !cyclicDependency.equals(that.cyclicDependency) : that.cyclicDependency != null) + } + if (listOfBaseTypes != null ? !listOfBaseTypes.equals(that.listOfBaseTypes) : that.listOfBaseTypes != null) { return false; + } + if (cyclicDependency != null ? !cyclicDependency.equals(that.cyclicDependency) : that.cyclicDependency != null) { + return false; + } return true; } http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/a5cc9729/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementationWithoutList.java ---------------------------------------------------------------------- diff --git a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementationWithoutList.java b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementationWithoutList.java index e90221e..cc2a474 100644 --- a/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementationWithoutList.java +++ b/lang/java/reef-tang/tang/src/test/java/org/apache/reef/tang/test/RootImplementationWithoutList.java @@ -23,7 +23,7 @@ import org.apache.reef.tang.annotations.Parameter; import javax.inject.Inject; /** - * The root of the object graph without list + * The root of the object graph without list. * * @see org.apache.reef.tang.test.RootImplementation */ @@ -109,30 +109,52 @@ public class RootImplementationWithoutList implements RootInterface { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } RootImplementationWithoutList that = (RootImplementationWithoutList) o; - if (Double.compare(that.aDouble, aDouble) != 0) return false; - if (anInt != that.anInt) return false; - if (anInterface != null ? !anInterface.equals(that.anInterface) : that.anInterface != null) return false; - if (integerHandler != null ? !integerHandler.equals(that.integerHandler) : that.integerHandler != null) + if (Double.compare(that.aDouble, aDouble) != 0) { + return false; + } + if (anInt != that.anInt) { + return false; + } + if (anInterface != null ? !anInterface.equals(that.anInterface) : that.anInterface != null) { + return false; + } + if (integerHandler != null ? !integerHandler.equals(that.integerHandler) : that.integerHandler != null) { + return false; + } + if (optionalString != null ? !optionalString.equals(that.optionalString) : that.optionalString != null) { return false; - if (optionalString != null ? !optionalString.equals(that.optionalString) : that.optionalString != null) + } + if (requiredString != null ? !requiredString.equals(that.requiredString) : that.requiredString != null) { return false; - if (requiredString != null ? !requiredString.equals(that.requiredString) : that.requiredString != null) + } + if (stringHandler != null ? !stringHandler.equals(that.stringHandler) : that.stringHandler != null) { + return false; + } + if (unit != null ? !unit.equals(that.unit) : that.unit != null) { return false; - if (stringHandler != null ? !stringHandler.equals(that.stringHandler) : that.stringHandler != null) return false; - if (unit != null ? !unit.equals(that.unit) : that.unit != null) return false; - if (injectableClass != null ? !injectableClass.equals(that.injectableClass) : that.injectableClass != null) + } + if (injectableClass != null ? !injectableClass.equals(that.injectableClass) : that.injectableClass != null) { return false; - if (setOfImplementations != null ? !setOfImplementations.equals(that.setOfImplementations) : that.setOfImplementations != null) + } + if (setOfImplementations != null ? !setOfImplementations.equals(that.setOfImplementations) + : that.setOfImplementations != null) { return false; - if (setOfBaseTypes != null ? !setOfBaseTypes.equals(that.setOfBaseTypes) : that.setOfBaseTypes != null) + } + if (setOfBaseTypes != null ? !setOfBaseTypes.equals(that.setOfBaseTypes) : that.setOfBaseTypes != null) { return false; - if (cyclicDependency != null ? !cyclicDependency.equals(that.cyclicDependency) : that.cyclicDependency != null) + } + if (cyclicDependency != null ? !cyclicDependency.equals(that.cyclicDependency) : that.cyclicDependency != null) { return false; + } return true; }
