当前位置: 首页>>代码示例>>Java>>正文


Java SignStyle.NEVER属性代码示例

本文整理汇总了Java中java.time.format.SignStyle.NEVER属性的典型用法代码示例。如果您正苦于以下问题:Java SignStyle.NEVER属性的具体用法?Java SignStyle.NEVER怎么用?Java SignStyle.NEVER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.time.format.SignStyle的用法示例。


在下文中一共展示了SignStyle.NEVER属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: data_signStyle

@DataProvider(name="signStyle")
Object[][] data_signStyle() {
    return new Object[][] {
            {LocalDate.of(0, 10, 2), SignStyle.ALWAYS, null, "+00"},
            {LocalDate.of(2001, 10, 2), SignStyle.ALWAYS, null, "+2001"},
            {LocalDate.of(-2001, 10, 2), SignStyle.ALWAYS, null, "-2001"},

            {LocalDate.of(2001, 10, 2), SignStyle.NORMAL, null, "2001"},
            {LocalDate.of(-2001, 10, 2), SignStyle.NORMAL, null, "-2001"},

            {LocalDate.of(2001, 10, 2), SignStyle.NEVER, null, "2001"},
            {LocalDate.of(-2001, 10, 2), SignStyle.NEVER, null, "2001"},

            {LocalDate.of(2001, 10, 2), SignStyle.NOT_NEGATIVE, null, "2001"},
            {LocalDate.of(-2001, 10, 2), SignStyle.NOT_NEGATIVE, DateTimeException.class, ""},

            {LocalDate.of(0, 10, 2), SignStyle.EXCEEDS_PAD, null, "00"},
            {LocalDate.of(1, 10, 2), SignStyle.EXCEEDS_PAD, null, "01"},
            {LocalDate.of(-1, 10, 2), SignStyle.EXCEEDS_PAD, null, "-01"},

            {LocalDate.of(20001, 10, 2), SignStyle.ALWAYS, DateTimeException.class, ""},
            {LocalDate.of(20001, 10, 2), SignStyle.NORMAL, DateTimeException.class, ""},
            {LocalDate.of(20001, 10, 2), SignStyle.NEVER, DateTimeException.class, ""},
            {LocalDate.of(20001, 10, 2), SignStyle.EXCEEDS_PAD, DateTimeException.class, ""},
            {LocalDate.of(20001, 10, 2), SignStyle.NOT_NEGATIVE, DateTimeException.class, ""},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:TCKSignStyle.java

示例2: data_error

@DataProvider(name="error")
Object[][] data_error() {
    return new Object[][] {
        {DAY_OF_MONTH, 1, 2, SignStyle.NEVER, "12", -1, IndexOutOfBoundsException.class},
        {DAY_OF_MONTH, 1, 2, SignStyle.NEVER, "12", 3, IndexOutOfBoundsException.class},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:TestNumberParser.java

示例3: provider_parseData

@DataProvider(name="parseData")
Object[][] provider_parseData() {
    return new Object[][] {
        // normal
        {1, 2, SignStyle.NEVER, 0, "12", 0, 2, 12L},       // normal
        {1, 2, SignStyle.NEVER, 0, "Xxx12Xxx", 3, 5, 12L}, // parse in middle
        {1, 2, SignStyle.NEVER, 0, "99912999", 3, 5, 12L}, // parse in middle
        {2, 4, SignStyle.NEVER, 0, "12345", 0, 4, 1234L},  // stops at max width
        {2, 4, SignStyle.NEVER, 0, "12-45", 0, 2, 12L},    // stops at dash
        {2, 4, SignStyle.NEVER, 0, "123-5", 0, 3, 123L},   // stops at dash
        {1, 10, SignStyle.NORMAL, 0, "2147483647", 0, 10, Integer.MAX_VALUE},
        {1, 10, SignStyle.NORMAL, 0, "-2147483648", 0, 11, Integer.MIN_VALUE},
        {1, 10, SignStyle.NORMAL, 0, "2147483648", 0, 10, 2147483648L},
        {1, 10, SignStyle.NORMAL, 0, "-2147483649", 0, 11, -2147483649L},
        {1, 10, SignStyle.NORMAL, 0, "987659876598765", 0, 10, 9876598765L},
        {1, 19, SignStyle.NORMAL, 0, "999999999999999999", 0, 18, 999999999999999999L},
        {1, 19, SignStyle.NORMAL, 0, "-999999999999999999", 0, 19, -999999999999999999L},
        {1, 19, SignStyle.NORMAL, 0, "1000000000000000000", 0, 19, 1000000000000000000L},
        {1, 19, SignStyle.NORMAL, 0, "-1000000000000000000", 0, 20, -1000000000000000000L},
        {1, 19, SignStyle.NORMAL, 0, "000000000000000000", 0, 18, 0L},
        {1, 19, SignStyle.NORMAL, 0, "0000000000000000000", 0, 19, 0L},
        {1, 19, SignStyle.NORMAL, 0, "9223372036854775807", 0, 19, Long.MAX_VALUE},
        {1, 19, SignStyle.NORMAL, 0, "-9223372036854775808", 0, 20, Long.MIN_VALUE},
        {1, 19, SignStyle.NORMAL, 0, "9223372036854775808", 0, 18, 922337203685477580L},  // last digit not parsed
        {1, 19, SignStyle.NORMAL, 0, "-9223372036854775809", 0, 19, -922337203685477580L}, // last digit not parsed
        // no match
        {1, 2, SignStyle.NEVER, 1, "A1", 0, 0, 0},
        {1, 2, SignStyle.NEVER, 1, " 1", 0, 0, 0},
        {1, 2, SignStyle.NEVER, 1, "  1", 1, 1, 0},
        {2, 2, SignStyle.NEVER, 1, "1", 0, 0, 0},
        {2, 2, SignStyle.NEVER, 1, "Xxx1", 0, 0, 0},
        {2, 2, SignStyle.NEVER, 1, "1", 1, 1, 0},
        {2, 2, SignStyle.NEVER, 1, "Xxx1", 4, 4, 0},
        {2, 2, SignStyle.NEVER, 1, "1-2", 0, 0, 0},
        {1, 19, SignStyle.NORMAL, 0, "-000000000000000000", 0, 0, 0},
        {1, 19, SignStyle.NORMAL, 0, "-0000000000000000000", 0, 0, 0},
        // parse reserving space 1 (adjacent-parsing)
        {1, 1, SignStyle.NEVER, 1, "12", 0, 1, 1L},
        {1, 19, SignStyle.NEVER, 1, "12", 0, 1, 1L},
        {1, 19, SignStyle.NEVER, 1, "12345", 0, 4, 1234L},
        {1, 19, SignStyle.NEVER, 1, "12345678901", 0, 10, 1234567890L},
        {1, 19, SignStyle.NEVER, 1, "123456789012345678901234567890", 0, 19, 1234567890123456789L},
        {1, 19, SignStyle.NEVER, 1, "1", 0, 1, 1L},  // error from next field
        {2, 2, SignStyle.NEVER, 1, "12", 0, 2, 12L},  // error from next field
        {2, 19, SignStyle.NEVER, 1, "1", 0, 0, 0},
        // parse reserving space 2 (adjacent-parsing)
        {1, 1, SignStyle.NEVER, 2, "123", 0, 1, 1L},
        {1, 19, SignStyle.NEVER, 2, "123", 0, 1, 1L},
        {1, 19, SignStyle.NEVER, 2, "12345", 0, 3, 123L},
        {1, 19, SignStyle.NEVER, 2, "12345678901", 0, 9, 123456789L},
        {1, 19, SignStyle.NEVER, 2, "123456789012345678901234567890", 0, 19, 1234567890123456789L},
        {1, 19, SignStyle.NEVER, 2, "1", 0, 1, 1L},  // error from next field
        {1, 19, SignStyle.NEVER, 2, "12", 0, 1, 1L},  // error from next field
        {2, 2, SignStyle.NEVER, 2, "12", 0, 2, 12L},  // error from next field
        {2, 19, SignStyle.NEVER, 2, "1", 0, 0, 0},
        {2, 19, SignStyle.NEVER, 2, "1AAAAABBBBBCCCCC", 0, 0, 0},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:58,代码来源:TestNumberParser.java

示例4: provider_parseDigitsLenient

@DataProvider(name="parseDigitsLenient")
Object[][] provider_parseDigitsLenient() {
    return new Object[][] {
            // never
            {"5", 1, 2, SignStyle.NEVER, 1, 5},
            {"5", 2, 2, SignStyle.NEVER, 1, 5},
            {"54", 1, 3, SignStyle.NEVER, 2, 54},
            {"54", 2, 3, SignStyle.NEVER, 2, 54},
            {"54", 3, 3, SignStyle.NEVER, 2, 54},
            {"543", 1, 3, SignStyle.NEVER, 3, 543},
            {"543", 2, 3, SignStyle.NEVER, 3, 543},
            {"543", 3, 3, SignStyle.NEVER, 3, 543},
            {"5432", 1, 3, SignStyle.NEVER, 4, 5432},
            {"5432", 2, 3, SignStyle.NEVER, 4, 5432},
            {"5432", 3, 3, SignStyle.NEVER, 4, 5432},
            {"5AAA", 2, 3, SignStyle.NEVER, 1, 5},

            // not negative
            {"5", 1, 2, SignStyle.NOT_NEGATIVE, 1, 5},
            {"5", 2, 2, SignStyle.NOT_NEGATIVE, 1, 5},
            {"54", 1, 3, SignStyle.NOT_NEGATIVE, 2, 54},
            {"54", 2, 3, SignStyle.NOT_NEGATIVE, 2, 54},
            {"54", 3, 3, SignStyle.NOT_NEGATIVE, 2, 54},
            {"543", 1, 3, SignStyle.NOT_NEGATIVE, 3, 543},
            {"543", 2, 3, SignStyle.NOT_NEGATIVE, 3, 543},
            {"543", 3, 3, SignStyle.NOT_NEGATIVE, 3, 543},
            {"5432", 1, 3, SignStyle.NOT_NEGATIVE, 4, 5432},
            {"5432", 2, 3, SignStyle.NOT_NEGATIVE, 4, 5432},
            {"5432", 3, 3, SignStyle.NOT_NEGATIVE, 4, 5432},
            {"5AAA", 2, 3, SignStyle.NOT_NEGATIVE, 1, 5},

            // normal
            {"5", 1, 2, SignStyle.NORMAL, 1, 5},
            {"5", 2, 2, SignStyle.NORMAL, 1, 5},
            {"54", 1, 3, SignStyle.NORMAL, 2, 54},
            {"54", 2, 3, SignStyle.NORMAL, 2, 54},
            {"54", 3, 3, SignStyle.NORMAL, 2, 54},
            {"543", 1, 3, SignStyle.NORMAL, 3, 543},
            {"543", 2, 3, SignStyle.NORMAL, 3, 543},
            {"543", 3, 3, SignStyle.NORMAL, 3, 543},
            {"5432", 1, 3, SignStyle.NORMAL, 4, 5432},
            {"5432", 2, 3, SignStyle.NORMAL, 4, 5432},
            {"5432", 3, 3, SignStyle.NORMAL, 4, 5432},
            {"5AAA", 2, 3, SignStyle.NORMAL, 1, 5},

            // always
            {"5", 1, 2, SignStyle.ALWAYS, 1, 5},
            {"5", 2, 2, SignStyle.ALWAYS, 1, 5},
            {"54", 1, 3, SignStyle.ALWAYS, 2, 54},
            {"54", 2, 3, SignStyle.ALWAYS, 2, 54},
            {"54", 3, 3, SignStyle.ALWAYS, 2, 54},
            {"543", 1, 3, SignStyle.ALWAYS, 3, 543},
            {"543", 2, 3, SignStyle.ALWAYS, 3, 543},
            {"543", 3, 3, SignStyle.ALWAYS, 3, 543},
            {"5432", 1, 3, SignStyle.ALWAYS, 4, 5432},
            {"5432", 2, 3, SignStyle.ALWAYS, 4, 5432},
            {"5432", 3, 3, SignStyle.ALWAYS, 4, 5432},
            {"5AAA", 2, 3, SignStyle.ALWAYS, 1, 5},

            // exceeds pad
            {"5", 1, 2, SignStyle.EXCEEDS_PAD, 1, 5},
            {"5", 2, 2, SignStyle.EXCEEDS_PAD, 1, 5},
            {"54", 1, 3, SignStyle.EXCEEDS_PAD, 2, 54},
            {"54", 2, 3, SignStyle.EXCEEDS_PAD, 2, 54},
            {"54", 3, 3, SignStyle.EXCEEDS_PAD, 2, 54},
            {"543", 1, 3, SignStyle.EXCEEDS_PAD, 3, 543},
            {"543", 2, 3, SignStyle.EXCEEDS_PAD, 3, 543},
            {"543", 3, 3, SignStyle.EXCEEDS_PAD, 3, 543},
            {"5432", 1, 3, SignStyle.EXCEEDS_PAD, 4, 5432},
            {"5432", 2, 3, SignStyle.EXCEEDS_PAD, 4, 5432},
            {"5432", 3, 3, SignStyle.EXCEEDS_PAD, 4, 5432},
            {"5AAA", 2, 3, SignStyle.EXCEEDS_PAD, 1, 5},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:74,代码来源:TestNumberParser.java


注:本文中的java.time.format.SignStyle.NEVER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。