### Question:
TransitionManager { public static void go(@NonNull Scene scene) { changeScene(scene, sDefaultTransition); }  void setTransition(@NonNull Scene scene, @Nullable Transition transition); void setTransition(@NonNull Scene fromScene, @NonNull Scene toScene,
            @Nullable Transition transition); void transitionTo(@NonNull Scene scene); static void go(@NonNull Scene scene); static void go(@NonNull Scene scene, @Nullable Transition transition); static void beginDelayedTransition(@NonNull final ViewGroup sceneRoot); static void beginDelayedTransition(@NonNull final ViewGroup sceneRoot,
            @Nullable Transition transition); static void endTransitions(final ViewGroup sceneRoot);  }### Answer:
@Test @UiThreadTest public void testGo_enterAction() { CheckCalledRunnable runnable = new CheckCalledRunnable(); mScenes[0].setEnterAction(runnable); assertThat(runnable.wasCalled(), is(false)); TransitionManager.go(mScenes[0]); assertThat(runnable.wasCalled(), is(true)); }
@Test public void testGo_exitAction() throws Throwable { final CheckCalledRunnable enter = new CheckCalledRunnable(); final CheckCalledRunnable exit = new CheckCalledRunnable(); mScenes[0].setEnterAction(enter); mScenes[0].setExitAction(exit); rule.runOnUiThread(new Runnable() { @Override public void run() { assertThat(enter.wasCalled(), is(false)); assertThat(exit.wasCalled(), is(false)); TransitionManager.go(mScenes[0]); assertThat(enter.wasCalled(), is(true)); assertThat(exit.wasCalled(), is(false)); } }); rule.runOnUiThread(new Runnable() { @Override public void run() { TransitionManager.go(mScenes[1]); assertThat(exit.wasCalled(), is(true)); } }); }
@Test public void testGo_transitionListenerStart() throws Throwable { final SyncTransitionListener listener = new SyncTransitionListener(SyncTransitionListener.EVENT_START); rule.runOnUiThread(new Runnable() { @Override public void run() { Transition transition = new AutoTransition(); transition.setDuration(0); assertThat(transition.addListener(listener), is(sameInstance(transition))); TransitionManager.go(mScenes[0], transition); } }); assertThat("Timed out waiting for the TransitionListener", listener.await(), is(true)); }
@Test public void testGo_transitionListenerEnd() throws Throwable { final SyncTransitionListener listener = new SyncTransitionListener(SyncTransitionListener.EVENT_END); rule.runOnUiThread(new Runnable() { @Override public void run() { Transition transition = new AutoTransition(); transition.setDuration(0); assertThat(transition.addListener(listener), is(sameInstance(transition))); TransitionManager.go(mScenes[0], transition); } }); assertThat("Timed out waiting for the TransitionListener", listener.await(), is(true)); }
@Test public void testGo_nullParameter() throws Throwable { final ViewGroup root = rule.getActivity().getRoot(); rule.runOnUiThread(new Runnable() { @Override public void run() { TransitionManager.go(mScenes[0], null); assertThat(Scene.getCurrentScene(root), is(mScenes[0])); TransitionManager.go(mScenes[1], null); assertThat(Scene.getCurrentScene(root), is(mScenes[1])); } }); }