Java Code Examples for java.time.chrono.IsoEra

Following code examples demonstrate how to use java.time.chrono.IsoErafrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use java.time.chrono.IsoEraand various code implementation of this class.

    public void test_date_withEra() {
        int year = 5;
        int month = 5;
        int dayOfMonth = 5;
        LocalDate test = IsoChronology.INSTANCE.date(IsoEra.BCE, year, month, dayOfMonth);
        assertEquals(test.getEra(), IsoEra.BCE);
        assertEquals(test.get(ChronoField.YEAR_OF_ERA), year);
        assertEquals(test.get(ChronoField.MONTH_OF_YEAR), month);
        assertEquals(test.get(ChronoField.DAY_OF_MONTH), dayOfMonth);

        assertEquals(test.get(YEAR), 1 + (-1 * year));
        assertEquals(test.get(ERA), 0);
        assertEquals(test.get(YEAR_OF_ERA), year);
    } 


    @Test
    public default void verifyGenericType()
    throws Exception {
        final Class<SUT> sut = createNewSUT();
        assertTrue("This j8unit test interface is used with a generic type that is illegaly not assignable to IsoEra.class!",
                   IsoEra.class.isAssignableFrom(sut));
    } 

    public default BooleanAccess<HOST> isBce() {
        return host -> {
            val value = apply(host);
            return value == IsoEra.BCE;
        };
    } 

    public default BooleanAccess<HOST> isCe() {
        return host -> {
            val value = apply(host);
            return value == IsoEra.CE;
        };
    }