// Path: phial-overlay/src/main/java/com/mindcoders/phial/Page.java
// public final class Page {
// 
//     /**
//      * Factory that is used to create views when page is selected
//      *
//      * @param <T> view to display
//      */
//     public interface PageViewFactory<T extends View & PageView> {
// 
//         /**
//          * @param context         android application context
//          * @param overlayCallback interface for communication with Phial
//          * @return view to display
//          */
//         T createPageView(Context context, OverlayCallback overlayCallback);
// 
//     }
// 
//     private final String id;
//     private final int iconResourceId;
//     private final CharSequence title;
//     private final PageViewFactory pageViewFactory;
//     private final Set<TargetScreen> targetScreens;
// 
//     /**
//      * @param id              unique pageId
//      * @param iconResourceId  page icon
//      * @param title           page title
//      * @param pageViewFactory factory that will create view when page is selected
//      */
//     public Page(
//             String id,
//             int iconResourceId,
//             CharSequence title,
//             PageViewFactory pageViewFactory
//     ) {
//         this(id, iconResourceId, title, pageViewFactory, Collections.<TargetScreen>emptySet());
//     }
// 
//     /**
//      * @param id              unique pageId
//      * @param iconResourceId  page icon
//      * @param title           page title
//      * @param pageViewFactory factory that will create view when page is selected
//      * @param targetScreens   screens to present this page on. Page will be present on all screens if this is empty.
//      */
//     public Page(
//             String id,
//             int iconResourceId,
//             CharSequence title,
//             PageViewFactory pageViewFactory,
//             Set<TargetScreen> targetScreens
//     ) {
//         this.id = id;
//         this.iconResourceId = iconResourceId;
//         this.title = title;
//         this.pageViewFactory = pageViewFactory;
//         this.targetScreens = Collections.unmodifiableSet(targetScreens);
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public int getIconResourceId() {
//         return iconResourceId;
//     }
// 
//     public CharSequence getTitle() {
//         return title;
//     }
// 
//     public PageViewFactory getPageViewFactory() {
//         return pageViewFactory;
//     }
// 
//     public Set<TargetScreen> getTargetScreens() {
//         return targetScreens;
//     }
// 
// }


import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.WindowManager;
import com.mindcoders.phial.Page;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
        final ArgumentCaptor<View> viewArgumentCaptor = ArgumentCaptor.forClass(View.class);
        verify(windowManager).addView(viewArgumentCaptor.capture(), any());
        verify(dragHelper).animateFromDefaultPosition(eq(viewArgumentCaptor.getValue()), any());
        view.removeButton(activity);
        verify(windowManager).removeView(viewArgumentCaptor.getValue());
    }

    @Test
    public void show_and_remove_button_several_activities() {
        final ArgumentCaptor<View> viewArgumentCaptor = ArgumentCaptor.forClass(View.class);

        final WindowManager windowManager1 = mock(WindowManager.class);
        final Activity activity1 = mockActivity(windowManager1);
        final ArgumentCaptor<View> viewArgumentCaptor1 = ArgumentCaptor.forClass(View.class);

        view.showButton(activity, false);
        verify(windowManager).addView(viewArgumentCaptor.capture(), any());

        view.showButton(activity1, false);
        verify(windowManager1).addView(viewArgumentCaptor1.capture(), any());

        view.removeButton(activity);
        verify(windowManager).removeView(viewArgumentCaptor.getValue());

        view.removeButton(activity1);
        verify(windowManager1).removeView(viewArgumentCaptor1.getValue());
    }

    @Test
    public void showExpandedView() {
// Path: phial-overlay/src/main/java/com/mindcoders/phial/Page.java
// public final class Page {
// 
//     /**
//      * Factory that is used to create views when page is selected
//      *
//      * @param <T> view to display
//      */
//     public interface PageViewFactory<T extends View & PageView> {
// 
//         /**
//          * @param context         android application context
//          * @param overlayCallback interface for communication with Phial
//          * @return view to display
//          */
//         T createPageView(Context context, OverlayCallback overlayCallback);
// 
//     }
// 
//     private final String id;
//     private final int iconResourceId;
//     private final CharSequence title;
//     private final PageViewFactory pageViewFactory;
//     private final Set<TargetScreen> targetScreens;
// 
//     /**
//      * @param id              unique pageId
//      * @param iconResourceId  page icon
//      * @param title           page title
//      * @param pageViewFactory factory that will create view when page is selected
//      */
//     public Page(
//             String id,
//             int iconResourceId,
//             CharSequence title,
//             PageViewFactory pageViewFactory
//     ) {
//         this(id, iconResourceId, title, pageViewFactory, Collections.<TargetScreen>emptySet());
//     }
// 
//     /**
//      * @param id              unique pageId
//      * @param iconResourceId  page icon
//      * @param title           page title
//      * @param pageViewFactory factory that will create view when page is selected
//      * @param targetScreens   screens to present this page on. Page will be present on all screens if this is empty.
//      */
//     public Page(
//             String id,
//             int iconResourceId,
//             CharSequence title,
//             PageViewFactory pageViewFactory,
//             Set<TargetScreen> targetScreens
//     ) {
//         this.id = id;
//         this.iconResourceId = iconResourceId;
//         this.title = title;
//         this.pageViewFactory = pageViewFactory;
//         this.targetScreens = Collections.unmodifiableSet(targetScreens);
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public int getIconResourceId() {
//         return iconResourceId;
//     }
// 
//     public CharSequence getTitle() {
//         return title;
//     }
// 
//     public PageViewFactory getPageViewFactory() {
//         return pageViewFactory;
//     }
// 
//     public Set<TargetScreen> getTargetScreens() {
//         return targetScreens;
//     }
// 
// }


// Path: phial-overlay/src/test/java/com/mindcoders/phial/internal/overlay/OverlayViewTest.java
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.WindowManager;
import com.mindcoders.phial.Page;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

        final ArgumentCaptor<View> viewArgumentCaptor = ArgumentCaptor.forClass(View.class);
        verify(windowManager).addView(viewArgumentCaptor.capture(), any());
        verify(dragHelper).animateFromDefaultPosition(eq(viewArgumentCaptor.getValue()), any());
        view.removeButton(activity);
        verify(windowManager).removeView(viewArgumentCaptor.getValue());
    }

    @Test
    public void show_and_remove_button_several_activities() {
        final ArgumentCaptor<View> viewArgumentCaptor = ArgumentCaptor.forClass(View.class);

        final WindowManager windowManager1 = mock(WindowManager.class);
        final Activity activity1 = mockActivity(windowManager1);
        final ArgumentCaptor<View> viewArgumentCaptor1 = ArgumentCaptor.forClass(View.class);

        view.showButton(activity, false);
        verify(windowManager).addView(viewArgumentCaptor.capture(), any());

        view.showButton(activity1, false);
        verify(windowManager1).addView(viewArgumentCaptor1.capture(), any());

        view.removeButton(activity);
        verify(windowManager).removeView(viewArgumentCaptor.getValue());

        view.removeButton(activity1);
        verify(windowManager1).removeView(viewArgumentCaptor1.getValue());
    }

    @Test
    public void showExpandedView() {
        final List<Page> pages = IntStream.range(0, 5).mapToObj(this::createPage).collect(Collectors.toList());