Examples of PeriodFormatterService


Examples of com.ibm.icu.impl.duration.PeriodFormatterService

                result);
        }
       
        // same issue, but using English and the internal APIs
        {
            PeriodFormatterService pfs = BasicPeriodFormatterService.getInstance();
            PeriodBuilder pb = pfs.newPeriodBuilderFactory()
                .setAllowMilliseconds(false)
                .getSingleUnitBuilder();
            DurationFormatter df = pfs.newDurationFormatterFactory()
                .setPeriodBuilder(pb)
                .getFormatter();
            String result = df.formatDurationFromNow(500);
            assertEquals(
                "english test case",
                "less than 1 second from now",
                result);
          
        }
       
        // if the limit is set on milliseconds, and they are not supported,
        // use an effective limit based on seconds
        {
            PeriodFormatterService pfs = BasicPeriodFormatterService.getInstance();
            PeriodBuilder pb = pfs.newPeriodBuilderFactory()
                .setMinLimit(2500)
                .setAllowMilliseconds(false)
                .getSingleUnitBuilder();
            DurationFormatter df = pfs.newDurationFormatterFactory()
                .setPeriodBuilder(pb)
                .getFormatter();
            String result = df.formatDurationFromNow(500);
            assertEquals(
                "limit test case",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.