TriggerUtil { public static Trigger trigger(String type, String triggerId) { switch (type) { case "natural": return Trigger.natural(); case "adhoc": return Trigger.adhoc(triggerId); case "backfill": return Trigger.backfill(triggerId); case "unknown": return Trigger.unknown(triggerId); default: throw new IllegalArgumentException("Unknown trigger type: " + type); } } private  TriggerUtil(); static boolean isBackfill(Trigger trigger); static String triggerType(Trigger trigger); static String triggerId(Trigger trigger); static List<String> triggerTypesList(); static Trigger trigger(String type, String triggerId); static final String NATURAL_TRIGGER_ID; }
@Test public void testTrigger() { assertThat(trigger("natural", "natural-trigger"), is(Trigger.natural())); assertThat(trigger("adhoc", "foo"), is(Trigger.adhoc("foo"))); assertThat(trigger("backfill", "bar"), is(Trigger.backfill("bar"))); assertThat(trigger("unknown", "baz"), is(Trigger.unknown("baz"))); }