Created
September 22, 2015 10:13
-
-
Save up1/4dd22f33ce7597917481 to your computer and use it in GitHub Desktop.
Add invalid test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InvalidTest { | |
@Rule | |
public ExpectedException thrown = ExpectedException.none(); | |
@Test | |
public void input_is_null_should_thrown_numberformat_exception() { | |
thrown.expect(NumberFormatException.class); | |
thrown.expectMessage("ข้อมูลเป็นค่า null (Null Value)"); | |
BahtText.getBath(null); | |
} | |
@Test | |
public void input_is_empty_after_filter_out_input_should_thrown_numberformat_exception() { | |
thrown.expect(NumberFormatException.class); | |
thrown.expectMessage("ข้อมูลเป็นค่าว่าง (Blank Value)"); | |
BahtText.getBath(", "); | |
} | |
@Test | |
public void input_is_not_valid_after_filter_out_input_should_thrown_numberformat_exception() { | |
thrown.expect(NumberFormatException.class); | |
thrown.expectMessage("ข้อมูลมีตัวอักขระ (Alphabet Value)"); | |
BahtText.getBath("ABC"); | |
} | |
@Test | |
public void have_multiple_dot_should_thrown_numberformat_exception() { | |
thrown.expect(NumberFormatException.class); | |
thrown.expectMessage("ทศนิยมมากกว่า 1 ตัว"); | |
BahtText.getBath("1.1.1.1"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment