use of java.util.concurrent.atomic.AtomicIntegerArray in project assertj-core by joel-costigliola.
the class AtomicIntegerArrayAssert_hasArray_Test method should_honor_the_given_element_comparator.
@Test
void should_honor_the_given_element_comparator() {
AtomicIntegerArray actual = new AtomicIntegerArray(new int[] { 1, 2, 3 });
assertThat(actual).usingElementComparator(new AbsValueComparator<Integer>()).hasArray(new int[] { -1, 2, 3 });
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method readTimeoutDoesntRetry.
@Test
public void readTimeoutDoesntRetry() throws Exception {
// set(client + ".niws.client.ReadTimeout", "100");
set(client + ".niws.client.RetryReadTimeouts", "false");
int code = 200;
statusCode.set(code);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, 1);
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<Throwable> throwable = new AtomicReference<>();
rxHttp.get(uri("/readTimeout")).subscribe(Actions.empty(), t -> {
throwable.set(t);
latch.countDown();
}, latch::countDown);
latch.await();
Assert.assertTrue(throwable.get() instanceof ReadTimeoutException);
assertEquals(expected, statusCounts);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method simplePost.
@Test
public void simplePost() throws Exception {
int code = 200;
statusCode.set(code);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, 1);
final StringBuilder builder = new StringBuilder();
rxHttp.post(uri("/echo"), "text/plain", "foo bar".getBytes()).flatMap(res -> {
Assert.assertEquals(200, res.getStatus().code());
return res.getContent();
}).toBlocking().forEach(byteBuf -> builder.append(byteBuf.toString(Charset.defaultCharset())));
Assert.assertEquals("foo bar", builder.toString());
assertEquals(expected, statusCounts);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method absoluteRedirect.
@Test
public void absoluteRedirect() throws Exception {
set(client + ".niws.client.FollowRedirects", "3");
int code = 200;
statusCode.set(code);
redirects.set(2);
AtomicIntegerArray expected = copy(statusCounts);
expected.incrementAndGet(code);
expected.addAndGet(302, 3);
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<Throwable> throwable = new AtomicReference<>();
rxHttp.get(uri("/absoluteRedirect")).subscribe(Actions.empty(), t -> {
throwable.set(t);
latch.countDown();
}, latch::countDown);
latch.await();
Assert.assertNull(throwable.get());
assertEquals(expected, statusCounts);
}
use of java.util.concurrent.atomic.AtomicIntegerArray in project iep by Netflix.
the class RxHttpTest method putJsonString.
@Test
public void putJsonString() throws Exception {
int code = 200;
statusCode.set(code);
AtomicIntegerArray expected = copy(statusCounts);
expected.addAndGet(code, 1);
rxHttp.putJson(uri("/empty"), "{}").toBlocking().toFuture().get();
assertEquals(expected, statusCounts);
}
Aggregations