Package joptsimple.util

Examples of joptsimple.util.DateConverter


        monthDayYear = new SimpleDateFormat( "MM/dd/yyyy" );
    }

    @Test( expected = NullPointerException.class )
    public void rejectsNullDateFormatter() {
        new DateConverter( null );
    }
View Full Code Here


        new DateConverter( null );
    }

    @Test
    public void shouldConvertValuesToDatesUsingADateFormat() {
        ValueConverter<Date> converter = new DateConverter( monthDayYear );

        assertEquals( new LocalDate( 2009, 1, 24 ).toDate(), converter.convert( "01/24/2009" ) );
    }
View Full Code Here

    @Test
    public void rejectsNonParsableValues() {
        thrown.expect( ValueConversionException.class );

        new DateConverter( getDateInstance() ).convert( "@(#*^" );
    }
View Full Code Here

    @Test
    public void rejectsValuesThatDoNotEntirelyMatch() {
        thrown.expect( ValueConversionException.class );

        new DateConverter( monthDayYear ).convert( "12/25/09 00:00:00" );
    }
View Full Code Here

    public void shouldRaiseExceptionThatContainsDatePatternAndValue() {
        thrown.expect( ValueConversionException.class );
        thrown.expectMessage( "qwe" );
        thrown.expectMessage( monthDayYear.toPattern() );

        new DateConverter( monthDayYear ).convert( "qwe" );
    }
View Full Code Here

    public void shouldRaiseExceptionThatContainsValueOnlyIfNotASimpleDateFormat() {
        thrown.expect( ValueConversionException.class );
        thrown.expectMessage( "asdf" );
        thrown.expectMessage( not( containsString( notASimpleDateFormat.toString() ) ) );

        new DateConverter( notASimpleDateFormat ).convert( "asdf" );
    }
View Full Code Here

        new DateConverter( notASimpleDateFormat ).convert( "asdf" );
    }

    @Test
    public void shouldAnswerCorrectValueType() {
        assertSame( Date.class, new DateConverter( monthDayYear ).valueType() );
    }
View Full Code Here

        assertSame( Date.class, new DateConverter( monthDayYear ).valueType() );
    }

    @Test
    public void shouldGiveNoValuePatternIfFormatterNotASimpleDateFormat() {
        assertEquals( "", new DateConverter( notASimpleDateFormat ).valuePattern() );
    }
View Full Code Here

TOP

Related Classes of joptsimple.util.DateConverter

Copyright © 2018 www.massapicom. 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.