Lines 47-53
Link Here
|
47 |
import junit.framework.TestCase; |
47 |
import junit.framework.TestCase; |
48 |
import org.netbeans.junit.MockServices; |
48 |
import org.netbeans.junit.MockServices; |
49 |
import org.netbeans.spi.queries.FileEncodingQueryImplementation; |
49 |
import org.netbeans.spi.queries.FileEncodingQueryImplementation; |
|
|
50 |
import org.openide.cookies.EditorCookie; |
51 |
import org.openide.cookies.SaveCookie; |
50 |
import org.openide.filesystems.FileObject; |
52 |
import org.openide.filesystems.FileObject; |
|
|
53 |
import org.openide.filesystems.FileSystem; |
51 |
import org.openide.filesystems.FileUtil; |
54 |
import org.openide.filesystems.FileUtil; |
52 |
import org.openide.loaders.DataObject; |
55 |
import org.openide.loaders.DataObject; |
53 |
import org.openide.nodes.Children; |
56 |
import org.openide.nodes.Children; |
Lines 59-65
Link Here
|
59 |
* @author Jaroslav Tulach |
62 |
* @author Jaroslav Tulach |
60 |
*/ |
63 |
*/ |
61 |
public class HtmlDataObjectTest extends TestCase { |
64 |
public class HtmlDataObjectTest extends TestCase { |
62 |
@SuppressWarnings("deprecation") |
65 |
|
63 |
private static void init() { |
66 |
private static void init() { |
64 |
FileUtil.setMIMEType("html", "text/html"); |
67 |
FileUtil.setMIMEType("html", "text/html"); |
65 |
} |
68 |
} |
Lines 114-118
Link Here
|
114 |
} |
117 |
} |
115 |
} |
118 |
} |
116 |
|
119 |
|
117 |
|
120 |
public void testSetModifiedRemovesSaveCookie() throws Exception { |
|
|
121 |
FileSystem fs = FileUtil.createMemoryFileSystem(); |
122 |
FileObject f = fs.getRoot().createData("index.html"); |
123 |
DataObject dob = DataObject.find(f); |
124 |
assertEquals("Wrong DataObject sub class.", HtmlDataObject.class, dob.getClass()); |
125 |
dob.getLookup().lookup(EditorCookie.class).openDocument().insertString(0, "modified", null); |
126 |
assertTrue("Should be modified.", dob.isModified()); |
127 |
dob.setModified(false); |
128 |
assertFalse("Should not be modified.", dob.isModified()); |
129 |
assertNull("Should not have SaveCookie.", dob.getLookup().lookup(SaveCookie.class)); |
130 |
} |
118 |
} |
131 |
} |