コード例 #1
0
        public void Test_countTokens()
        {
            // Test for method int java.util.StringTokenizer.countTokens()
            StringTokenizer st = new StringTokenizer("This is a test String");

            assertEquals("Incorrect token count returned", 5, st.CountTokens());
        }
コード例 #2
0
        public void Test_ConstructorLjava_lang_StringLjava_lang_String()
        {
            // Test for method java.util.StringTokenizer(java.lang.String,
            // java.lang.String)
            StringTokenizer st = new StringTokenizer("This:is:a:test:String", ":");

            assertTrue("Created incorrect tokenizer", st.CountTokens() == 5 &&
                       (st.NextToken().equals("This")));
        }
コード例 #3
0
        public void Test_ConstructorLjava_lang_StringLjava_lang_StringZ()
        {
            // Test for method java.util.StringTokenizer(java.lang.String,
            // java.lang.String, boolean)
            StringTokenizer st = new StringTokenizer("This:is:a:test:String", ":",
                                                     true);

            st.NextToken();
            assertTrue("Created incorrect tokenizer", st.CountTokens() == 8 &&
                       (st.NextToken().Equals(":", StringComparison.Ordinal)));
        }