本文整理汇总了Java中org.junit.experimental.theories.suppliers.TestedOn类的典型用法代码示例。如果您正苦于以下问题:Java TestedOn类的具体用法?Java TestedOn怎么用?Java TestedOn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestedOn类属于org.junit.experimental.theories.suppliers包,在下文中一共展示了TestedOn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendedDoubleWithPrecisionParsesAsItselfWithTolerance
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory( nullsAccepted = false )
public void appendedDoubleWithPrecisionParsesAsItselfWithTolerance( final Double value,
@TestedOn( ints = { 0, 1, 2, 3, 10, 16, 19, 20 } )
final int digits ) {
final ByteBuffer buffer = ByteBuffer.allocate( 50 );
BufferFormatter.append( buffer, value, digits );
final String formatted = BufferFormatterTest.toString( buffer );
final double parsedValue = Double.parseDouble( formatted );
assertThat(
".append(" + value + "," + digits + ") -> [" + formatted + "] -> [" + parsedValue + "]",
parsedValue,
closeTo( value, tolerance( digits ) )
);
}
示例2: appendedDoubleWithPrecisionParsesAsItselfWithToleranceCB
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory( nullsAccepted = false )
public void appendedDoubleWithPrecisionParsesAsItselfWithToleranceCB( final Double value,
@TestedOn( ints = { 0, 1, 2, 3, 10, 16, 19, 20 } )
final int digits ) {
final CharBuffer buffer = CharBuffer.allocate( 50 );
BufferFormatter.append( buffer, value, digits );
final String formatted = BufferFormatterTest.toString( buffer );
final double parsedValue = Double.parseDouble( formatted );
assertThat(
".append(" + value + "," + digits + ") -> [" + formatted + "] -> [" + parsedValue + "]",
parsedValue,
closeTo( value, tolerance( digits ) )
);
}
示例3: testNotExistChars
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory
public void testNotExistChars(@TestedOn(ints = { 5, 50, 500 }) int count) {
StringBuilder sb = new StringBuilder();
IntStream.range(0, count)
.mapToObj(a -> (char) (Math.random() * 100 + 128))
.forEach(sb::append);
String string = sb.toString();
Flowable.fromIterable(() -> notExistChars(string))
.test(0)
.requestMore(count)
.assertNever(c -> string.indexOf(c.charValue()) != -1);
}
示例4: getAnnotations
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Test
public void getAnnotations() throws SecurityException,
NoSuchMethodException {
Method method = getClass().getMethod("foo", int.class);
List<Annotation> annotations = ParameterSignature.signatures(method)
.get(0).getAnnotations();
assertThat(annotations,
CoreMatchers.<TestedOn>hasItem(isA(TestedOn.class)));
}
示例5: getAnnotations
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Test
public void getAnnotations() throws SecurityException,
NoSuchMethodException {
Method method = ParameterSignatureTest.class.getMethod("foo", int.class);
List<Annotation> annotations = ParameterSignature.signatures(method)
.get(0).getAnnotations();
assertThat(annotations,
CoreMatchers.<TestedOn>hasItem(isA(TestedOn.class)));
}
示例6: testLeading
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory public void testLeading(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
@NonNull FontScale fontScale,
@TestedOn(ints = {1, 2}) int leadingScalar) {
final String str = StringUtils.repeat("Mm%[email protected]|Pbdpqg ", 100);
setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, str, leadingScalar);
snap(textView, leadingScalar + "x_leading");
}
示例7: testWidth
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
@NonNull FontScale fontScale, @NonNull PrimaryTestImg image,
@NonNull PrimaryTestStr title, @NonNull SecondaryTestStr subtitle) {
setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, image, title, subtitle,
BLUE);
snap(subject, image + "_image", title + "_title", subtitle + "_subtitle");
}
示例8: testWidth
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
@NonNull FontScale fontScale, @NonNull PrimaryTestStr title,
@NonNull SecondaryTestStr subtitle,
@TestedOn(ints = {0, 1, MAX_SUGGESTIONS}) int suggestions) {
setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, title, subtitle, TODAY,
suggestions);
snap(subject, title + "_title", subtitle + "_subtitle", suggestions + "_suggestions");
}
示例9: testSetSubtitle
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory public void testSetSubtitle(@TestedOn(ints = {TODAY, TOMORROW, 2}) int age) {
setUp(WIDTH_DP_L, LayoutDirection.LOCALE, FontScale.DEFAULT, Theme.LIGHT,
PrimaryTestStr.SHORT, SecondaryTestStr.SHORT, TODAY, MAX_SUGGESTIONS);
String expected;
switch (age) {
case TODAY: expected = "Today"; break;
case TOMORROW: expected = "Yesterday"; break;
default: expected = String.valueOf(age);
}
String subtitle = subject.getSubtitle(age);
assertThat(subtitle, containsString(expected));
}
示例10: testWidth
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_XL, WIDTH_DP_L}) int widthDp,
@NonNull FontScale fontScale, @NonNull PrimaryTestStr title,
@NonNull SecondaryTestStr description,
@NonNull PrimaryTestStr error, @TestedOnBool boolean saving) {
setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, title, description, error,
saving);
snap(subject, title + "_title", description + "_description", error + "_error",
saving ? "saving" : "unsaved");
}
示例11: testLayout
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory public void testLayout(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
// @TestedOn(ints = {HEIGHT_DP_L, WIDTH_DP_S}) int heightDp,
@NonNull FontScale fontScale, @NonNull PrimaryTestImg image,
@NonNull PrimaryTestStr title, @NonNull SecondaryTestStr subtitle,
@TestedOnBool boolean pronunciation) {
// todo: pass height when layout is correct
setUp(widthDp, 0, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, image, title,
subtitle, pronunciation);
snap(subject, image + "_image", title + "_title", subtitle + "_subtitle",
pronunciation ? "pronunciation" : "no_pronunciation");
}
示例12: testOnScrollChanged
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory public void testOnScrollChanged(@TestedOn(ints = {-1, 0, 1}) int y) {
setUpTypical();
// width and height must be > 0 for Bitmap.createBitmap()
final int height = 100;
ViewHelpers.setupView(subject).setExactHeightDp(height).layout();
subject.onScrollChanged(0, y, false);
assertThat((int) subject.getTranslationY(), is(-Math.min(height, y)));
assertThat((int) subject.image.getImage().getTranslationY(), is(y / 2));
}
示例13: foo
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
public void foo(@TestedOn(ints = {1, 2, 3}) int x) {
}
示例14: foo
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
public void foo(@TestedOn(ints = {1}) int x) {
}
示例15: everythingIsOne
import org.junit.experimental.theories.suppliers.TestedOn; //导入依赖的package包/类
@Theory
public void everythingIsOne(@TestedOn(ints = {1})
int number) {
assertThat(number, is(1));
}