### Question:
EventConverter { public static String getMethodName(String methodInfo, boolean isConfirm) { String[] methods = methodInfo.split(","); if (methods.length == 2 && methods[0].startsWith("confirm=") && methods[1].startsWith("cancel=")) { String confirmMethod = methods[0].substring(8); String cancelMethod = methods[1].substring(7); if (isConfirm) return confirmMethod; else return cancelMethod; } else { throw new IllegalArgumentException("MethodInfo: " + methodInfo + ", has some bad formats."); } }  static ParticipatedEvent convertToParticipatedEvent(GrpcParticipationStartedEvent request); static ParticipatedEvent convertToParticipatedEvent(GrpcParticipationEndedEvent request); static GlobalTxEvent convertToGlobalTxEvent(GrpcTccTransactionStartedEvent request); static GlobalTxEvent convertToGlobalTxEvent(GrpcTccTransactionEndedEvent request); static TccTxEvent convertToTccTxEvent(GrpcTccTransactionStartedEvent event); static TccTxEvent convertToTccTxEvent(GrpcTccTransactionEndedEvent event); static TccTxEvent convertToTccTxEvent(GrpcParticipationStartedEvent event); static TccTxEvent convertToTccTxEvent(GrpcParticipationEndedEvent event); static TccTxEvent convertToTccTxEvent(GrpcTccCoordinatedEvent event); static TccTxEvent convertToTccTxEvent(GlobalTxEvent event); static TccTxEvent convertToTccTxEvent(ParticipatedEvent event); static ParticipatedEvent convertToParticipatedEvent(TccTxEvent event); static String toMethodInfo(String confirmMethod, String cancelMethod); static String getMethodName(String methodInfo, boolean isConfirm);  }### Answer:
@Test public void getMethodName() { assertThat(EventConverter.getMethodName("confirm=text1,cancel=text2",true), is("text1")); assertThat(EventConverter.getMethodName("confirm=text1,cancel=text2",false), is("text2")); }