Package com.opengamma.engine.fudgemsg

Source Code of com.opengamma.engine.fudgemsg.ComputationTargetTypeFudgeBuilderTest$Foo

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

import org.testng.annotations.Test;

import com.opengamma.engine.target.ComputationTargetType;
import com.opengamma.id.UniqueId;
import com.opengamma.id.UniqueIdentifiable;
import com.opengamma.util.test.AbstractFudgeBuilderTestCase;
import com.opengamma.util.test.TestGroup;

/**
* Tests the {@link ComputationTargetTypeFudgeBuilder} class.
*/
@Test(groups = TestGroup.UNIT)
public class ComputationTargetTypeFudgeBuilderTest extends AbstractFudgeBuilderTestCase {

  private static final class Foo implements UniqueIdentifiable {

    @Override
    public UniqueId getUniqueId() {
      return null;
    }

  }

  public void testNull() {
    assertEncodeDecodeCycle(ComputationTargetType.class, ComputationTargetType.NULL);
  }

  public void testCombinations() {
    final ComputationTargetType[] types = new ComputationTargetType[99];
    int i = 0, j = 0;
    types[i++] = ComputationTargetType.PRIMITIVE;
    types[i++] = ComputationTargetType.POSITION;
    types[i++] = ComputationTargetType.of(Foo.class);
    while (i < types.length) {
      final ComputationTargetType type = types[j++];
      types[i++] = type.containing(ComputationTargetType.PRIMITIVE);
      types[i++] = ComputationTargetType.PORTFOLIO_NODE.containing(type);
      types[i++] = type.or(types[j]);
    }
    for (ComputationTargetType type : types) {
      assertEncodeDecodeCycle(ComputationTargetType.class, type);
    }
  }

}
TOP

Related Classes of com.opengamma.engine.fudgemsg.ComputationTargetTypeFudgeBuilderTest$Foo

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.