### Question:
MoneyWriteConverter implements Converter<BigMoney, DBObject> { @Override public DBObject convert(BigMoney source) { if (source == null) { return null; } BasicDBObject result = new BasicDBObject(); final long moneyLong = MoneyUtils.convertToLong(source); result.put("amount", moneyLong); result.put("currency", source.getCurrencyUnit().getCurrencyCode()); return result; }  @Override DBObject convert(BigMoney source);  }### Answer:
@Test public void testConvert() throws Exception { final MoneyWriteConverter converter = new MoneyWriteConverter(); final DBObject btc = converter.convert(BigMoney.of(CurrencyUnit.of(Currencies.BTC), 100)); assertThat((Long) btc.get("amount"), equalTo(100 * 100000000L)); assertThat((String) btc.get("currency"), equalTo(Currencies.BTC)); }
@Test public void testConvertCNY() throws Exception { final MoneyWriteConverter converter = new MoneyWriteConverter(); final DBObject btc = converter.convert(BigMoney.of(CurrencyUnit.of(Currencies.CNY), 100)); assertThat((Long) btc.get("amount"), equalTo(1000 * 100l)); assertThat((String) btc.get("currency"), equalTo(Currencies.CNY)); }