Fixing declarative hints tests.
1.1 --- a/file/src/org/netbeans/modules/jackpot30/file/test/TestPerformer.java Fri Jul 01 18:38:14 2011 +0200
1.2 +++ b/file/src/org/netbeans/modules/jackpot30/file/test/TestPerformer.java Sun Jul 03 11:51:25 2011 +0200
1.3 @@ -163,10 +163,12 @@
1.4 }
1.5
1.6 for (Fix f : ed.getFixes().getFixes()) {
1.7 + //XXX: this fix is automatically added to all hints that do not have any fixes, filtering it out. Should be done more reliably:
1.8 + if (f.getClass().getName().equals("org.netbeans.modules.java.hints.jackpot.spi.support.ErrorDescriptionFactory$TopLevelConfigureFix")) continue;
1.9 currentResults.add(getFixResult(src, f));
1.10 }
1.11
1.12 - if (ed.getFixes().getFixes().isEmpty()) {
1.13 + if (currentResults.isEmpty()) {
1.14 currentResults.add(ed.getDescription() + ":" + ed.getRange().getText() + "\n");
1.15 }
1.16 }
2.1 --- a/file/test/unit/src/org/netbeans/modules/jackpot30/file/DeclarativeHintRegistryTest.java Fri Jul 01 18:38:14 2011 +0200
2.2 +++ b/file/test/unit/src/org/netbeans/modules/jackpot30/file/DeclarativeHintRegistryTest.java Sun Jul 03 11:51:25 2011 +0200
2.3 @@ -70,4 +70,15 @@
2.4 assertEquals(new HashSet<String>(Arrays.asList("java.lang.String")), hd.getAdditionalConstraints().requiredErasedTypes);
2.5 }
2.6
2.7 + public void testSuppressWarnings() {
2.8 + Collection<Collection<? extends HintDescription>> allHints = DeclarativeHintRegistry.parseHints(null, "$1.isDirectory <!suppress-warnings=isDirectory> :: $1 instanceof java.io.File ;;").values();
2.9 +
2.10 + assertEquals(1, allHints.size());
2.11 + assertEquals(1, allHints.iterator().next().size());
2.12 +
2.13 + HintDescription hd = allHints.iterator().next().iterator().next();
2.14 +
2.15 + assertEquals(Arrays.asList("isDirectory"), hd.getSuppressWarnings());
2.16 + }
2.17 +
2.18 }
2.19 \ No newline at end of file
3.1 --- a/file/test/unit/src/org/netbeans/modules/jackpot30/file/SuppressWarningsTest.hint Fri Jul 01 18:38:14 2011 +0200
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,1 +0,0 @@
3.4 -$1.isDirectory <!suppress-warnings=isDirectory> :: $1 instanceof java.io.File ;;
4.1 --- a/file/test/unit/src/org/netbeans/modules/jackpot30/file/SuppressWarningsTest.test Fri Jul 01 18:38:14 2011 +0200
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,26 +0,0 @@
4.4 -%%TestCase addSuppressWarnings
4.5 -package test;
4.6 -public class Test {
4.7 - private void test() {
4.8 - java.io.File f = null;
4.9 - f.isDirectory();
4.10 - }
4.11 -}
4.12 -%%=>
4.13 -package test;
4.14 -public class Test {
4.15 - @SuppressWarnings("isDirectory")
4.16 - private void test() {
4.17 - java.io.File f = null;
4.18 - f.isDirectory();
4.19 - }
4.20 -}
4.21 -%%TestCase suppressedWarnings
4.22 -package test;
4.23 -public class Test {
4.24 - @SuppressWarnings("isDirectory")
4.25 - private void test() {
4.26 - java.io.File f = null;
4.27 - f.isDirectory();
4.28 - }
4.29 -}