use of si.mazi.rescu.InvocationResult in project XChange by knowm.
the class PoloniexOrderTest method sellRejectTest.
@Test(expected = PoloniexException.class)
public void sellRejectTest() throws Exception {
InvocationResult invocationResult = new InvocationResult("{\"error\":\"Not enough LTC.\"}", 200);
Method apiMethod = PoloniexAuthenticated.class.getDeclaredMethod("sell", String.class, ParamsDigest.class, SynchronizedValueFactory.class, String.class, String.class, String.class, Integer.class, Integer.class, Integer.class);
RestMethodMetadata data = RestMethodMetadata.create(apiMethod, "", "");
try {
new JacksonResponseReader(new DefaultJacksonObjectMapperFactory().createObjectMapper(), false).read(invocationResult, data);
} catch (PoloniexException e) {
Assert.assertTrue(e.getMessage().startsWith("Not enough LTC."));
throw e;
}
}
use of si.mazi.rescu.InvocationResult in project XChange by knowm.
the class PoloniexOrderTest method moveOrderRejectTest.
@Test(expected = PoloniexException.class)
public void moveOrderRejectTest() throws Exception {
InvocationResult invocationResult = new InvocationResult("{\"success\":0,\"error\":\"Not enough LTC.\"}", 200);
Method apiMethod = PoloniexAuthenticated.class.getDeclaredMethod("moveOrder", String.class, ParamsDigest.class, SynchronizedValueFactory.class, String.class, String.class, String.class, Integer.class, Integer.class);
RestMethodMetadata data = RestMethodMetadata.create(apiMethod, "", "");
try {
new JacksonResponseReader(new DefaultJacksonObjectMapperFactory().createObjectMapper(), false).read(invocationResult, data);
} catch (PoloniexException e) {
Assert.assertTrue(e.getMessage().startsWith("Not enough LTC."));
throw e;
}
}
use of si.mazi.rescu.InvocationResult in project XChange by knowm.
the class PoloniexBalanceTest method balanceRejectTest.
@Test(expected = PoloniexException.class)
public void balanceRejectTest() throws Exception {
InvocationResult invocationResult = new InvocationResult("{\"error\":\"Invalid API key\\/secret pair.\"}", 200);
Method apiMethod = PoloniexAuthenticated.class.getDeclaredMethod("returnCompleteBalances", String.class, ParamsDigest.class, SynchronizedValueFactory.class, String.class);
RestMethodMetadata balances = RestMethodMetadata.create(apiMethod, "", "");
try {
new JacksonResponseReader(new DefaultJacksonObjectMapperFactory().createObjectMapper(), false).read(invocationResult, balances);
} catch (PoloniexException e) {
Assert.assertTrue(e.getMessage().startsWith("Invalid API key/secret pair."));
throw e;
}
}
use of si.mazi.rescu.InvocationResult in project XChange by knowm.
the class PoloniexOrderTest method buyRejectTest.
@Test(expected = PoloniexException.class)
public void buyRejectTest() throws Exception {
InvocationResult invocationResult = new InvocationResult("{\"error\":\"Not enough LTC.\"}", 200);
Method apiMethod = PoloniexAuthenticated.class.getDeclaredMethod("buy", String.class, ParamsDigest.class, SynchronizedValueFactory.class, String.class, String.class, String.class, Integer.class, Integer.class, Integer.class);
RestMethodMetadata data = RestMethodMetadata.create(apiMethod, "", "");
try {
new JacksonResponseReader(new DefaultJacksonObjectMapperFactory().createObjectMapper(), false).read(invocationResult, data);
} catch (PoloniexException e) {
Assert.assertTrue(e.getMessage().startsWith("Not enough LTC."));
throw e;
}
}
Aggregations