@@ -0,0 +1,2432 @@
+/**%0D%0A * Copyright (C) 2012 Square, Inc.%0D%0A * %0D%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A * you may not use this file except in compliance with the License.%0D%0A * You may obtain a copy of the License at%0D%0A * %0D%0A * http://www.apache.org/licenses/LICENSE-2.0%0D%0A * %0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A * See the License for the specific language governing permissions and%0D%0A * limitations under the License.%0D%0A */%0D%0A%0D%0Apackage dagger.internal;%0D%0A%0D%0Aimport static org.fest.assertions.Assertions.assertThat;%0D%0Aimport org.junit.Before;%0D%0Aimport org.junit.Test;%0D%0A%0D%0Apublic final class BindingTest %7B%0D%0A  private Binding%3CString%3E wrappedBinding;%0D%0A  private Binding%3CString%3E singletonBinding;%0D%0A%0D%0A  @Before public void setUp() %7B%0D%0A    wrappedBinding = new StringBinding();%0D%0A    singletonBinding = Linker.scope(wrappedBinding);%0D%0A  %7D%0D%0A%0D%0A  @Test public void testSingletonBindingIsSingleton() %7B%0D%0A    assertThat(singletonBinding.isSingleton());%0D%0A  %7D%0D%0A%0D%0A  // this next batch of tests validate that SingletonBinding consistently delegates to the wrapped binding for state%0D%0A  @Test public void testSingletonBindingDelegatesSetLinked() %7B%0D%0A    singletonBinding.setLinked();%0D%0A    assertThat(wrappedBinding.isLinked()).isTrue();%0D%0A  %7D%0D%0A%0D%0A  @Test public void testSingletonBindingDelegatesIsLinked() %7B%0D%0A    wrappedBinding.setLinked();%0D%0A    assertThat(singletonBinding.isLinked()).isTrue();%0D%0A  %7D%0D%0A%0D%0A  @Test public void testSingletonBindingDelegatesSetVisiting() %7B%0D%0A    singletonBinding.setVisiting(true);%0D%0A    assertThat(wrappedBinding.isVisiting()).isTrue();%0D%0A  %7D%0D%0A%0D%0A  @Test public void testSingletonBindingDelegatesIsVisiting() %7B%0D%0A    wrappedBinding.setVisiting(true);%0D%0A    assertThat(singletonBinding.isVisiting()).isTrue();%0D%0A  %7D%0D%0A%0D%0A  @Test public void testSingletonBindingDelegatesSetCycleFree() %7B%0D%0A    singletonBinding.setCycleFree(true);%0D%0A    assertThat(wrappedBinding.isCycleFree()).isTrue();%0D%0A  %7D%0D%0A%0D%0A  @Test public void testSingletonBindingDelegatesIsCycleFree() %7B%0D%0A    wrappedBinding.setCycleFree(true);%0D%0A    assertThat(singletonBinding.isCycleFree()).isTrue();%0D%0A  %7D%0D%0A%0D%0A  private static class StringBinding extends Binding%3CString%3E %7B%0D%0A    private StringBinding() %7B%0D%0A      super(%22dummy%22, %22dummy%22, true, %22dummy%22); // 3rd arg true =%3E singleton%0D%0A    %7D%0D%0A%0D%0A  %7D%0D%0A%7D%0D%0A

add failing tests for validating that SingletonBinding delegates to the wrapped binding for getting/setting state. Signed-off-by: Andy Dennie <github@adennie.e4ward.com>