### Question:
CompilerEnvironment { public void registerTrigger(TriggerType triggerType) { if (triggerByRepresentation.containsKey(triggerType.getRepresentation())) { throw new IllegalArgumentException("The representation of the specified trigger type is already registered"); } if (triggerType.getOperator() != null && triggerByOperator.containsKey(triggerType.getOperator())) { throw new IllegalArgumentException("The operator of the specified trigger type is already registered"); } triggerByRepresentation.put(triggerType.getRepresentation(), triggerType); if (triggerType.getOperator() != null) { triggerByOperator.put(triggerType.getOperator(), triggerType); } }  void registerTrigger(TriggerType triggerType); TriggerType lookupTrigger(String representation); TriggerType lookupTrigger(Kind kind);  }### Answer:
@Test void testTriggerDuplicateRepresentation() { final var TRIGGER_TYPE1 = new BasicTrigger("test", Kind.TILDE); final var TRIGGER_TYPE2 = new BasicTrigger("test", Kind.AT); environment.registerTrigger(TRIGGER_TYPE1); assertThrows(IllegalArgumentException.class, () -> environment.registerTrigger(TRIGGER_TYPE2)); }
@Test void testTriggerDuplicateOpcode() { final var TRIGGER_TYPE1 = new BasicTrigger("test1", Kind.AT); final var TRIGGER_TYPE2 = new BasicTrigger("test2", Kind.AT); environment.registerTrigger(TRIGGER_TYPE1); assertThrows(IllegalArgumentException.class, () -> environment.registerTrigger(TRIGGER_TYPE2)); }