SequenceItem implements MaterialTapTargetPrompt.PromptStateChangeListener { public void dismiss() { final MaterialTapTargetPrompt prompt = this.sequenceState.getPrompt(); if (prompt != null) { prompt.dismiss(); } } SequenceItem(@NonNull final SequenceState state); void addStateChanger(final int state); void removeStateChanger(final int state); void clearStateChangers(); void setSequenceListener(@Nullable final MaterialTapTargetSequence.SequenceCompleteListener listener); @NonNull SequenceState getState(); void show(); void finish(); void dismiss(); @Override void onPromptStateChanged(@NonNull final MaterialTapTargetPrompt prompt, final int state);  }
@Test public void testDismiss() { expectedStateProgress = 1; final MaterialTapTargetPrompt prompt = UnitTestUtils.createPromptOptions() .setTarget(32, 43) .setPrimaryText("Test") .create(); assertNotNull(prompt); final SequenceState state = new SequenceState(prompt); final SequenceItem sequenceItem = new SequenceItem(state); sequenceItem.addStateChanger(MaterialTapTargetPrompt.STATE_DISMISSED); sequenceItem.setSequenceListener(new MaterialTapTargetSequence.SequenceCompleteListener() { @Override public void onSequenceComplete() { actualStateProgress++; } }); UnitTestUtils.initSequenceItem(prompt, sequenceItem); sequenceItem.show(); assertEquals(MaterialTapTargetPrompt.STATE_REVEALED, prompt.getState()); prompt.dismiss(); UnitTestUtils.endCurrentAnimation(prompt); }
@Test public void testNullPromptDismiss() { final SequenceState state = new SequenceState(null); final SequenceItem sequenceItem = new SequenceItem(state); sequenceItem.dismiss(); }