本文整理汇总了Java中com.intellij.mock.MockDocument类的典型用法代码示例。如果您正苦于以下问题:Java MockDocument类的具体用法?Java MockDocument怎么用?Java MockDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockDocument类属于com.intellij.mock包,在下文中一共展示了MockDocument类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLowerCase
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public void testLowerCase() throws Exception {
new OCamlCompletionContributor().beforeCompletion(new CompletionInitializationContext(createDummyEditor(), createFakeFile(), CompletionType.BASIC) {
@Override
public void setFileCopyPatcher(@NotNull final FileCopyPatcher fileCopyPatcher) {
final MockDocument document = new MyMockDocument() {
@Override
public void replaceString(final int startOffset, final int endOffset, @NotNull final CharSequence s) {
assertEquals(OCamlCompletionContributor.LOWER_CASE_DUMMY_IDENTIFIER, s);
}
};
final OffsetMap offsetMap = new OffsetMap(document);
offsetMap.addOffset(CompletionInitializationContext.START_OFFSET, 0);
offsetMap.addOffset(CompletionInitializationContext.SELECTION_END_OFFSET, 0);
fileCopyPatcher.patchFileCopy(createFakeFile(), document, offsetMap);
}
});
}
示例2: testGetUncommittedDocuments_documentNotRegistered
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public void testGetUncommittedDocuments_documentNotRegistered() throws Exception
{
final Document document = new MockDocument();
ApplicationManager.getApplication().runWriteAction(new Runnable()
{
@Override
public void run()
{
getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false));
}
});
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
}
示例3: testGetUncommittedDocuments_documentNotRegistered
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public void testGetUncommittedDocuments_documentNotRegistered() throws Exception {
final Document document = new MockDocument();
WriteCommandAction.runWriteCommandAction(null, new Runnable() {
@Override
public void run() {
changeDocument(document, PsiDocumentManagerImplTest.this.getPsiDocumentManager());
}
});
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
}
示例4: testGetUncommittedDocuments_documentNotRegistered
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public void testGetUncommittedDocuments_documentNotRegistered() throws Exception {
final Document document = new MockDocument();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false));
}
});
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
}
示例5: FormatAsciiDocActionTest
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public FormatAsciiDocActionTest(String prefix, String selection, String postfix, boolean isWord, String explanation) {
document = new MockDocument();
document.replaceString(0, 0, prefix + selection + postfix);
start = prefix.length();
end = prefix.length() + selection.length();
this.explanation = explanation;
this.isWord = isWord;
}
示例6: createPendingChange
import com.intellij.mock.MockDocument; //导入依赖的package包/类
private TestFindResult createPendingChange(final int startOffset) {
FindResultImpl findResult = new FindResultImpl(startOffset, startOffset + 10);
TestFindResult testFindResult = new TestFindResult(new MockDocument(""), findResult) {
@Override
public int getStartOffset() {
return startOffset;
}
};
testFindResult.setTestState(TestState.NotModified);
return testFindResult;
}
示例7: testGetCachedPsiFile_NoFile
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public void testGetCachedPsiFile_NoFile() throws Exception {
final PsiFile file = getPsiDocumentManager().getCachedPsiFile(new MockDocument());
assertNull(file);
}
示例8: testGetPsiFile_NotRegisteredDocument
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public void testGetPsiFile_NotRegisteredDocument() throws Exception {
final PsiFile file = getPsiDocumentManager().getPsiFile(new MockDocument());
assertNull(file);
}
示例9: setUp
import com.intellij.mock.MockDocument; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
myDocument = new MockDocument();
myTextBlock = new TextBlock();
}
示例10: testGetCachedPsiFile_NoFile
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public void testGetCachedPsiFile_NoFile() throws Exception
{
final PsiFile file = getPsiDocumentManager().getCachedPsiFile(new MockDocument());
assertNull(file);
}
示例11: testGetPsiFile_NotRegisteredDocument
import com.intellij.mock.MockDocument; //导入依赖的package包/类
public void testGetPsiFile_NotRegisteredDocument() throws Exception
{
final PsiFile file = getPsiDocumentManager().getPsiFile(new MockDocument());
assertNull(file);
}