boolean checkWritePositionHeaderNumber() { if (wire == null || wire.headerNumber() == Long.MIN_VALUE) return true; try { long pos = position; long seq1 = queue.rollCycle().toSequenceNumber(wire.headerNumber() + 1) - 1; long seq2 = store.sequenceForPosition(this, pos, true); if (seq1 != seq2) { // System.out.println(queue.dump()); String message = "~~~~~~~~~~~~~~ " + "thread: " + Thread.currentThread().getName() + " pos: " + pos + " header: " + wire.headerNumber() + " seq1: " + seq1 + " seq2: " + seq2; //System.err.println(message); new AssertionError(message).printStackTrace(); throw new AssertionError(message); } } catch (Exception e) { Jvm.fatal().on(getClass(), e); throw Jvm.rethrow(e); } return true; }
@Test // SPR-14991 public void writeAndAutoFlushOnComplete() { Mono<String> result = this.webClient.get() .uri("/write-and-complete") .retrieve() .bodyToMono(String.class); try { StepVerifier.create(result) .consumeNextWith(value -> assertEquals(64 * 1024, value.length())) .expectComplete() .verify(Duration.ofSeconds(10L)); } catch (AssertionError err) { String os = System.getProperty("os.name").toLowerCase(); if (os.contains("windows") && err.getMessage() != null && err.getMessage().startsWith("VerifySubscriber timed out")) { // TODO: Reactor usually times out on Windows ... err.printStackTrace(); return; } throw err; } }
assertEquals(responseBody, LARGE_IMAGE_BYTES, "Image bytes weren't equal on subsequent test"); } catch (AssertionError e) { e.printStackTrace(); for (int i = 0; i < LARGE_IMAGE_BYTES.length; i++) { assertEquals(responseBody[i], LARGE_IMAGE_BYTES[i], "Invalid response byte at position " + i);
log.info("Ignored an assertion in QuantifiableEntityNormalizer: (result is that entities were not normalized)"); log.info("Tokens: " + StringUtils.joinWords(tokens, " ")); e.printStackTrace(System.err);
public static void handleAssertionError(AssertionError e) { System.err.println("Failed to send/receive message (Assertion): " + e.getMessage()); e.printStackTrace(); System.err.println("If you use an Oracle JRE please check if you have unlimited strength crypto enabled, see README"); }
StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw));
public void finalize() { if (called != null) { called.printStackTrace(System.err); called = null; } } public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
@Test public void testExpiry() throws InterruptedException { Expirable e = () -> expire(); monitor.addExpirable(EXPIRE_TIME, MILLISECONDS, e); new PollingProber(EXPIRE_TIMEOUT, 50).check(new JUnitLambdaProbe(() -> { assertThat(monitor.isRegistered(e), is(false)); assertThat(expired, is(true)); return true; }, ae -> { ae.printStackTrace(); return "" + currentTimeMillis() + " - " + monitor.toString(); })); }
@Test public void testNotExpiry() throws InterruptedException { Expirable e = () -> expire(); long startTime = currentTimeMillis(); monitor.addExpirable(EXPIRE_TIME, MILLISECONDS, e); monitor.run(); assertThat(expired, is(false)); new PollingProber(EXPIRE_TIMEOUT, 50).check(new JUnitLambdaProbe(() -> { assertThat(monitor.isRegistered(e), is(false)); assertThat(expired, is(true)); return true; }, ae -> { ae.printStackTrace(); return "" + currentTimeMillis() + " - " + monitor.toString(); })); assertThat(expiredTime - startTime, greaterThanOrEqualTo(EXPIRE_TIME - DELTA_TIME)); }
@Test public void testExpiryWithReset() throws InterruptedException { Expirable e = () -> expire(); monitor.addExpirable(EXPIRE_TIME, MILLISECONDS, e); monitor.run(); assertThat(expired, is(false)); long startTime = currentTimeMillis(); monitor.resetExpirable(e); monitor.run(); assertTrue(!expired); new PollingProber(EXPIRE_TIMEOUT, 50).check(new JUnitLambdaProbe(() -> { assertThat(monitor.isRegistered(e), is(false)); assertThat(expired, is(true)); return true; }, ae -> { ae.printStackTrace(); return "" + currentTimeMillis() + " - " + monitor.toString(); })); assertThat(expiredTime - startTime, greaterThanOrEqualTo(EXPIRE_TIME - DELTA_TIME)); }
private static void handleAssertionError(AssertionError e) { System.err.println("Failed to send/receive message (Assertion): " + e.getMessage()); e.printStackTrace(); System.err.println("If you use an Oracle JRE please check if you have unlimited strength crypto enabled, see README"); }
@Override public Image getIcon() { try { return CsmImageLoader.getImage(getDefinition(), preferredIcons); } catch (AssertionError ex) { ex.printStackTrace(System.err); } catch (Exception ex) { ex.printStackTrace(System.err); } return null; }
/** * Build the IR */ public void build() { try { solve(); if (localMap != null) { localMap.finishLocalMap(this); } } catch (AssertionError e) { System.err.println("When handling method " + method.getReference()); e.printStackTrace(); //throw e; } }
/** * Build the IR */ public void build() { try { solve(); if (localMap != null) { localMap.finishLocalMap(this); } } catch (AssertionError e) { System.err.println("When handling method " + method.getReference()); e.printStackTrace(); //throw e; } }
@Override public Image getIcon(int param) { try { CsmObject csmObj = getCsmObject(); if (csmObj != null) { return CsmImageLoader.getImage(csmObj); } } catch (AssertionError ex){ ex.printStackTrace(System.err); } catch (Exception ex) { ex.printStackTrace(System.err); } return ImageUtilities.loadImage(CsmImageLoader.DEFAULT); }
@Override public void onMessage(ClientMessage message) { try { onMessageAssert(message); } catch (AssertionError e) { e.printStackTrace(); // System.out -> junit reports errors.add(e); } }
@Override @Suspendable public void stop() { try { testContext(); } catch (AssertionError e) { e.printStackTrace(); fail("tests failed"); } }
@Override @Suspendable public void stop() { try { testContext(); } catch (AssertionError e) { e.printStackTrace(); fail("tests failed"); } }
@Test public void testPropertiesValidationOnCreate() throws Throwable { try { createProject(null); fail("Creation of project should have failed due to invalid name"); } catch (AssertionError e) { e.printStackTrace(); throw e; } catch (LocalizableValidationException e) { verifyExceptionMessage(String.format(AssertUtil.PROPERTY_CANNOT_BE_NULL_MESSAGE_FORMAT, ProjectState.FIELD_NAME_NAME), e.getMessage()); } }
@Test public void testExpiry() throws InterruptedException { Expirable e = () -> expire(); monitor.addExpirable(EXPIRE_TIME, MILLISECONDS, e); new PollingProber(EXPIRE_TIMEOUT, 50).check(new JUnitLambdaProbe(() -> { assertThat(monitor.isRegistered(e), is(false)); assertThat(expired, is(true)); return true; }, ae -> { ae.printStackTrace(); return "" + currentTimeMillis() + " - " + monitor.toString(); })); }