@Test(expected = AssertionError.class) public void testTranslate() throws Exception { new MeasurandTranslator("Not.A.Measurand").translate(); }
@Override public Measurand translate() { if (this.measurand == null || this.measurand.isEmpty()) { return Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; } Measurand result; switch (this.measurand) { case "Energy.Active.Export.Register": result = Measurand.EXPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Import.Register": result = Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Export.Register": result = Measurand.EXPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Import.Register": result = Measurand.IMPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Export.Interval": result = Measurand.EXPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Active.Import.Interval": result = Measurand.IMPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Export.Interval": result = Measurand.EXPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Import.Interval": result = Measurand.IMPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Power.Active.Export": result = Measurand.EXPORTED_ACTIVE_POWER; break; case "Power.Active.Import": result = Measurand.IMPORTED_ACTIVE_POWER; break; case "Power.Reactive.Export": result = Measurand.EXPORTED_REACTIVE_POWER; break; case "Power.Reactive.Import": result = Measurand.IMPORTED_REACTIVE_POWER; break; case "Current.Export": result = Measurand.EXPORTED_CURRENT; break; case "Current.Import": result = Measurand.IMPORTED_CURRENT; break; case "Voltage": result = Measurand.VOLTAGE; break; case "Temperature": result = Measurand.TEMPERATURE; break; default: throw new AssertionError(String.format("Unknown value for Measurand: '%s'", this.measurand)); } return result; }
MeasurandTranslator implements Translator<Measurand> { @Override public Measurand translate() { if (this.measurand == null || this.measurand.isEmpty()) { return Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; } Measurand result; switch (this.measurand) { case "Energy.Active.Export.Register": result = Measurand.EXPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Import.Register": result = Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Export.Register": result = Measurand.EXPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Import.Register": result = Measurand.IMPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Export.Interval": result = Measurand.EXPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Active.Import.Interval": result = Measurand.IMPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Export.Interval": result = Measurand.EXPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Import.Interval": result = Measurand.IMPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Power.Active.Export": result = Measurand.EXPORTED_ACTIVE_POWER; break; case "Power.Active.Import": result = Measurand.IMPORTED_ACTIVE_POWER; break; case "Power.Reactive.Export": result = Measurand.EXPORTED_REACTIVE_POWER; break; case "Power.Reactive.Import": result = Measurand.IMPORTED_REACTIVE_POWER; break; case "Current.Export": result = Measurand.EXPORTED_CURRENT; break; case "Current.Import": result = Measurand.IMPORTED_CURRENT; break; case "Voltage": result = Measurand.VOLTAGE; break; case "Temperature": result = Measurand.TEMPERATURE; break; default: throw new AssertionError(String.format("Unknown value for Measurand: '%s'", this.measurand)); } return result; } }
MeasurandTranslator implements Translator<Measurand> { @Override public Measurand translate() { if (this.measurand == null || this.measurand.isEmpty()) { return Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; } Measurand result; switch (this.measurand) { case "Energy.Active.Export.Register": result = Measurand.EXPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Import.Register": result = Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Export.Register": result = Measurand.EXPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Import.Register": result = Measurand.IMPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Export.Interval": result = Measurand.EXPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Active.Import.Interval": result = Measurand.IMPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Export.Interval": result = Measurand.EXPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Import.Interval": result = Measurand.IMPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Power.Active.Export": result = Measurand.EXPORTED_ACTIVE_POWER; break; case "Power.Active.Import": result = Measurand.IMPORTED_ACTIVE_POWER; break; case "Power.Reactive.Export": result = Measurand.EXPORTED_REACTIVE_POWER; break; case "Power.Reactive.Import": result = Measurand.IMPORTED_REACTIVE_POWER; break; case "Current.Export": result = Measurand.EXPORTED_CURRENT; break; case "Current.Import": result = Measurand.IMPORTED_CURRENT; break; case "Voltage": result = Measurand.VOLTAGE; break; case "Temperature": result = Measurand.TEMPERATURE; break; default: throw new AssertionError(String.format("Unknown value for Measurand: '%s'", this.measurand)); } return result; } MeasurandTranslator(String measurand); }
MeasurandTranslator implements Translator<Measurand> { @Override public Measurand translate() { if (this.measurand == null || this.measurand.isEmpty()) { return Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; } Measurand result; switch (this.measurand) { case "Energy.Active.Export.Register": result = Measurand.EXPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Import.Register": result = Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Export.Register": result = Measurand.EXPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Import.Register": result = Measurand.IMPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Export.Interval": result = Measurand.EXPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Active.Import.Interval": result = Measurand.IMPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Export.Interval": result = Measurand.EXPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Import.Interval": result = Measurand.IMPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Power.Active.Export": result = Measurand.EXPORTED_ACTIVE_POWER; break; case "Power.Active.Import": result = Measurand.IMPORTED_ACTIVE_POWER; break; case "Power.Reactive.Export": result = Measurand.EXPORTED_REACTIVE_POWER; break; case "Power.Reactive.Import": result = Measurand.IMPORTED_REACTIVE_POWER; break; case "Current.Export": result = Measurand.EXPORTED_CURRENT; break; case "Current.Import": result = Measurand.IMPORTED_CURRENT; break; case "Voltage": result = Measurand.VOLTAGE; break; case "Temperature": result = Measurand.TEMPERATURE; break; default: throw new AssertionError(String.format("Unknown value for Measurand: '%s'", this.measurand)); } return result; } MeasurandTranslator(String measurand); @Override Measurand translate(); }
MeasurandTranslator implements Translator<Measurand> { @Override public Measurand translate() { if (this.measurand == null || this.measurand.isEmpty()) { return Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; } Measurand result; switch (this.measurand) { case "Energy.Active.Export.Register": result = Measurand.EXPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Import.Register": result = Measurand.IMPORTED_ACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Export.Register": result = Measurand.EXPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Reactive.Import.Register": result = Measurand.IMPORTED_REACTIVE_ENERGY_REGISTER; break; case "Energy.Active.Export.Interval": result = Measurand.EXPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Active.Import.Interval": result = Measurand.IMPORTED_ACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Export.Interval": result = Measurand.EXPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Energy.Reactive.Import.Interval": result = Measurand.IMPORTED_REACTIVE_ENERGY_INTERVAL; break; case "Power.Active.Export": result = Measurand.EXPORTED_ACTIVE_POWER; break; case "Power.Active.Import": result = Measurand.IMPORTED_ACTIVE_POWER; break; case "Power.Reactive.Export": result = Measurand.EXPORTED_REACTIVE_POWER; break; case "Power.Reactive.Import": result = Measurand.IMPORTED_REACTIVE_POWER; break; case "Current.Export": result = Measurand.EXPORTED_CURRENT; break; case "Current.Import": result = Measurand.IMPORTED_CURRENT; break; case "Voltage": result = Measurand.VOLTAGE; break; case "Temperature": result = Measurand.TEMPERATURE; break; default: throw new AssertionError(String.format("Unknown value for Measurand: '%s'", this.measurand)); } return result; } MeasurandTranslator(String measurand); @Override Measurand translate();  }