@Test
  public void testWriteToBundle_triggers() {
    // immediate
    Bundle b =
        writer.writeToBundle(
            initializeDefaultBuilder().setTrigger(Trigger.NOW).build(), new Bundle());

    assertEquals("window_start", 0, b.getLong("window_start"));
    assertEquals("window_end", 1, b.getLong("window_end"));

    // execution window (oneoff)
    JobTrigger.ExecutionWindowTrigger t = Trigger.executionWindow(631, 978);
    b = writer.writeToBundle(initializeDefaultBuilder().setTrigger(t).build(), new Bundle());

    assertEquals("window_start", t.getWindowStart(), b.getLong("window_start"));
    assertEquals("window_end", t.getWindowEnd(), b.getLong("window_end"));

    // execution window (periodic)
    b =
        writer.writeToBundle(
            initializeDefaultBuilder().setRecurring(true).setTrigger(t).build(), new Bundle());

    assertEquals("period", t.getWindowEnd(), b.getLong("period"));
    assertEquals("period_flex", t.getWindowEnd() - t.getWindowStart(), b.getLong("period_flex"));
  }
Tests for the {@link GooglePlayJobWriter} class.
jobdispatcher/src/test/java/com/firebase/jobdispatcher/GooglePlayJobWriterTest.java