Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f32b860864cfecc2a42cf55c2d5fadcd2cc0685a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;

import java.io.File;

//import org.apache.tools.ant.types.selectors.SelectorUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.compiler.CharOperation;

//import junit.framework.AssertionFailedError;
import junit.framework.Test;

public class UtilTest extends AbstractRegressionTest {

StringBuffer camelCaseErrors;

public UtilTest(String name) {
	super(name);
}
static {
//	TESTS_RANGE = new int[] { 62, -1 };
}
public static Test suite() {
	return buildAllCompliancesTestSuite(testClass());
}
/**
 * Assert that a pattern and a name matches or not.
 * If result is invalid then store warning in buffer and display it.
 */
void assertCamelCase(String pattern, String name, boolean match) {
	assertCamelCase(pattern, name, false /* name may have more parts*/, match);
}
/**
 * Assert that a pattern and a name matches or not.
 * If result is invalid then store warning in buffer and display it.
 */
void assertCamelCase(String pattern, String name, boolean prefixMatch, boolean match) {
	boolean camelCase = CharOperation.camelCaseMatch(pattern==null?null:pattern.toCharArray(), name==null?null:name.toCharArray(), prefixMatch);
	if (match != camelCase) {
		StringBuffer line = new StringBuffer("'");
		line.append(name);
		line.append("' SHOULD");
		if (!match) line.append(" NOT");
		line.append(" match pattern '");
		line.append(pattern);
		line.append("', but it DOES");
		if (!camelCase) line.append(" NOT");
		if (this.camelCaseErrors.length() == 0) {
			System.out.println("Invalid results in test "+getName()+":");
		}
		System.out.println("	- "+line);
		this.camelCaseErrors.append('\n');
		this.camelCaseErrors.append(line);
	}
}
/* (non-Javadoc)
 * @see org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest#setUp()
 */
protected void setUp() throws Exception {
	super.setUp();
	this.camelCaseErrors = new StringBuffer();
}

public boolean checkPathMatch(char[] pattern, char[] path, boolean isCaseSensitive) {
	
	CharOperation.replace(pattern, '/', File.separatorChar);
	CharOperation.replace(pattern, '\\', File.separatorChar);
	CharOperation.replace(path, '/', File.separatorChar);
	CharOperation.replace(path, '\\', File.separatorChar);
	
	boolean result = CharOperation.pathMatch(pattern, path, isCaseSensitive, File.separatorChar);

//	boolean antResult = SelectorUtils.matchPath(new String(pattern), new String(path), isCaseSensitive);
//	if (antResult != result) {
//		new AssertionFailedError("WARNING : Ant expectation for patchMatch(\""+new String(pattern)+"\", \""+new String(path)+"\", ...) is: "+antResult).printStackTrace();
//	}

	return result;
}

public void test01() {

	assertTrue("Pattern matching failure",
		!CharOperation.match("X".toCharArray(), "Xyz".toCharArray(), true));
}
public void test02() {

	assertTrue("Pattern matching failure",
		CharOperation.match("X*".toCharArray(), "Xyz".toCharArray(), true));
}
public void test03() {

	assertTrue("Pattern matching failure",
		CharOperation.match("X".toCharArray(), "X".toCharArray(), true));
}
public void test04() {

	assertTrue("Pattern matching failure",
		CharOperation.match("X*X".toCharArray(), "XYX".toCharArray(), true));
}
public void test05() {

	assertTrue("Pattern matching failure",
		CharOperation.match("XY*".toCharArray(), "XYZ".toCharArray(), true));
}
public void test06() {

	assertTrue("Pattern matching failure",
		CharOperation.match("*XY*".toCharArray(), "XYZ".toCharArray(), true));
}
public void test07() {

	assertTrue("Pattern matching failure",
		CharOperation.match("*".toCharArray(), "XYZ".toCharArray(), true));
}
public void test08() {

	assertTrue("Pattern matching failure",
		!CharOperation.match("a*".toCharArray(), "XYZ".toCharArray(), true));
}
public void test09() {

	assertTrue("Pattern matching failure",
		!CharOperation.match("abc".toCharArray(), "XYZ".toCharArray(), true));
}
public void test10() {

	assertTrue("Pattern matching failure",
		!CharOperation.match("ab*c".toCharArray(), "abX".toCharArray(), true));
}
public void test11() {

	assertTrue("Pattern matching failure",
		CharOperation.match("a*b*c".toCharArray(), "aXXbYYc".toCharArray(), true));
}
public void test12() {

	assertTrue("Pattern matching failure",
		!CharOperation.match("*a*bc".toCharArray(), "aXXbYYc".toCharArray(), true));
}
public void test13() {

	assertTrue("Pattern matching failure",
		!CharOperation.match("*foo*bar".toCharArray(), "".toCharArray(), true));
}
public void test14() {

	assertTrue("Pattern matching failure",
		CharOperation.match("*foo*bar".toCharArray(), "ffoobabar".toCharArray(), true));
}
public void test15() {

	assertTrue("Pattern matching failure",
		!CharOperation.match("*fol*bar".toCharArray(), "ffoobabar".toCharArray(), true));
}
public void test16() {

	assertTrue("Pattern matching failure",
		CharOperation.match("*X*Y*".toCharArray(), "XY".toCharArray(), true));
}
public void test17() {

	assertTrue("Pattern matching failure",
		CharOperation.match("*X*Y*".toCharArray(), "XYZ".toCharArray(), true));
}
public void test18() {

	assertTrue("Pattern matching failure",
		CharOperation.match("main(*)".toCharArray(), "main(java.lang.String[] argv)".toCharArray(), true));
}
public void test19() {

	assertTrue("Pattern matching failure",
		CharOperation.match("*rr*".toCharArray(), "ARRAY".toCharArray(), false));
}

public void test20() {

	assertTrue("Pattern matching failure",
		CharOperation.match("hello*World".toCharArray(), "helloWorld".toCharArray(), true));
}

public void test21() {
	assertEquals("Trim failure", "hello", new String(CharOperation.trim("hello".toCharArray())));
}
public void test22() {
	assertEquals("Trim failure", "hello", new String(CharOperation.trim("   hello".toCharArray())));
}
public void test23() {
	assertEquals("Trim failure", "hello", new String(CharOperation.trim("   hello   ".toCharArray())));
}
public void test24() {
	assertEquals("Trim failure", "hello", new String(CharOperation.trim("hello   ".toCharArray())));
}
public void test25() {
	assertEquals("Trim failure", "", new String(CharOperation.trim("   ".toCharArray())));
}
public void test26() {
	assertEquals("Trim failure", "hello world", new String(CharOperation.trim(" hello world  ".toCharArray())));
}
public void test27() {
	char [][] tokens = CharOperation.splitAndTrimOn(','," hello,world".toCharArray());
	StringBuffer buffer = new StringBuffer();
	for (int i = 0; i < tokens.length; i++){
		buffer.append('[').append(tokens[i]).append(']');
	}
	assertEquals("SplitTrim failure", "[hello][world]", buffer.toString());
}
public void test28() {
	char [][] tokens = CharOperation.splitAndTrimOn(','," hello , world".toCharArray());
	StringBuffer buffer = new StringBuffer();
	for (int i = 0; i < tokens.length; i++){
		buffer.append('[').append(tokens[i]).append(']');
	}
	assertEquals("SplitTrim failure", "[hello][world]", buffer.toString());
}
public void test29() {
	char [][] tokens = CharOperation.splitAndTrimOn(','," hello, world   ".toCharArray());
	StringBuffer buffer = new StringBuffer();
	for (int i = 0; i < tokens.length; i++){
		buffer.append('[').append(tokens[i]).append(']');
	}
	assertEquals("SplitTrim failure", "[hello][world]", buffer.toString());
}
public void test30() {
	char [][] tokens = CharOperation.splitAndTrimOn(','," hello, world   ,zork/, aaa bbb".toCharArray());
	StringBuffer buffer = new StringBuffer();
	for (int i = 0; i < tokens.length; i++){
		buffer.append('[').append(tokens[i]).append(']');
	}
	assertEquals("SplitTrim failure", "[hello][world][zork/][aaa bbb]", buffer.toString());
}
public void test31() {
	char [][] tokens = CharOperation.splitAndTrimOn(',',"  ,  ".toCharArray());
	StringBuffer buffer = new StringBuffer();
	for (int i = 0; i < tokens.length; i++){
		buffer.append('[').append(tokens[i]).append(']');
	}
	assertEquals("SplitTrim failure", "[][]", buffer.toString());
}
public void test32() {
	char [][] tokens = CharOperation.splitAndTrimOn(',',"   ".toCharArray());
	StringBuffer buffer = new StringBuffer();
	for (int i = 0; i < tokens.length; i++){
		buffer.append('[').append(tokens[i]).append(']');
	}
	assertEquals("SplitTrim failure", "[]", buffer.toString());
}
public void test33() {
	char [][] tokens = CharOperation.splitAndTrimOn(',',"  , hello  ".toCharArray());
	StringBuffer buffer = new StringBuffer();
	for (int i = 0; i < tokens.length; i++){
		buffer.append('[').append(tokens[i]).append(']');
	}
	assertEquals("SplitTrim failure", "[][hello]", buffer.toString());
}

public void test34() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("hello/*/World".toCharArray(), "hello/zzz/World".toCharArray(), true));
}

