// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/Action.java
// public interface Action {
//     public void doSomething();
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/HasParentServices.java
// public interface HasParentServices
//         extends ScopeKey.Child {
//     void bindServices(ServiceBinder serviceBinder);
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/HasServices.java
// public interface HasServices
//         extends ScopeKey {
//     void bindServices(ServiceBinder serviceBinder);
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/ServiceProvider.java
// public class ServiceProvider
//         implements ScopedServices {
//     @Override
//     public void bindServices(@Nonnull ServiceBinder serviceBinder) {
//         Object key = serviceBinder.getKey();
//         if(key instanceof HasServices) {
//             ((HasServices) key).bindServices(serviceBinder);
//             return;
//         }
//         if(key instanceof HasParentServices) {
//             ((HasParentServices) key).bindServices(serviceBinder);
//             //noinspection UnnecessaryReturnStatement
//             return;
//         }
//     }
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/TestKey.java
// public class TestKey
//         implements Parcelable {
//     public final String name;
// 
//     public TestKey(String name) {
//         this.name = name;
//     }
// 
//     protected TestKey(Parcel in) {
//         name = in.readString();
//     }
// 
//     public static final Creator<TestKey> CREATOR = new Creator<TestKey>() {
//         @Override
//         public TestKey createFromParcel(Parcel in) {
//             return new TestKey(in);
//         }
// 
//         @Override
//         public TestKey[] newArray(int size) {
//             return new TestKey[size];
//         }
//     };
// 
//     @Override
//     public boolean equals(Object o) {
//         if(this == o) {
//             return true;
//         }
//         if(o == null || getClass() != o.getClass()) {
//             return false;
//         }
//         TestKey key = (TestKey) o;
//         return name.equals(key.name);
//     }
// 
//     @Override
//     public int hashCode() {
//         return name.hashCode();
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("%s{%h}", name, this);
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(name);
//     }
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/AssertionHelper.java
// public static void assertThrows(Action action) {
//     try {
//         action.doSomething();
//         Assert.fail("Did not throw exception.");
//     } catch(Exception e) {
//         // OK!
//     }
// }


import static org.assertj.core.api.Assertions.assertThat;
import android.os.Parcel;
import com.zhuinden.simplestack.helpers.Action;
import com.zhuinden.simplestack.helpers.HasParentServices;
import com.zhuinden.simplestack.helpers.HasServices;
import com.zhuinden.simplestack.helpers.ServiceProvider;
import com.zhuinden.simplestack.helpers.TestKey;
import org.junit.Test;
import java.util.List;
import javax.annotation.Nonnull;
import static com.zhuinden.simplestack.helpers.AssertionHelper.assertThrows;
/*
 * Copyright 2019 Gabor Varadi
 *
 * Licensed 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.
 */
package com.zhuinden.simplestack;







public class ScopeLookupModeTest {
    @Test
    public void lookupModesWork() {
        final Backstack backstack = new Backstack();
        backstack.setScopedServices(new ServiceProvider());

        final Object parentService1 = new Object();
        final Object parentService2 = new Object();

        final Object service1 = new Object();
        final Object service2 = new Object();

        class Key1
                extends TestKey
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/Action.java
// public interface Action {
//     public void doSomething();
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/HasParentServices.java
// public interface HasParentServices
//         extends ScopeKey.Child {
//     void bindServices(ServiceBinder serviceBinder);
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/HasServices.java
// public interface HasServices
//         extends ScopeKey {
//     void bindServices(ServiceBinder serviceBinder);
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/ServiceProvider.java
// public class ServiceProvider
//         implements ScopedServices {
//     @Override
//     public void bindServices(@Nonnull ServiceBinder serviceBinder) {
//         Object key = serviceBinder.getKey();
//         if(key instanceof HasServices) {
//             ((HasServices) key).bindServices(serviceBinder);
//             return;
//         }
//         if(key instanceof HasParentServices) {
//             ((HasParentServices) key).bindServices(serviceBinder);
//             //noinspection UnnecessaryReturnStatement
//             return;
//         }
//     }
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/TestKey.java
// public class TestKey
//         implements Parcelable {
//     public final String name;
// 
//     public TestKey(String name) {
//         this.name = name;
//     }
// 
//     protected TestKey(Parcel in) {
//         name = in.readString();
//     }
// 
//     public static final Creator<TestKey> CREATOR = new Creator<TestKey>() {
//         @Override
//         public TestKey createFromParcel(Parcel in) {
//             return new TestKey(in);
//         }
// 
//         @Override
//         public TestKey[] newArray(int size) {
//             return new TestKey[size];
//         }
//     };
// 
//     @Override
//     public boolean equals(Object o) {
//         if(this == o) {
//             return true;
//         }
//         if(o == null || getClass() != o.getClass()) {
//             return false;
//         }
//         TestKey key = (TestKey) o;
//         return name.equals(key.name);
//     }
// 
//     @Override
//     public int hashCode() {
//         return name.hashCode();
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("%s{%h}", name, this);
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(name);
//     }
// }
// 
// Path: simple-stack/src/test/java/com/zhuinden/simplestack/helpers/AssertionHelper.java
// public static void assertThrows(Action action) {
//     try {
//         action.doSomething();
//         Assert.fail("Did not throw exception.");
//     } catch(Exception e) {
//         // OK!
//     }
// }


// Path: simple-stack/src/test/java/com/zhuinden/simplestack/ScopeLookupModeTest.java
import static org.assertj.core.api.Assertions.assertThat;
import android.os.Parcel;
import com.zhuinden.simplestack.helpers.Action;
import com.zhuinden.simplestack.helpers.HasParentServices;
import com.zhuinden.simplestack.helpers.HasServices;
import com.zhuinden.simplestack.helpers.ServiceProvider;
import com.zhuinden.simplestack.helpers.TestKey;
import org.junit.Test;
import java.util.List;
import javax.annotation.Nonnull;
import static com.zhuinden.simplestack.helpers.AssertionHelper.assertThrows;

/*
 * Copyright 2019 Gabor Varadi
 *
 * Licensed 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.
 */
package com.zhuinden.simplestack;







public class ScopeLookupModeTest {
    @Test
    public void lookupModesWork() {
        final Backstack backstack = new Backstack();
        backstack.setScopedServices(new ServiceProvider());

        final Object parentService1 = new Object();
        final Object parentService2 = new Object();

        final Object service1 = new Object();
        final Object service2 = new Object();

        class Key1
                extends TestKey
                implements HasServices, HasParentServices {