Package com.opengamma.livedata.normalization

Source Code of com.opengamma.livedata.normalization.UnitChangeTest

/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.livedata.normalization;

import static org.testng.AssertJUnit.assertEquals;

import org.fudgemsg.MutableFudgeMsg;
import org.testng.annotations.Test;

import com.opengamma.livedata.server.FieldHistoryStore;
import com.opengamma.util.fudgemsg.OpenGammaFudgeContext;
import com.opengamma.util.test.TestGroup;

/**
* Test.
*/
@Test(groups = TestGroup.UNIT)
public class UnitChangeTest {

  @Test
  public void unitChange() {
    UnitChange unitChange = new UnitChange("Foo", 10);
   
    MutableFudgeMsg msg = OpenGammaFudgeContext.getInstance().newMessage();
    msg.add("Foo", 2.0);
    msg.add("Bar", "2");
   
    MutableFudgeMsg normalized = unitChange.apply(msg, "123", new FieldHistoryStore());
    assertEquals(2, normalized.getAllFields().size());
    assertEquals(20.0, normalized.getDouble("Foo"), 0.0001);
  }

}
TOP

Related Classes of com.opengamma.livedata.normalization.UnitChangeTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.