FieldNameChange implements NormalizationRule { public FieldNameChange(String from, String to) { ArgumentChecker.notNull(from, "From"); ArgumentChecker.notNull(to, "To"); _from = from; _to = to; } FieldNameChange(String from, String to); @Override MutableFudgeMsg apply(MutableFudgeMsg msg, String securityUniqueId, FieldHistoryStore fieldHistory);  }
@Test public void fieldNameChange() { FieldNameChange nameChange = new FieldNameChange("Foo", "Bar"); MutableFudgeMsg msg = OpenGammaFudgeContext.getInstance().newMessage(); msg.add("Foo", "1"); msg.add("Bar", 2.0); msg.add("Baz", 500); MutableFudgeMsg normalized = nameChange.apply(msg, "123", new FieldHistoryStore()); assertEquals(3, normalized.getAllFields().size()); assertNull(normalized.getByName("Foo")); assertEquals(2.0, (Double) normalized.getAllByName("Bar").get(0).getValue(), 0.0001); assertEquals("1", (String) normalized.getAllByName("Bar").get(1).getValue()); assertEquals(500, normalized.getInt("Baz").intValue()); }