本文整理了Java中java.lang.AssertionError.printStackTrace()
方法的一些代码示例,展示了AssertionError.printStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AssertionError.printStackTrace()
方法的具体详情如下:
包路径:java.lang.AssertionError
类名称:AssertionError
方法名:printStackTrace
暂无
代码示例来源:origin: OpenHFT/Chronicle-Queue
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;
}
代码示例来源:origin: spring-projects/spring-framework
@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;
}
}
代码示例来源:origin: AsyncHttpClient/async-http-client
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);
代码示例来源:origin: stanfordnlp/CoreNLP
log.info("Ignored an assertion in QuantifiableEntityNormalizer: (result is that entities were not normalized)");
log.info("Tokens: " + StringUtils.joinWords(tokens, " "));
e.printStackTrace(System.err);
代码示例来源:origin: AsamK/signal-cli
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");
}
代码示例来源:origin: apache/ignite
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
代码示例来源:origin: junit-team/junit.contrib
public void finalize() {
if (called != null) {
called.printStackTrace(System.err);
called = null;
}
}
public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
代码示例来源:origin: mulesoft/mule
@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();
}));
}
代码示例来源:origin: mulesoft/mule
@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));
}
代码示例来源:origin: mulesoft/mule
@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));
}
代码示例来源:origin: CoinbaseWallet/toshi-headless-client
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");
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-navigation
@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;
}
代码示例来源:origin: wala/WALA
/**
* 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;
}
}
代码示例来源:origin: com.ibm.wala/com.ibm.wala.dalvik
/**
* 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;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelutil
@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);
}
代码示例来源:origin: apache/activemq-artemis
@Override
public void onMessage(ClientMessage message) {
try {
onMessageAssert(message);
} catch (AssertionError e) {
e.printStackTrace(); // System.out -> junit reports
errors.add(e);
}
}
代码示例来源:origin: io.vertx/vertx-sync
@Override
@Suspendable
public void stop() {
try {
testContext();
} catch (AssertionError e) {
e.printStackTrace();
fail("tests failed");
}
}
代码示例来源:origin: vert-x3/vertx-sync
@Override
@Suspendable
public void stop() {
try {
testContext();
} catch (AssertionError e) {
e.printStackTrace();
fail("tests failed");
}
}
代码示例来源:origin: vmware/admiral
@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());
}
}
代码示例来源:origin: org.mule.runtime/mule-core-tests
@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();
}));
}
内容来源于网络,如有侵权,请联系作者删除!