SequenceItemShowFor extends SequenceItem { @Override protected void show(@NonNull final MaterialTapTargetPrompt prompt) { prompt.showFor(milliseconds); } SequenceItemShowFor(@NonNull final SequenceState state, final long milliseconds);   }
@Test public void testShowFor() { expectedStateProgress = 5; final PromptOptions promptOptions = UnitTestUtils.createPromptOptions() .setTarget(10, 10) .setPrimaryText("Primary text") .setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() { @Override public void onPromptStateChanged(@NonNull final MaterialTapTargetPrompt prompt, final int state) { if (actualStateProgress == 0) { assertEquals(MaterialTapTargetPrompt.STATE_REVEALING, state); assertEquals(MaterialTapTargetPrompt.STATE_REVEALING, prompt.getState()); } else if (actualStateProgress == 1) { assertEquals(MaterialTapTargetPrompt.STATE_REVEALED, state); assertEquals(MaterialTapTargetPrompt.STATE_REVEALED, prompt.getState()); UnitTestUtils.runPromptTimeOut(prompt); } else if (actualStateProgress == 2) { assertEquals(MaterialTapTargetPrompt.STATE_SHOW_FOR_TIMEOUT, state); assertEquals(MaterialTapTargetPrompt.STATE_SHOW_FOR_TIMEOUT, prompt.getState()); } else if (actualStateProgress == 3) { assertEquals(MaterialTapTargetPrompt.STATE_DISMISSING, state); assertEquals(MaterialTapTargetPrompt.STATE_DISMISSING, prompt.getState()); UnitTestUtils.endCurrentAnimation(prompt); } else if (actualStateProgress == 4) { assertEquals(MaterialTapTargetPrompt.STATE_DISMISSED, state); assertEquals(MaterialTapTargetPrompt.STATE_DISMISSED, prompt.getState()); } else { fail(String.format("Incorrect state progress %s for state %s", actualStateProgress, state)); } actualStateProgress++; } }); final SequenceItem sequenceItem = new SequenceItemShowFor(new SequenceStatePromptOptions(promptOptions), 1000); sequenceItem.show(); }