diff --git a/html/test/unit/src/org/netbeans/modules/html/HtmlDataObjectTest.java b/html/test/unit/src/org/netbeans/modules/html/HtmlDataObjectTest.java
--- a/html/test/unit/src/org/netbeans/modules/html/HtmlDataObjectTest.java
+++ b/html/test/unit/src/org/netbeans/modules/html/HtmlDataObjectTest.java
@@ -47,7 +47,10 @@
import junit.framework.TestCase;
import org.netbeans.junit.MockServices;
import org.netbeans.spi.queries.FileEncodingQueryImplementation;
+import org.openide.cookies.EditorCookie;
+import org.openide.cookies.SaveCookie;
import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObject;
import org.openide.nodes.Children;
@@ -59,7 +62,7 @@
* @author Jaroslav Tulach
*/
public class HtmlDataObjectTest extends TestCase {
- @SuppressWarnings("deprecation")
+
private static void init() {
FileUtil.setMIMEType("html", "text/html");
}
@@ -114,5 +117,15 @@
}
}
-
+ public void testSetModifiedRemovesSaveCookie() throws Exception {
+ FileSystem fs = FileUtil.createMemoryFileSystem();
+ FileObject f = fs.getRoot().createData("index.html");
+ DataObject dob = DataObject.find(f);
+ assertEquals("Wrong DataObject sub class.", HtmlDataObject.class, dob.getClass());
+ dob.getLookup().lookup(EditorCookie.class).openDocument().insertString(0, "modified", null);
+ assertTrue("Should be modified.", dob.isModified());
+ dob.setModified(false);
+ assertFalse("Should not be modified.", dob.isModified());
+ assertNull("Should not have SaveCookie.", dob.getLookup().lookup(SaveCookie.class));
+ }
}