use of com.jetbrains.python.refactoring.classes.PyMemberInfoStorage in project intellij-community by JetBrains.
the class PyExtractSuperclassPresenterTest method configureByClass.
/**
* Configures presenter by class
*
* @param name name of class
* @return presenter
*/
@NotNull
private PyExtractSuperclassPresenterImpl configureByClass(@NotNull final String name) {
final PyClass childClass = getClassByName(name);
final PyMemberInfoStorage storage = new PyMemberInfoStorage(childClass);
return new PyExtractSuperclassPresenterImpl(myView, childClass, storage);
}
use of com.jetbrains.python.refactoring.classes.PyMemberInfoStorage in project intellij-community by JetBrains.
the class PyExtractSuperclassPresenterTest method testInvalidSuperClassNameLeadsToError.
/**
* Checks that presenter displays error if user enters invalid name for new class
*/
public void testInvalidSuperClassNameLeadsToError() {
final String className = "Child";
final PyClass aClass = getClassByName(className);
final List<PyMemberInfo<PyElement>> classMemberInfos = new PyMemberInfoStorage(aClass).getClassMemberInfos(aClass);
assert !classMemberInfos.isEmpty() : "No member infos for " + className;
final PyMemberInfo<PyElement> pyMemberInfo = classMemberInfos.get(0);
EasyMock.expect(myView.getSelectedMemberInfos()).andReturn(Collections.singletonList(pyMemberInfo)).anyTimes();
EasyMock.expect(myView.getSuperClassName()).andReturn("INVALID CLASS NAME").anyTimes();
final Capture<String> errorMessageCapture = configureViewToCaptureError();
final PyExtractSuperclassPresenterImpl sut = configureByClass(className);
myMocksControl.replay();
sut.launch();
sut.okClicked();
Assert.assertTrue("No error displayed for invalid class name", errorMessageCapture.hasCaptured());
}
use of com.jetbrains.python.refactoring.classes.PyMemberInfoStorage in project intellij-community by JetBrains.
the class PyPullUpInfoModelTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
myFixture.configureByFile("/refactoring/pullup/pyPullUpInfoModel.py");
final PyClass childClass = getClassByName("ChildWithDependencies");
final PyClass parentClass = getClassByName("SomeParent");
mySut = new PyPullUpInfoModel(childClass, new MocksControl(MocksControl.MockType.NICE).createMock(PyPullUpView.class));
mySut.setSuperClass(parentClass);
myMemberInfos = new PyMemberInfoStorage(childClass).getClassMemberInfos(childClass);
}
use of com.jetbrains.python.refactoring.classes.PyMemberInfoStorage in project intellij-community by JetBrains.
the class PyPullUpPresenterTest method configureByClass.
/**
* Creates presenter (sut) by class
*
* @param name name of class
* @return presenter
*/
private PyPullUpPresenterImpl configureByClass(@NotNull final String name) {
final PyClass childClass = getClassByName(name);
final PyMemberInfoStorage storage = new PyMemberInfoStorage(childClass);
return new PyPullUpPresenterImpl(myView, storage, childClass);
}
Aggregations