OnlineUtils { public static UnitEnum getUnit(LimitViolationType type) { Objects.requireNonNull(type); switch (type) { case CURRENT: return UnitEnum.MW; case LOW_VOLTAGE: case HIGH_VOLTAGE: return UnitEnum.KV; default: throw new IllegalArgumentException(); } } private  OnlineUtils(); static Collection<Contingency> filterContingencies(List<Contingency> contingencies, List<String> contingenciesIds); static Set<String> getContingencyIds(List<Contingency> contingencies); static boolean isSafe(Collection<SecurityIndex> securityIndexes); static String getPostContingencyId(String stateId, String contingencyId); static UnitEnum getUnit(LimitViolationType type); static DateTime toCetDate(DateTime date); static LinkedHashMap<String, Double> getBranchesData(Network network);  }
@Test public void getUnitEnumTest() { assertEquals(UnitEnum.MW, OnlineUtils.getUnit(LimitViolationType.CURRENT)); assertEquals(UnitEnum.KV, OnlineUtils.getUnit(LimitViolationType.LOW_VOLTAGE)); assertEquals(UnitEnum.KV, OnlineUtils.getUnit(LimitViolationType.HIGH_VOLTAGE)); }