private void checkValue(Value expected, Value value) throws ShapeShiftException { if (!expected.equals(value)) { String errorMsg = String.format("Value mismatch, expected %s but got %s.", expected, value); throw new ShapeShiftException(errorMsg); } }
@Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: Value newFee = feeAmount.getAmount(); if (newFee != null && !newFee.equals(fee)) { configuration.setFeeValue(newFee); } break; case DialogInterface.BUTTON_NEUTRAL: configuration.resetFeeValue(type); break; } } };
@Test public void testEquals() { Value btcSatoshi = Value.valueOf(BitcoinMain.get(), 1); Value btcSatoshi2 = Value.valueOf(BitcoinMain.get(), 1); Value btcValue = Value.parse(BitcoinMain.get(), "3.14159"); Value ltcSatoshi = Value.valueOf(LitecoinMain.get(), 1); Value ppcValue = Value.parse(PeercoinMain.get(), "3.14159"); assertTrue(btcSatoshi.equals(btcSatoshi2)); assertFalse(btcSatoshi.equals(ltcSatoshi)); assertFalse(btcSatoshi.equals(btcValue)); assertFalse(btcSatoshi.equals(ppcValue)); assertFalse(btcValue.equals(ppcValue)); }