Package net.emaze.dysfunctional.strings.lexcasts

Source Code of net.emaze.dysfunctional.strings.lexcasts.DoubleParserTest

package net.emaze.dysfunctional.strings.lexcasts;

import net.emaze.dysfunctional.dispatching.delegates.Delegate;
import org.junit.Assert;
import org.junit.Test;

/**
*
* @author rferranti
*/
public class DoubleParserTest {

    @Test(expected=IllegalArgumentException.class)
    public void parsingNullStringYieldsException() {
        new DoubleParser().perform(null);
    }
   
    @Test(expected=NumberFormatException.class)
    public void parsingInvalidStringYieldsException() {
        new DoubleParser().perform("A");
    }
   
    @Test(expected = ClassCastException.class)
    public void passingNonStringToErasureYieldsException() {
        Delegate d = new DoubleParser();
        d.perform(new Object());
    }       
   
    @Test
    public void parsingValidStringYieldsValue() {
        final Double got = new DoubleParser().perform("1.");
        Assert.assertEquals(Double.valueOf(1), got);
    }
}
TOP

Related Classes of net.emaze.dysfunctional.strings.lexcasts.DoubleParserTest

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.