/**
* Writes a {@link CurrencyPair} to a Fudge message and reads it back.
*/
@Test
public void roundTrip() {
FudgeContext context = OpenGammaFudgeContext.getInstance();
CurrencyPair eurUsd = CurrencyPair.parse("EUR/USD");
MutableFudgeMsg msg = context.newMessage();
msg.add(CURRENCY_PAIR, eurUsd);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FudgeMsgWriter writer = context.createMessageWriter(baos);
writer.writeMessage(msg);
writer.close();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
FudgeMsgReader reader = context.createMessageReader(bais);
FudgeMsg rebuiltMsg = reader.nextMessage();
AssertJUnit.assertNotNull(rebuiltMsg);
FudgeField currencyPairField = rebuiltMsg.getByName(CURRENCY_PAIR);
AssertJUnit.assertNotNull(currencyPairField);
AssertJUnit.assertEquals(String.class, currencyPairField.getType().getJavaType());