- Common ways to obtain AtmosError
private void myMethod () {AtmosError a =
String message;new AtmosError(code, message)
AtmosUtils utils;HttpCommand command;HttpResponse response;utils.parseAtmosErrorFromContent(command, response, new String(data))
ParseSax.Factory parseSaxFactory;Provider provider;InputStream from;parseSaxFactory.create(provider.get()).parse(from)
- Smart code suggestions by Codota
}
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosError getResult() { return new AtmosError(code, message); }
public AtmosError getResult() { return new AtmosError(code, message); }
@Test public void testGet500WithError1040() { AtmosUtils utils = createMock(AtmosUtils.class); BackoffLimitedRetryHandler backoffLimitedRetryHandler = createMock(BackoffLimitedRetryHandler.class); HttpCommand command = createMock(HttpCommand.class); String content = String.format(HTTP_MESSAGE_FORMAT, 1040, "The server is busy. Please try again"); HttpResponse response = HttpResponse.builder().statusCode(500).payload(content).build(); expect(command.getFailureCount()).andReturn(0).once(); expect(utils.parseAtmosErrorFromContent(command, response, content)).andReturn(new AtmosError(1040, "The server is busy. Please try again")).once(); expect(backoffLimitedRetryHandler.shouldRetryRequest(command, response)).andReturn(true).once(); replay(utils, backoffLimitedRetryHandler, command); AtmosServerErrorRetryHandler retry = new AtmosServerErrorRetryHandler(backoffLimitedRetryHandler, utils); assertTrue(retry.shouldRetryRequest(command, response)); verify(utils, backoffLimitedRetryHandler, command); } }