本文整理汇总了Java中com.google.inject.throwingproviders.CheckedProvider类的典型用法代码示例。如果您正苦于以下问题:Java CheckedProvider类的具体用法?Java CheckedProvider怎么用?Java CheckedProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CheckedProvider类属于com.google.inject.throwingproviders包,在下文中一共展示了CheckedProvider类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: thrownException_threwUnexpected_expectFailure
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
@Test
public void thrownException_threwUnexpected_expectFailure() {
Class<? extends Throwable> expected = SummerException.class;
Class<? extends Throwable> unexpected = UnsupportedOperationException.class;
CheckedProvider<String> provider =
CheckedProviders.throwing(StringCheckedProvider.class, unexpected);
String message =
String.format(
"exception thrown by <%s>: Not true that <%s> is an instance of <%s>. "
+ "It is an instance of <%s>",
getThrowingProviderName(UnsupportedOperationException.class.getName()),
UnsupportedOperationException.class.getName(),
SummerException.class.getName(),
UnsupportedOperationException.class.getName());
expectWhenTesting().that(provider).thrownException().isInstanceOf(expected);
assertThat(expect.getFailure()).hasMessageThat().isEqualTo(message);
}
开发者ID:google,项目名称:guice,代码行数:19,代码来源:CheckedProviderSubjectTest.java
示例2: providedValue_gotExpected_expectSuccess
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
@Test
public void providedValue_gotExpected_expectSuccess() {
String expected = "keep Summer safe";
CheckedProvider<String> provider = CheckedProviders.of(StringCheckedProvider.class, expected);
assertThat(provider).providedValue().isEqualTo(expected);
}
开发者ID:google,项目名称:guice,代码行数:8,代码来源:CheckedProviderSubjectTest.java
示例3: providedValue_gotUnexpected_expectFailure
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
@Test
public void providedValue_gotUnexpected_expectFailure() {
String expected = "keep Summer safe";
String unexpected = "Summer is unsafe";
CheckedProvider<String> provider = CheckedProviders.of(StringCheckedProvider.class, unexpected);
String message =
String.format(
"value provided by <%s>: Not true that <%s> is equal to <%s>",
getReturningProviderName(unexpected), unexpected, expected);
expectWhenTesting().that(provider).providedValue().isEqualTo(expected);
assertThat(expect.getFailure()).hasMessageThat().isEqualTo(message);
}
开发者ID:google,项目名称:guice,代码行数:14,代码来源:CheckedProviderSubjectTest.java
示例4: providedValue_throws_expectFailure
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
@Test
public void providedValue_throws_expectFailure() {
CheckedProvider<String> provider =
CheckedProviders.throwing(StringCheckedProvider.class, SummerException.class);
String message =
String.format(
"checked provider <%s> threw an exception",
getThrowingProviderName(SummerException.class.getName()));
expectWhenTesting().that(provider).providedValue();
AssertionError expected = expect.getFailure();
assertThat(expected).hasCauseThat().isInstanceOf(SummerException.class);
assertThat(expected).hasMessageThat().isEqualTo(message);
}
开发者ID:google,项目名称:guice,代码行数:15,代码来源:CheckedProviderSubjectTest.java
示例5: thrownException_threwExpected_expectSuccess
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
@Test
public void thrownException_threwExpected_expectSuccess() {
CheckedProvider<?> provider =
CheckedProviders.throwing(StringCheckedProvider.class, SummerException.class);
assertThat(provider).thrownException().isInstanceOf(SummerException.class);
}
开发者ID:google,项目名称:guice,代码行数:8,代码来源:CheckedProviderSubjectTest.java
示例6: thrownException_gets_expectFailure
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
@Test
public void thrownException_gets_expectFailure() {
String getValue = "keep WINTER IS COMING safe";
CheckedProvider<String> provider = CheckedProviders.of(StringCheckedProvider.class, getValue);
String message =
String.format(
"Not true that <%s> threw <an exception>. It provided <%s>",
getReturningProviderName(getValue), getValue);
expectWhenTesting().that(provider).thrownException();
assertThat(expect.getFailure()).hasMessageThat().isEqualTo(message);
}
开发者ID:google,项目名称:guice,代码行数:13,代码来源:CheckedProviderSubjectTest.java
示例7: expectWhenTesting
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
private SimpleSubjectBuilder<
CheckedProviderSubject<String, CheckedProvider<String>>, CheckedProvider<String>>
expectWhenTesting() {
return expect
.whenTesting()
.about(CheckedProviderSubject.<String, CheckedProvider<String>>checkedProviders());
}
开发者ID:google,项目名称:guice,代码行数:8,代码来源:CheckedProviderSubjectTest.java
示例8: checkedProviders
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
public static <T, P extends CheckedProvider<T>>
Subject.Factory<CheckedProviderSubject<T, P>, P> checkedProviders() {
return new CheckedProviderSubjectFactory<>();
}
开发者ID:google,项目名称:guice,代码行数:5,代码来源:CheckedProviderSubject.java
示例9: assertThat
import com.google.inject.throwingproviders.CheckedProvider; //导入依赖的package包/类
public static <T, P extends CheckedProvider<T>> CheckedProviderSubject<T, P> assertThat(
@Nullable P provider) {
return assertAbout(CheckedProviderSubject.<T, P>checkedProviders()).that(provider);
}
开发者ID:google,项目名称:guice,代码行数:5,代码来源:CheckedProviderSubject.java
注:本文中的com.google.inject.throwingproviders.CheckedProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论