public void test35() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("hello/**/World".toCharArray(), "hello/x/y/z/World".toCharArray(), true));
}

public void test36() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("hello/**/World/**/*.java".toCharArray(), "hello/x/y/z/World/X.java".toCharArray(), true));
}

public void test37() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("**/World/**/*.java".toCharArray(), "hello/x/y/z/World/X.java".toCharArray(), true));
}

public void test38() {

	assertTrue("Path pattern matching failure",
		!checkPathMatch("/*.java".toCharArray(), "/hello/x/y/z/World/X.java".toCharArray(), true));
}

/*
 * From Ant pattern set examples
 */
public void test39() {

	assertTrue("Path pattern matching failure-1",
		checkPathMatch("**/CVS/*".toCharArray(), "CVS/Repository".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		checkPathMatch("**/CVS/*".toCharArray(), "org/apache/CVS/Entries".toCharArray(), true));
	assertTrue("Path pattern matching failure-3",
		checkPathMatch("**/CVS/*".toCharArray(), "org/apache/jakarta/tools/ant/CVS/Entries".toCharArray(), true));
	assertTrue("Path pattern matching failure-4",
		!checkPathMatch("**/CVS/*".toCharArray(), "org/apache/CVS/foo/bar/Entries".toCharArray(), true));
}

/*
 * From Ant pattern set examples
 */
public void test40() {

	assertTrue("Path pattern matching failure-1",
		checkPathMatch("org/apache/jakarta/**".toCharArray(), "org/apache/jakarta/tools/ant/docs/index.html".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		checkPathMatch("org/apache/jakarta/**".toCharArray(), "org/apache/jakarta/test.xml".toCharArray(), true));
	assertTrue("Path pattern matching failure-3",
		!checkPathMatch("org/apache/jakarta/**".toCharArray(), "org/apache/xyz.java".toCharArray(), true));
}

/*
 * From Ant pattern set examples
 */
public void test41() {

	assertTrue("Path pattern matching failure-1",
		checkPathMatch("org/apache/**/CVS/*".toCharArray(), "org/apache/CVS/Entries".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		checkPathMatch("org/apache/**/CVS/*".toCharArray(), "org/apache/jakarta/tools/ant/CVS/Entries".toCharArray(), true));
	assertTrue("Path pattern matching failure-3",
		!checkPathMatch("org/apache/**/CVS/*".toCharArray(), "org/apache/CVS/foo/bar/Entries".toCharArray(), true));
}

/*
 * From Ant pattern set examples
 */
public void test42() {

	assertTrue("Path pattern matching failure-1",
		checkPathMatch("**/test/**".toCharArray(), "org/apache/test/CVS/Entries".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		checkPathMatch("**/test/**".toCharArray(), "test".toCharArray(), true));
	assertTrue("Path pattern matching failure-3",
		checkPathMatch("**/test/**".toCharArray(), "a/test".toCharArray(), true));
	assertTrue("Path pattern matching failure-4",
		checkPathMatch("**/test/**".toCharArray(), "test/a.java".toCharArray(), true));
	assertTrue("Path pattern matching failure-5",
		!checkPathMatch("**/test/**".toCharArray(), "org/apache/test.java".toCharArray(), true));
}
/*
 * Corner cases
 */
public void test43() {

	assertTrue("Path pattern matching failure-1",
		checkPathMatch("/test/".toCharArray(), "/test/CVS/Entries".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		checkPathMatch("/test/**".toCharArray(), "/test/CVS/Entries".toCharArray(), true));
}
/*
 * Corner cases
 */
public void test44() {
		
	assertTrue("Path pattern matching failure-1",
		!checkPathMatch("test".toCharArray(), "test/CVS/Entries".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		!checkPathMatch("**/test".toCharArray(), "test/CVS/Entries".toCharArray(), true));
}
/*
 * Corner cases
 */
public void test45() {
		
	assertTrue("Path pattern matching failure-1",
		checkPathMatch("/test/test1/".toCharArray(), "/test/test1/test/test1".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		!checkPathMatch("/test/test1".toCharArray(), "/test/test1/test/test1".toCharArray(), true));
}
public void test46() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("hello/**/World".toCharArray(), "hello/World".toCharArray(), true));
}
/*
 * Regression test for 28316 Missing references to constructor 
 */
public void test47() {

	assertTrue("Pattern matching failure",
		CharOperation.match("*x".toCharArray(), "x.X".toCharArray(), false));
}
public void test48() {

	assertTrue("Pattern matching failure",
		CharOperation.match("*a*".toCharArray(), "abcd".toCharArray(), false));
}
public void test49() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("**/hello".toCharArray(), "hello/hello".toCharArray(), true));
}
public void test50() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("**/hello/**".toCharArray(), "hello/hello".toCharArray(), true));
}
public void test51() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("**/hello/".toCharArray(), "hello/hello".toCharArray(), true));
}
public void test52() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("hello/".toCharArray(), "hello/hello".toCharArray(), true));
}
public void test53() {

	assertTrue("Path pattern matching failure",
		!checkPathMatch("/".toCharArray(), "hello/hello".toCharArray(), true));
}
public void test54() {

	assertTrue("Path pattern matching failure-1",
		!checkPathMatch("x/".toCharArray(), "hello/x".toCharArray(), true)); // 29761

	assertTrue("Path pattern matching failure-2",
		checkPathMatch("**/x/".toCharArray(), "hello/x".toCharArray(), true)); 

	assertTrue("Path pattern matching failure-3",
		!checkPathMatch("/x/".toCharArray(), "hello/x".toCharArray(), true));
}
public void test56() {

	assertTrue("Path pattern matching failure",
		!checkPathMatch("/**".toCharArray(), "hello/hello".toCharArray(), true));
}
public void test57() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("/".toCharArray(), "/hello/hello".toCharArray(), true));
}
public void test58() {

	assertTrue("Path pattern matching failure",
		checkPathMatch("/**".toCharArray(), "/hello/hello".toCharArray(), true));
}
public void test59() {

	assertTrue("Path pattern matching failure",
		!checkPathMatch("**".toCharArray(), "/hello/hello".toCharArray(), true));
}
public void test60() {

	assertTrue("Path pattern matching failure-1",
		!checkPathMatch("/P/src".toCharArray(), "/P/src/X".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		!checkPathMatch("/P/**/src".toCharArray(), "/P/src/X".toCharArray(), true));
	assertTrue("Path pattern matching failure-3",
		checkPathMatch("/P/src".toCharArray(), "/P/src".toCharArray(), true));
	assertTrue("Path pattern matching failure-4",
		!checkPathMatch("A.java".toCharArray(), "/P/src/A.java".toCharArray(), true));		
}
public void test61() {

	assertTrue("Path pattern matching failure-1",
		checkPathMatch("/P/src/**/CVS".toCharArray(), "/P/src/CVS".toCharArray(), true));
	assertTrue("Path pattern matching failure-2",
		checkPathMatch("/P/src/**/CVS/".toCharArray(), "/P/src/CVS".toCharArray(), true));
}
public void test62() {
	assertCamelCase("NPE", "NullPointerException", true/* should match */);
	assertCamelCase("NPExc", "NullPointerException", true/* should match */);
	assertCamelCase("NPoE", "NullPointerException", true/* should match */);
	assertCamelCase("NuPExc", "NullPointerException", true/* should match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
public void test63() {
	assertCamelCase("NPEX", "NullPointerException", false/* should not match */);
	assertCamelCase("NPex", "NullPointerException", false/* should not match */);
	assertCamelCase("npe", "NullPointerException", false/* should not match */);
	assertCamelCase("npe", "NPException", false/* should not match */);
	assertCamelCase("NPointerE", "NullPointerException", true/* should match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
public void test64() {
	assertCamelCase("IAE", "IgnoreAllErrorHandler", true/* should match */);
	assertCamelCase("IAE", "IAnchorElement", true/* should match */);
	assertCamelCase("IAnchorEleme", "IAnchorElement", true/* should match */);
	assertCamelCase("", "IAnchorElement", false/* should not match */);
	assertCamelCase(null, "IAnchorElement", true/* should match */);
	assertCamelCase("", "", true/* should match */);
	assertCamelCase("IAnchor", null, false/* should not match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
public void test65() {
	assertCamelCase("iSCDCo", "invokeStringConcatenationDefaultConstructor", true/* should match */);
	assertCamelCase("inVOke", "invokeStringConcatenationDefaultConstructor", false/* should not match */);
	assertCamelCase("i", "invokeStringConcatenationDefaultConstructor", true/* should match */);
	assertCamelCase("I", "invokeStringConcatenationDefaultConstructor", false/* should not match */);
	assertCamelCase("iStringCD", "invokeStringConcatenationDefaultConstructor", true/* should match */);
	assertCamelCase("NPE", "NullPointerException/java.lang", true/* should match */);
	assertCamelCase("NPE", "NullPointer/lang.Exception", false/* should not match */);
	assertCamelCase("NPE", "Null_Pointer$Exception", true/* should match */);
	assertCamelCase("NPE", "Null1Pointer2Exception", true/* should match */);
	assertCamelCase("NPE", "Null.Pointer.Exception", false/* should not match */);
	assertCamelCase("NPE", "aNullPointerException", false/* should not match */);
	assertCamelCase("nullP", "nullPointerException", true/* should match */);
	assertCamelCase("nP", "nullPointerException", true/* should match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}

/**
 * Bug 130390: CamelCase algorithm cleanup and improvement
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=130390"
 */
public void test66() {
    String[][] MATCHES = {
            {"TZ","TimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"TiZ","TimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"TiZon","TimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"TZon","TimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"TZone","TimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"TimeZone","TimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"TimeZ","TimeZ"},  //$NON-NLS-1$//$NON-NLS-2$
            {"TZ","TimeZ"},  //$NON-NLS-1$//$NON-NLS-2$
            {"T","TimeZ"},  //$NON-NLS-1$//$NON-NLS-2$
            {"T","TimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"TZ","TZ"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aT","aTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aTi","aTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aTiZ","aTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aTZ","aTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aT","artTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aTi","artTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aTiZ","artTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aTZ","artTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
    };
    
    for (int i = 0; i<MATCHES.length ; i++) {
        String[] match = MATCHES[i];
        assertCamelCase(match[0], match[1], true/*should match*/);
    }
    
    String[][] MIS_MATCHES = {
            {"TZ","Timezone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aTZ","TimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aTZ","TZ"},  //$NON-NLS-1$//$NON-NLS-2$
            {"arT","aTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"arTi","aTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"arTiZ","aTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"arTZ","aTimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
            {"aT","atimeZone"},  //$NON-NLS-1$//$NON-NLS-2$
    };
    
    for (int i = 0; i<MIS_MATCHES.length ; i++) {
        String[] match = MIS_MATCHES[i];
        assertCamelCase(match[0], match[1], false/*should not match*/);
    }

	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}

/**
 * Bug 137087: Open Type - missing matches when using mixed case pattern
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137087"
 */
public void test67() {
	assertCamelCase("runtimeEx", "RuntimeException", false/* should not match */);
	assertCamelCase("Runtimeex", "RuntimeException", false/* should not match */);
	assertCamelCase("runtimeexception", "RuntimeException", false/* should not match */);
	assertCamelCase("Runtimexception", "RuntimeException", false/* should not match */);
	assertCamelCase("illegalMSException", "IllegalMonitorStateException", false/* should not match */);
	assertCamelCase("illegalMsException", "IllegalMonitorStateException", false /* should not match */);
	assertCamelCase("IllegalMSException", "IllegalMonitorStateException", true/* should match */);
	assertCamelCase("IllegalMsException", "IllegalMonitorStateException", false /* should not match */);
	assertCamelCase("clonenotsupportedex", "CloneNotSupportedException", false/* should not match */);
	assertCamelCase("CloneNotSupportedEx", "CloneNotSupportedException", true/* should match */);
	assertCamelCase("cloneNotsupportedEx", "CloneNotSupportedException", false/* should not match */);
	assertCamelCase("ClonenotSupportedexc", "CloneNotSupportedException", false/* should not match */);
	assertCamelCase("cloneNotSupportedExcep", "CloneNotSupportedException", false/* should not match */);
	assertCamelCase("Clonenotsupportedexception", "CloneNotSupportedException", false/* should not match */);
	assertCamelCase("CloneNotSupportedException", "CloneNotSupportedException", true /* should match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
// lower CamelCase
public void test68() {
	assertCamelCase("aMe", "aMethod", true/* should match */);
	assertCamelCase("ame", "aMethod", false/* should not match */);
	assertCamelCase("longNOM", "longNameOfMethod", true/* should match */);
	assertCamelCase("longNOMeth", "longNameOfMethod", true/* should match */);
	assertCamelCase("longNOMethod", "longNameOfMethod", true/* should match */);
	assertCamelCase("longNoMethod", "longNameOfMethod", false/* should not match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
// search tests
public void test69() {
	assertCamelCase("aa", "AxxAyy", false /* should not match */);
	assertCamelCase("Aa", "AxxAyy", false /* should not match */);
	assertCamelCase("aA", "AxxAyy", false /* should not match */);
	assertCamelCase("AA", "AxxAyy", true /* should match */);
	assertCamelCase("aa", "AbcdAbcdefAbcAbcdefghAbAAzzzzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnAbcAbcdefghijklm", false /* should not match */);
	assertCamelCase("AA", "AbcdAbcdefAbcAbcdefghAbAAzzzzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnAbcAbcdefghijklm", true /* should match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}

// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=109695
public void test70() throws CoreException {
	assertCamelCase("IDE3", "IDocumentExtension", true /*same part count*/, false /* should not match */);
	assertCamelCase("IDE3", "IDocumentExtension2", true /*same part count*/, false /* should not match */);
	assertCamelCase("IDE3", "IDocumentExtension3", true /*same part count*/, true /* should match */);
	assertCamelCase("IDE3", "IDocumentExtension135", true /*same part count*/, true /* should match */);
	assertCamelCase("IDE3", "IDocumentExtension315", true /*same part count*/, true /* should match */);
	assertCamelCase("IDPE3", "IDocumentProviderExtension", true /*same part count*/, false /* should not match */);
	assertCamelCase("IDPE3", "IDocumentProviderExtension2", true /*same part count*/, false /* should not match */);
	assertCamelCase("IDPE3", "IDocumentProviderExtension4", true /*same part count*/, false /* should not match */);
	assertCamelCase("IDPE3", "IDocumentProviderExtension3", true /*same part count*/, true /* should match */);
	assertCamelCase("IDPE3", "IDocumentProviderExtension5", true /*same part count*/, false /* should not match */);
	assertCamelCase("IDPE3", "IDocumentProviderExtension54321", true /*same part count*/, true /* should match */);
	assertCamelCase("IDPE3", "IDocumentProviderExtension12345", true /*same part count*/, true /* should match */);
	assertCamelCase("IPL3", "IPerspectiveListener", true /*same part count*/, false /* should not match */);
	assertCamelCase("IPL3", "IPerspectiveListener2", true /*same part count*/, false /* should not match */);
	assertCamelCase("IPL3", "IPerspectiveListener3", true /*same part count*/, true /* should match */);
	assertCamelCase("IPS2", "IPropertySource", true /*same part count*/, false /* should not match */);
	assertCamelCase("IPS2", "IPropertySource2", true /*same part count*/, true /* should match */);
	assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate", true /*same part count*/, false /* should not match */);
	assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate2", true /*same part count*/, true /* should match */);
	assertCamelCase("UTF16DSS", "UTF16DocumentScannerSupport", true /*same part count*/, true /* should match */);
	assertCamelCase("UTF16DSS", "UTF1DocScannerSupport", true /*same part count*/, false /* should not match */);
	assertCamelCase("UTF16DSS", "UTF6DocScannerSupport", true /*same part count*/, false /* should not match */);
	assertCamelCase("UTF16DSS", "UTFDocScannerSupport", true /*same part count*/, false /* should not match */);
	assertCamelCase("UTF1DSS", "UTF16DocumentScannerSupport", true /*same part count*/, true /* should match */);
	assertCamelCase("UTF1DSS", "UTF1DocScannerSupport", true /*same part count*/, true /* should match */);
	assertCamelCase("UTF1DSS", "UTF6DocScannerSupport", true /*same part count*/, false /* should not match */);
	assertCamelCase("UTF1DSS", "UTFDocScannerSupport", true /*same part count*/, false /* should not match */);
	assertCamelCase("UTF6DSS", "UTF16DocumentScannerSupport", true /*same part count*/, true /* should match */);
	assertCamelCase("UTF6DSS", "UTF1DocScannerSupport", true /*same part count*/, false /* should not match */);
	assertCamelCase("UTF6DSS", "UTF6DocScannerSupport", true /*same part count*/, true /* should match */);
	assertCamelCase("UTF6DSS", "UTFDocScannerSupport", true /*same part count*/, false /* should not match */);
	assertCamelCase("UTFDSS", "UTF16DocumentScannerSupport", true /*same part count*/, true /* should match */);
	assertCamelCase("UTFDSS", "UTF1DocScannerSupport", true /*same part count*/, true /* should match */);
	assertCamelCase("UTFDSS", "UTF6DocScannerSupport", true /*same part count*/, true /* should match */);
	assertCamelCase("UTFDSS", "UTFDocScannerSupport", true /*same part count*/, true /* should match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
public void test71() {
	assertCamelCase("HM", "HashMap", true /*same count of parts expected*/, true /*should match*/);
	assertCamelCase("HM", "HtmlMapper", true /*same count of parts expected*/, true /*should match*/);
	assertCamelCase("HM", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HaM", "HashMap", true /*same count of parts expected*/, true /* should match */);
	assertCamelCase("HaM", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HaM", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HashM", "HashMap", true /*same count of parts expected*/, true /* should match */);
	assertCamelCase("HashM", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HashM", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
public void test71b() { // previous test cases but with 3.3 behavior
	assertCamelCase("HM", "HashMap", true /*should match*/);
	assertCamelCase("HM", "HtmlMapper", true /*should match*/);
	assertCamelCase("HM", "HashMapEntry", true /*should match*/);
	assertCamelCase("HaM", "HashMap", true /* should match */);
	assertCamelCase("HaM", "HtmlMapper", false /*should not match*/);
	assertCamelCase("HaM", "HashMapEntry", true /*should match*/);
	assertCamelCase("HashM", "HashMap", true /* should match */);
	assertCamelCase("HashM", "HtmlMapper", false /*should not match*/);
	assertCamelCase("HashM", "HashMapEntry", true /*should match*/);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
public void test72() {
	assertCamelCase("HMa", "HashMap", true /*same count of parts expected*/, true /* should match */);
	assertCamelCase("HMa", "HtmlMapper", true /*same count of parts expected*/, true /* should match */);
	assertCamelCase("HMa", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HaMa", "HashMap", true /*same count of parts expected*/, true /* should match */);
	assertCamelCase("HaMa", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HaMa", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HashMa", "HashMap", true /*same count of parts expected*/, true /* should match */);
	assertCamelCase("HashMa", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HashMa", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
public void test72b() { // previous test cases but with 3.3 behavior
	assertCamelCase("HMa", "HashMap", true /*should match*/);
	assertCamelCase("HMa", "HtmlMapper", true /*should match*/);
	assertCamelCase("HMa", "HashMapEntry", true /*should match*/);
	assertCamelCase("HaMa", "HashMap", true /* should match */);
	assertCamelCase("HaMa", "HtmlMapper", false /*should not match*/);
	assertCamelCase("HaMa", "HashMapEntry", true /*should match*/);
	assertCamelCase("HashMa", "HashMap", true /* should match */);
	assertCamelCase("HashMa", "HtmlMapper", false /*should not match*/);
	assertCamelCase("HashMa", "HashMapEntry", true /*should match*/);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
public void test73() {
	assertCamelCase("HMap", "HashMap", true /*same count of parts expected*/, true /*should match*/);
	assertCamelCase("HMap", "HtmlMapper", true /*same count of parts expected*/, true /* should not match */);
	assertCamelCase("HMap", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HaMap", "HashMap", true /*same count of parts expected*/, true /* should match */);
	assertCamelCase("HaMap", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HaMap", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HashMap", "HashMap", true /*same count of parts expected*/, true /* should match */);
	assertCamelCase("HashMap", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
	assertCamelCase("HashMap", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
public void test73b() { // previous test cases but with 3.3 behavior
	assertCamelCase("HMap", "HashMap", true /*should match*/);
	assertCamelCase("HMap", "HtmlMapper", true /*should match*/);
	assertCamelCase("HMap", "HashMapEntry", true /*should match*/);
	assertCamelCase("HaMap", "HashMap", true /* should match */);
	assertCamelCase("HaMap", "HtmlMapper", false /*should not match*/);
	assertCamelCase("HaMap", "HashMapEntry", true /*should match*/);
	assertCamelCase("HashMap", "HashMap", true /* should match */);
	assertCamelCase("HashMap", "HtmlMapper", false /*should not match*/);
	assertCamelCase("HashMap", "HashMapEntry", true /*should match*/);
	// Verify that there were no unexpected results
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
}
public static Class testClass() {
	return UtilTest.class;
}
}

Back to the top