public void assertAtTextCompletionContains(String findByText, String... lookupStrings) { final PsiElement element = myFixture.findElementByText(findByText, PsiElement.class); assert element != null : "No element found by text: " + findByText; myFixture.getEditor().getCaretModel().moveToOffset(element.getTextOffset() + 1); myFixture.completeBasic(); checkContainsCompletion(lookupStrings); }
public void testRenameRpc() { myFixture.configureByFiles("rename/service/RenameRpc.proto"); myFixture.renameElementAtCaret("NewName"); ServiceNode option = myFixture.findElementByText("NewName", ServiceNode.class); Assert.assertNotNull(option); }
public void testRenameService() { myFixture.configureByFiles("rename/service/RenameService.proto"); myFixture.renameElementAtCaret("NewName"); ServiceNode option = myFixture.findElementByText("NewName", ServiceNode.class); Assert.assertNotNull(option); }
public void testRenameField_caretAtFieldName() { myFixture.configureByFiles("rename/field/RenameOneof.proto"); myFixture.renameElementAtCaret("NewName"); OneOfNode option = myFixture.findElementByText("NewName", OneOfNode.class); Assert.assertNotNull(option); }
public void testRenameMessage_fieldReferenceIncludesPackage() { myFixture.configureByFiles("rename/type/RenameMessage_FieldReferenceIncludesPackage.proto"); myFixture.renameElementAtCaret("NewName"); MessageNode message = myFixture.findElementByText("NewName", MessageNode.class); Assert.assertEquals("rename.type.NewName", message.getFullName()); MessageNode fieldParent = myFixture.findElementByText("TestMessage", MessageNode.class); Collection<MessageField> fields = fieldParent.getFields(); MessageField field = Iterables.getOnlyElement(fields); assertEquals("rename.type.NewName", field.getFieldType().getText()); } }
public void testRenameMessage_caretAtField() { myFixture.configureByFiles("rename/type/RenameMessage_CaretAtField.proto"); myFixture.renameElementAtCaret("NewName"); MessageNode message = myFixture.findElementByText("NewName", MessageNode.class); Assert.assertEquals("rename.type.NewName", message.getFullName()); }
public void testRenameMessage_caretAtField() { myFixture.configureByFiles("rename/type/RenameEnum_CaretAtField.proto"); myFixture.renameElementAtCaret("NewName"); EnumNode element = myFixture.findElementByText("NewName", EnumNode.class); Assert.assertEquals("rename.type.NewName", element.getFullName()); } }
public void testRenameMessage_caretAtMessageName() { myFixture.configureByFiles("rename/type/RenameEnum_CaretAtEnumName.proto"); myFixture.renameElementAtCaret("NewName"); EnumNode element = myFixture.findElementByText("NewName", EnumNode.class); Assert.assertEquals("rename.type.NewName", element.getFullName()); }
public void testRenameMessage_caretAtMessageName() { myFixture.configureByFiles("rename/type/RenameMessage_CaretAtMessageName.proto"); myFixture.renameElementAtCaret("NewName"); MessageNode message = myFixture.findElementByText("NewName", MessageNode.class); Assert.assertEquals("rename.type.NewName", message.getFullName()); }
public void assertAtTextCompletionContains(String findByText, String... lookupStrings) { final PsiElement element = myFixture.findElementByText(findByText, PsiElement.class); assert element != null : "No element found by text: " + findByText; myFixture.getEditor().getCaretModel().moveToOffset(element.getTextOffset() + 1); myFixture.completeBasic(); checkContainsCompletion(lookupStrings); }
/** * Test for invalid input - containing message is not fully parsed * due to error. * * https://github.com/protostuff/protobuf-jetbrains-plugin/issues/63 * * Type reference inside of such block should resolve to {@code null} * instead of throwing exception. */ public void testContainingMessageIsErrorNode() { myFixture.configureByFile("errors/BrokenParentMessage.proto"); FieldNode field = myFixture.findElementByText("parent", FieldNode.class); assertNotNull(field); TypeReferenceNode fieldType = field.getFieldType(); assertNotNull(fieldType); PsiReference target = fieldType.getReference(); assertNotNull(target); assertNull(target.resolve()); myFixture.checkHighlighting(); }