File tree Expand file tree Collapse file tree
core-java-modules/core-java-io-4/src/test/java/com/baeldung/scanner Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import static org .junit .jupiter .api .Assertions .assertEquals ;
99
1010public class ScannerUnitTest {
11- @ Test public void scannerSkipUsingPattern () {
11+ @ Test public void givenScannerWithPattern_thenSkipUsingPattern () {
1212 String str = "Java scanner skip tutorial" ;
1313 // Instantiates Scanner
1414 Scanner sc = new Scanner (str );
1515 // By using skip(Pattern) method is to skip that meets the given pattern
1616 sc .skip (Pattern .compile (".ava" ));
17- assertEquals (sc .nextLine (), " scanner skip tutorial" );
17+
18+ assertEquals (" scanner skip tutorial" , sc .nextLine ());
1819 // Scanner closed
1920 sc .close ();
2021 }
2122
22- @ Test public void scannerSkipUsingStringPattern () {
23+ @ Test public void givenScannerWithString_thenSkipUsingStringPattern () {
2324 String str = "Java scanner skip tutorial" ;
2425 // Instantiates Scanner
2526 Scanner sc = new Scanner (str );
2627 // By using skip(String) method is to skip that meets the given
2728 // pattern constructed from the given String
2829 sc .skip ("Java" );
29- assertEquals (sc .nextLine (), " scanner skip tutorial" );
3030
31+ assertEquals (" scanner skip tutorial" , sc .nextLine ());
3132 // Scanner closed
3233 sc .close ();
3334 }
You can’t perform that action at this time.
0 commit comments