Java 类org.junit.experimental.theories.suppliers.TestedOn 实例源码

项目:gflogger    文件:BufferFormatterPropertyTest.java   
@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 ) )
    );
}
项目:gflogger    文件:BufferFormatterPropertyTest.java   
@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 ) )
    );
}
项目:Java-EX    文件:StringUtilTest.java   
@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);
}
项目:Java-EX    文件:StringUtilTest.java   
@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);
}
项目:sosiefier    文件:ParameterSignatureTest.java   
@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)));
}
项目:junit    文件:ParameterSignatureTest.java   
@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)));
}
项目:health-and-care-developer-network    文件:ParameterSignatureTest.java   
@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)));
}
项目:apps-android-wikipedia    文件:CardHeaderViewTest.java   
@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");
}
项目:apps-android-wikipedia    文件:BecauseYouReadCardViewTest.java   
@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");
}
项目:apps-android-wikipedia    文件:BecauseYouReadCardViewTest.java   
@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));
}
项目:apps-android-wikipedia    文件:DescriptionEditViewTest.java   
@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");
}
项目:apps-android-wikipedia    文件:PageHeaderViewTest.java   
@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");
}
项目:apps-android-wikipedia    文件:PageHeaderViewTest.java   
@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));
}
项目:sosiefier    文件:ParameterSignatureTest.java   
public void foo(@TestedOn(ints = {1, 2, 3}) int x) {
}
项目:sosiefier    文件:TestedOnSupplierTest.java   
public void foo(@TestedOn(ints = {1}) int x) {
}
项目:sosiefier    文件:WithExtendedParameterSources.java   
@Theory
public void everythingIsOne(@TestedOn(ints = {1})
int number) {
    assertThat(number, is(1));
}
项目:junit    文件:ParameterSignatureTest.java   
public void foo(@TestedOn(ints = {1, 2, 3})
int x) {
}
项目:junit    文件:TestedOnSupplierTest.java   
public void foo(@TestedOn(ints = {1}) int x) {
}
项目:junit    文件:WithExtendedParameterSources.java   
@Theory
public void everythingIsOne(@TestedOn(ints = {1})
int number) {
    assertThat(number, is(1));
}
项目:health-and-care-developer-network    文件:ParameterSignatureTest.java   
public void foo(@TestedOn(ints = {1, 2, 3})
int x) {
}
项目:health-and-care-developer-network    文件:TestedOnSupplierTest.java   
public void foo(@TestedOn(ints = {1}) int x) {
}
项目:health-and-care-developer-network    文件:WithExtendedParameterSources.java   
@Theory
public void everythingIsOne(@TestedOn(ints = {1})
int number) {
    assertThat(number, is(1));
}
项目:apps-android-wikipedia    文件:AppTextViewWithImagesTest.java   
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_XS, WIDTH_DP_S, WIDTH_DP_M, WIDTH_DP_XL}) int widthDp,
                              @NonNull FontScale fontScale, @NonNull TertiaryTestStr text) {
    setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT);
    subject.setTextWithDrawables("^1 " + str(text)  + " ^2", R.drawable.ic_mode_edit_white_24dp, R.drawable.cc_logo);
    snap(subject, text + "_text");
}
项目:apps-android-wikipedia    文件:AppTextViewWithImagesTest.java   
@Theory public void testLayoutDirection(@TestedOn(ints = {WIDTH_DP_XS, WIDTH_DP_M}) int widthDp,
                                        @NonNull LayoutDirection direction) {
    setUp(widthDp, direction, FontScale.DEFAULT, Theme.LIGHT);
    subject.setTextWithDrawables("Every good ^1 does ^2.", R.drawable.ic_mode_edit_white_24dp, R.drawable.cc_logo);
    snap(subject);
}
项目:apps-android-wikipedia    文件:AppTextViewTest.java   
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
                              @NonNull FontScale fontScale, @NonNull PrimaryTestStr text) {
    setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, text);
    snap(subject, text + "_text");
}
项目:apps-android-wikipedia    文件:LeadingSpanTest.java   
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
                              @NonNull FontScale fontScale, @NonNull PrimaryTestStr text) {
    setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, text);
    snap(textView, text + "_text");
}
项目:apps-android-wikipedia    文件:AnnouncementCardViewTest.java   
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
                              @NonNull FontScale fontScale) {
    setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, IMAGE);
    snap(subject);
}
项目:apps-android-wikipedia    文件:ListCardItemViewTest.java   
@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);
    snap(subject, image + "_image", title + "_title", subtitle + "_subtitle");
}
项目:apps-android-wikipedia    文件:CardLargeHeaderViewTest.java   
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) int widthDp,
                              @NonNull FontScale fontScale, @NonNull SecondaryTestImg image,
                              @NonNull PrimaryTestStr title) {
    setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, image, title);
    snap(subject, image + "_image", title + "_title");
}
项目:apps-android-wikipedia    文件:CardHeaderViewTest.java   
@Theory public void testTheme(@NonNull Theme theme,
                              @TestedOn(ints = {BLUE, R.color.green50}) int circleColor) {
    setUp(WIDTH_DP_L, LayoutDirection.LOCALE, FontScale.DEFAULT, theme, PrimaryTestImg.NONNULL,
            PrimaryTestStr.SHORT, SecondaryTestStr.SHORT, circleColor);
    snap(subject, circleColor == BLUE ? "blue" : "green");
}
项目:apps-android-wikipedia    文件:DescriptionEditSuccessViewTest.java   
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_XL, WIDTH_DP_L}) int widthDp, @NonNull FontScale fontScale) {
    setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT);
    snap(subject);
}
项目:apps-android-wikipedia    文件:DescriptionEditTutorialPageViewTest.java   
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_XL, WIDTH_DP_L}) int widthDp, @NonNull FontScale fontScale) {
    for (DescriptionEditTutorialPage page : DescriptionEditTutorialPage.values()) {
        setUp(page, widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT);
        snap(subject, page.name());
    }
}
项目:apps-android-wikipedia    文件:DescriptionEditHelpViewTest.java   
@Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_XL, WIDTH_DP_L}) int widthDp,
                              @NonNull FontScale fontScale) {
    setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT);
    snap(subject);
}