com.google.common.util.concurrent.AbstractFuture.toString()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(28)

本文整理了Java中com.google.common.util.concurrent.AbstractFuture.toString()方法的一些代码示例,展示了AbstractFuture.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractFuture.toString()方法的具体详情如下:
包路径:com.google.common.util.concurrent.AbstractFuture
类名称:AbstractFuture
方法名:toString

AbstractFuture.toString介绍

暂无

代码示例

代码示例来源:origin: google/guava

public void testToString_completed() throws Exception {
 AbstractFuture<Object> testFuture2 =
   new AbstractFuture<Object>() {
    @Override
    public String pendingToString() {
     return "cause=[Someday...]";
    }
   };
 AbstractFuture<Object> testFuture3 = new AbstractFuture<Object>() {};
 testFuture3.setFuture(testFuture2);
 assertThat(testFuture3.toString())
   .matches(
     "[^\\[]+\\[status=PENDING, info=\\[setFuture="
       + "\\[[^\\[]+\\[status=PENDING, info=\\[cause=\\[Someday...\\]\\]\\]\\]\\]\\]");
 testFuture2.set("result string");
 assertThat(testFuture3.toString())
   .matches("[^\\[]+\\[status=SUCCESS, result=\\[result string\\]\\]");
}

代码示例来源:origin: google/guava

String futureToString = toString();
final String unitString = unit.toString().toLowerCase(Locale.ROOT);
String message = "Waited " + timeout + " " + unit.toString().toLowerCase(Locale.ROOT);

代码示例来源:origin: google/j2objc

String futureToString = toString();

代码示例来源:origin: google/guava

public void testToString_notDone() throws Exception {
 AbstractFuture<Object> testFuture =
   new AbstractFuture<Object>() {
    @Override
    public String pendingToString() {
     return "cause=[Because this test isn't done]";
    }
   };
 assertThat(testFuture.toString())
   .matches(
     "[^\\[]+\\[status=PENDING, info=\\[cause=\\[Because this test isn't done\\]\\]\\]");
 try {
  testFuture.get(1, TimeUnit.NANOSECONDS);
  fail();
 } catch (TimeoutException e) {
  assertThat(e.getMessage()).contains("1 nanoseconds");
  assertThat(e.getMessage()).contains("Because this test isn't done");
 }
}

代码示例来源:origin: wildfly/wildfly

String futureToString = toString();

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

String futureToString = toString();

代码示例来源:origin: org.jboss.eap/wildfly-client-all

String futureToString = toString();

代码示例来源:origin: com.google.guava/guava-tests

public void testToString_completed() throws Exception {
 AbstractFuture<Object> testFuture2 =
   new AbstractFuture<Object>() {
    @Override
    public String pendingToString() {
     return "cause=[Someday...]";
    }
   };
 AbstractFuture<Object> testFuture3 = new AbstractFuture<Object>() {};
 testFuture3.setFuture(testFuture2);
 assertThat(testFuture3.toString())
   .matches(
     "[^\\[]+\\[status=PENDING, info=\\[setFuture="
       + "\\[[^\\[]+\\[status=PENDING, info=\\[cause=\\[Someday...\\]\\]\\]\\]\\]\\]");
 testFuture2.set("result string");
 assertThat(testFuture3.toString())
   .matches("[^\\[]+\\[status=SUCCESS, result=\\[result string\\]\\]");
}

代码示例来源:origin: com.google.guava/guava-tests

public void testToString_notDone() throws Exception {
 AbstractFuture<Object> testFuture =
   new AbstractFuture<Object>() {
    @Override
    public String pendingToString() {
     return "cause=[Because this test isn't done]";
    }
   };
 assertThat(testFuture.toString())
   .matches(
     "[^\\[]+\\[status=PENDING, info=\\[cause=\\[Because this test isn't done\\]\\]\\]");
 try {
  testFuture.get(1, TimeUnit.NANOSECONDS);
  fail();
 } catch (TimeoutException e) {
  assertThat(e.getMessage()).contains("1 nanoseconds");
  assertThat(e.getMessage()).contains("Because this test isn't done");
 }
}

相关文章