SystemOrganization addCategory: #'OB-Tests-Refactory-Refactoring'! ORCommandTest subclass: #ORCmdRefactoringTest instanceVariableNames: 'node model' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdRefactoringTest subclass: #ORCmdClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdClassRefactoringTest subclass: #ORCmdAccessorClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAccessorClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAccessorClassRefactoring! ! !ORCmdAccessorClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusB asNode interactions: self browserRequestInteraction. self assert: (self parseTree: #firstInstanceVariableB: for: #BogusB) = (RBParser parseMethod: 'firstInstanceVariableB: anObject firstInstanceVariableB := anObject'). self assert: (self parseTree: #secondInstanceVariableB for: #BogusB) = (RBParser parseMethod: 'secondInstanceVariableB ^ secondInstanceVariableB'). self assert: (self parseTree: #secondInstanceVariableB: for: #BogusB) = (RBParser parseMethod: 'secondInstanceVariableB: anObject secondInstanceVariableB := anObject')! ! !ORCmdAccessorClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring02 self refactoringFor: BogusB asClassSideNode interactions: self browserRequestInteraction. self assert: (self parseTree: #firstClassInstanceVariableB for: #'BogusB class') = (RBParser parseMethod: 'firstClassInstanceVariableB ^ firstClassInstanceVariableB'). self assert: (self parseTree: #firstClassInstanceVariableB: for: #'BogusB class') = (RBParser parseMethod: 'firstClassInstanceVariableB: anObject firstClassInstanceVariableB := anObject'). self assert: (self parseTree: #secondClassInstanceVariableB for: #'BogusB class') = (RBParser parseMethod: 'secondClassInstanceVariableB ^ secondClassInstanceVariableB'). self assert: (self parseTree: #secondClassInstanceVariableB: for: #'BogusB class') = (RBParser parseMethod: 'secondClassInstanceVariableB: anObject secondClassInstanceVariableB := anObject')! ! !ORCmdClassRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:26'! isAbstract ^ self name = #ORCmdClassRefactoringTest! ! ORCmdClassRefactoringTest subclass: #ORCmdCreateSubclassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdCreateSubclassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdCreateSubclassRefactoring! ! !ORCmdCreateSubclassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusA asNode interactions: { OBTextRequest. 'BogusX'. OBMultipleChoiceRequest. { BogusE } } , self browserRequestInteraction. self assert: (self classFor: #BogusX) superclass = (self classFor: #BogusA). self assert: (self classFor: #BogusX) subclasses size = 1! ! !ORCmdCreateSubclassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring02 self refactoringFor: BogusA asNode interactions: { OBTextRequest. 'BogusX'. OBMultipleChoiceRequest. { } } , self browserRequestInteraction. self assert: (self classFor: #BogusX) superclass = (self classFor: #BogusA). self assert: (self classFor: #BogusX) subclasses isEmpty! ! ORCmdClassRefactoringTest subclass: #ORCmdCreateSuperclassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdCreateSuperclassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdCreateSuperclassRefactoring! ! !ORCmdCreateSuperclassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusA asNode interactions: { OBTextRequest. 'BogusX'. OBMultipleChoiceRequest. { BogusE } } , self browserRequestInteraction. self assert: (self classFor: #BogusX) subclasses size = 2. self assert: ((self classFor: #BogusX) subclasses includes: (self classFor: #BogusA)). self assert: ((self classFor: #BogusX) subclasses includes: (self classFor: #BogusE))! ! !ORCmdCreateSuperclassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring02 self refactoringFor: BogusA asNode interactions: { OBTextRequest. 'BogusX'. OBMultipleChoiceRequest. { } } , self browserRequestInteraction. self assert: (self classFor: #BogusX) subclasses size = 1. self assert: ((self classFor: #BogusX) subclasses includes: (self classFor: #BogusA)) ! ! ORCmdClassRefactoringTest subclass: #ORCmdRealizeClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRealizeClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRealizeClassRefactoring! ! !ORCmdRealizeClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 (self classFor: #BogusA) compile: 'zork self subclassResponsibility' classified: #(accessing). self refactoringFor: BogusE asNode interactions: self browserRequestInteraction. self assert: (self parseTree: #zork for: #BogusE) = (RBParser parseMethod: 'zork self shouldBeImplemented')! ! ORCmdClassRefactoringTest subclass: #ORCmdRemoveClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveClassRefactoring! ! !ORCmdRemoveClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusA asNode interactions: { OBConfirmationRequest. true. OBBrowseRequest. [ :request | self assert: (request browser isKindOf: ORMethodBrowser). self assert: (request browser root browserEnvironment isEmpty not). ^ self ] } , self browserRequestInteraction. self assert: false ! ! ORCmdClassRefactoringTest subclass: #ORCmdRenameClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameClassRefactoring! ! !ORCmdRenameClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusA asNode interactions: { OBTextRequest. 'BogusX' } , self browserRequestInteraction. self assert: self changes size = 1. self assert: (self classFor: #BogusA) isNil. self assert: (self classFor: #BogusX) notNil! ! ORCmdClassRefactoringTest subclass: #ORCmdSplitClassRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdSplitClassRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdSplitClassRefactoring! ! !ORCmdSplitClassRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusB asNode interactions: { OBMultipleChoiceRequest. { 'secondInstanceVariableB' }. OBTextRequest. #BogusX. OBTextRequest. 'other' } , self browserRequestInteraction. self assert: ((self classFor: #BogusB) instanceVariableNames includes: 'other'). self deny: ((self classFor: #BogusB) instanceVariableNames includes: 'secondInstanceVariableB'). self assert: ((self classFor: #BogusX) instanceVariableNames includes: 'secondInstanceVariableB')! ! ORCmdRefactoringTest subclass: #ORCmdClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdClassVarRefactoringTest subclass: #ORCmdAbstractClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAbstractClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAbstractClassVarRefactoring! ! !ORCmdAbstractClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: ORLintBrowser asClassSideNode interactions: { OBChoiceRequest. 'PaneCount' } , self browserRequestInteraction. self assert: (self parseTree: #paneCount1 for: #'ORLintBrowser class') = (RBParser parseMethod: 'paneCount1 ^ PaneCount'). self assert: (self parseTree: #paneCount: for: #'ORLintBrowser class') = (RBParser parseMethod: 'paneCount: anObject PaneCount := anObject'). self assert: ((self classFor: #ORLintBrowser) whichSelectorsReferToClassVariable: 'PaneCount') isEmpty. self assert: ((self classFor: #'ORLintBrowser class') whichSelectorsReferToClassVariable: 'PaneCount') size = 2 ! ! ORCmdClassVarRefactoringTest subclass: #ORCmdAccessorClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAccessorClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAccessorClassVarRefactoring! ! !ORCmdAccessorClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: (OBClassVariableNode on: 'SecondClassVariableB' inClass: BogusB) interactions: self browserRequestInteraction. self assert: (self parseTree: #secondClassVariableB for: #'BogusB class') = (RBParser parseMethod: 'secondClassVariableB ^ SecondClassVariableB'). self assert: (self parseTree: #secondClassVariableB: for: #'BogusB class') = (RBParser parseMethod: 'secondClassVariableB: anObject SecondClassVariableB := anObject')! ! ORCmdClassVarRefactoringTest subclass: #ORCmdAddClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAddClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAddClassVarRefactoring! ! !ORCmdAddClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusA asNode interactions: { OBTextRequest. 'BogusX' } , self browserRequestInteraction. self assert: ((self classFor: #BogusA) classVariableNames includes: 'BogusX')! ! !ORCmdClassVarRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:26'! isAbstract ^ self name = #ORCmdClassVarRefactoringTest! ! ORCmdClassVarRefactoringTest subclass: #ORCmdPullUpClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPullUpClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPullUpClassVarRefactoring! ! !ORCmdPullUpClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: (OBClassVariableNode on: 'SecondClassVariableB' inClass: BogusB) interactions: self browserRequestInteraction. self deny: ((self classFor: #BogusB) classVariableNames includes: 'SecondClassVariableB'). self assert: ((self classFor: #Object) classVariableNames includes: 'SecondClassVariableB')! ! ORCmdClassVarRefactoringTest subclass: #ORCmdPushDownClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPushDownClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPushDownClassVarRefactoring! ! !ORCmdPushDownClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:08'! testRefactoring01 self refactoringFor: BogusB asNode interactions: { OBChoiceRequest. 'FirstClassVariableB'. OBConfirmationRequest. false }! ! !ORCmdPushDownClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring02 "The variable is still referenced." self refactoringFor: BogusB asNode interactions: { OBChoiceRequest. 'SecondClassVariableB' } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) classVariableNames includes: 'SecondClassVariableB')! ! ORCmdClassVarRefactoringTest subclass: #ORCmdRemoveClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveClassVarRefactoring! ! !ORCmdRemoveClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:10'! testRefactoring01 self refactoringFor: BogusB asNode interactions: { OBChoiceRequest. 'FirstClassVariableB'. OBConfirmationRequest. false }! ! !ORCmdRemoveClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring02 self refactoringFor: BogusB asNode interactions: { OBChoiceRequest. 'SecondClassVariableB' } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) classVariableNames includes: 'SecondClassVariableB')! ! ORCmdClassVarRefactoringTest subclass: #ORCmdRenameClassVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameClassVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameClassVarRefactoring! ! !ORCmdRenameClassVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: (OBClassVariableNode on: 'FirstClassVariableB' inClass: BogusB) interactions: { OBTextRequest. 'Zork' } , self browserRequestInteraction. self assert: ((self classFor: #BogusB) classVariableNames includes: 'Zork'). self assert: (self parseTree: #accessesCVar for: #BogusB) = (RBParser parseMethod: 'accessesCVar ^ Zork')! ! ORCmdRefactoringTest subclass: #ORCmdInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdInstVarRefactoringTest subclass: #ORCmdAbstractInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAbstractInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAbstractInstVarRefactoring! ! !ORCmdAbstractInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:14'! testRefactoring01 self refactoringFor: ORLintBrowser asNode interactions: { OBChoiceRequest. 'process' } , self browserRequestInteraction. self assert: (self parseTree: #process for: #ORLintBrowser) = (RBParser parseMethod: 'process ^ process'). self assert: (self parseTree: #process: for: #ORLintBrowser) = (RBParser parseMethod: 'process: anObject ^ process := anObject'). self assert: ((self classFor: #ORLintBrowser) whichSelectorsReferToInstanceVariable: 'process') size = 2 ! ! ORCmdInstVarRefactoringTest subclass: #ORCmdAccessorInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAccessorInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAccessorInstVarRefactoring! ! !ORCmdAccessorInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: (OBInstanceVariableNode on: 'secondInstanceVariableB' inClass: BogusB) interactions: self browserRequestInteraction. self assert: (self parseTree: #secondInstanceVariableB for: #BogusB) = (RBParser parseMethod: 'secondInstanceVariableB ^ secondInstanceVariableB'). self assert: (self parseTree: #secondInstanceVariableB: for: #BogusB) = (RBParser parseMethod: 'secondInstanceVariableB: anObject secondInstanceVariableB := anObject')! ! ORCmdInstVarRefactoringTest subclass: #ORCmdAddInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAddInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAddInstVarRefactoring! ! !ORCmdAddInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusA asNode interactions: { OBTextRequest. 'zork' } , self browserRequestInteraction. self assert: ((self classFor: #BogusA) instanceVariableNames includes: 'zork')! ! !ORCmdInstVarRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:27'! isAbstract ^ self name = #ORCmdInstVarRefactoringTest! ! ORCmdInstVarRefactoringTest subclass: #ORCmdProtectInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdProtectInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdProtectInstVarRefactoring! ! !ORCmdProtectInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: ORLintBrowser asNode interactions: { OBChoiceRequest. 'environment' } , self browserRequestInteraction. self deny: ((RBNamespace new classNamed: #ORLintBrowser) whichSelectorsReferToSymbol: #environment) isEmpty. self assert: ((self classFor: #ORLintBrowser) whichSelectorsReferToSymbol: #environment) isEmpty! ! ORCmdInstVarRefactoringTest subclass: #ORCmdPullUpInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPullUpInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPullUpInstVarRefactoring! ! !ORCmdPullUpInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:14'! testRefactoring01 self refactoringFor: (OBInstanceVariableNode on: 'secondInstanceVariableB' inClass: BogusB) interactions: { OBConfirmationRequest. true } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) instanceVariableNames includes: 'secondInstanceVariableB'). self assert: ((self classFor: #Object) instanceVariableNames includes: 'secondInstanceVariableB')! ! ORCmdInstVarRefactoringTest subclass: #ORCmdPushDownInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPushDownInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPushDownInstVarRefactoring! ! !ORCmdPushDownInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusB asNode interactions: { OBChoiceRequest. 'secondInstanceVariableB' } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) instanceVariableNames includes: 'secondInstanceVariableB')! ! ORCmdInstVarRefactoringTest subclass: #ORCmdRemoveInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveInstVarRefactoring! ! !ORCmdRemoveInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: BogusB asNode interactions: { OBChoiceRequest. 'secondInstanceVariableB' } , self browserRequestInteraction. self deny: ((self classFor: #BogusB) instanceVariableNames includes: 'secondInstanceVariableB')! ! ORCmdInstVarRefactoringTest subclass: #ORCmdRenameInstVarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameInstVarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameInstVarRefactoring! ! !ORCmdRenameInstVarRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: (OBInstanceVariableNode on: 'firstInstanceVariableB' inClass: BogusB) interactions: { OBTextRequest. 'zork' } , self browserRequestInteraction. self assert: ((self classFor: #BogusB) instanceVariableNames includes: 'zork'). self assert: (self parseTree: 'accessesIvar' asSymbol for: #BogusB) = (RBParser parseMethod: 'accessesIvar ^ zork')! ! ORCmdRefactoringTest subclass: #ORCmdMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdMethodRefactoringTest subclass: #ORCmdAddParameterMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdAddParameterMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdAddParameterMethodRefactoring! ! !ORCmdAddParameterMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:48'! methodThatNeedsParameter ^ true! ! !ORCmdAddParameterMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:48'! methodThatSendsMethod self methodThatNeedsParameter! ! !ORCmdAddParameterMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 09:51'! testRefactoring01 self refactoringFor: (OBMethodNode on: #methodThatNeedsParameter inClass: self class) interactions: { OBMultiLineTextRequest. 'methodThatNeedsParameter:'. OBMultiLineTextRequest. 'false' } , self browserRequestInteraction. self assert: (self parseTree: #methodThatNeedsParameter: for: self class) = (RBParser parseMethod: 'methodThatNeedsParameter: anObject ^ true'). self assert: (self parseTree: #methodThatSendsMethod for: self class) = (RBParser parseMethod: 'methodThatSendsMethod self methodThatNeedsParameter: false'). self assert: (self parseTree: #methodThatNeedsParameter for: self class) isNil! ! ORCmdMethodRefactoringTest subclass: #ORCmdInlineParameterRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineParameterRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineParameterRefactoring! ! !ORCmdInlineParameterRefactoringTest methodsFor: 'support' stamp: 'lr 1/18/2010 19:14'! messageThatSendsParameter self messageToInlineParameter: 123! ! !ORCmdInlineParameterRefactoringTest methodsFor: 'support' stamp: 'lr 1/18/2010 19:26'! messageToInlineParameter: anInteger ^ anInteger negated! ! !ORCmdInlineParameterRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:12'! testRefactoring01 self refactoringFor: (OBMethodNode on: #messageToInlineParameter: inClass: self class) interactions: self browserRequestInteraction. self assert: (self parseTree: #messageToInlineParameter: for: self class) isNil. self assert: (self parseTree: #messageToInlineParameter for: self class) = (RBParser parseMethod: 'messageToInlineParameter | anInteger | anInteger := 123. ^ anInteger negated'). self assert: (self parseTree: #messageThatSendsParameter for: self class) = (RBParser parseMethod: 'messageThatSendsParameter self messageToInlineParameter')! ! ORCmdMethodRefactoringTest subclass: #ORCmdInlineSelfSendsMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineSelfSendsMethodRefactoring! ! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:52'! methodThatSendsToTheReceiver self methodThatWillBeInlined! ! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:55'! methodThatWillBeInlined ^ 1 + 2! ! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'support' stamp: 'lr 2/7/2010 09:54'! otherMethodThatSendsToTheReceiver ^ self methodThatWillBeInlined - 1! ! !ORCmdInlineSelfSendsMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/7/2010 09:55'! testRefactoring01 self refactoringFor: (OBMethodNode on: #methodThatWillBeInlined inClass: self class) interactions: self browserRequestInteraction. self assert: (self parseTree: #methodThatSendsToTheReceiver for: self class) = (RBParser parseMethod: 'methodThatSendsToTheReceiver 1 + 2'). self assert: (self parseTree: #otherMethodThatSendsToTheReceiver for: self class) = (RBParser parseMethod: 'otherMethodThatSendsToTheReceiver ^ 1 + 2 - 1')! ! !ORCmdMethodRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:27'! isAbstract ^ self name = #ORCmdMethodRefactoringTest! ! ORCmdMethodRefactoringTest subclass: #ORCmdMoveMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdMoveMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdMoveMethodRefactoring! ! ORCmdMethodRefactoringTest subclass: #ORCmdPushDownMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPushDownMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPushDownMethodRefactoring! ! ORCmdMethodRefactoringTest subclass: #ORCmdPushUpMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdPushUpMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdPushUpMethodRefactoring! ! ORCmdMethodRefactoringTest subclass: #ORCmdRemoveMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveMethodRefactoringTest methodsFor: 'support' stamp: 'lr 1/17/2010 15:42'! bogusSelectorThatIsHopefullyNotReferencedAnywhere! ! !ORCmdRemoveMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveMethodRefactoring! ! !ORCmdRemoveMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:13'! testRefactoring01 | selector | selector := ('bogusSelectorThatIs' , 'HopefullyNotReferencedAnywhere') asSymbol. self refactoringFor: (OBMethodNode on: selector inClass: self class) interactions: self browserRequestInteraction. self assert: (self parseTree: selector for: self class name) isNil! ! !ORCmdRemoveMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:16'! testRefactoring02 self refactoringFor: (OBMethodNode on: #one inClass: BogusA) interactions: { OBConfirmationRequest. true. OBBrowseRequest. [ :request | self assert: (request browser isKindOf: ORMethodBrowser) ] }! ! ORCmdMethodRefactoringTest subclass: #ORCmdRemoveParameterRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRemoveParameterRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRemoveParameterRefactoring! ! !ORCmdRemoveParameterRefactoringTest methodsFor: 'refactoring' stamp: 'lr 1/17/2010 15:44'! somethingThatSends ^ self somethingWithParameter: 5! ! !ORCmdRemoveParameterRefactoringTest methodsFor: 'refactoring' stamp: 'lr 1/17/2010 15:44'! somethingWithParameter: anObject ^ 2! ! !ORCmdRemoveParameterRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:13'! testRefactoring01 self refactoringFor: (OBMethodNode on: #somethingWithParameter: inClass: self class) interactions: self browserRequestInteraction. self assert: (self parseTree: #somethingWithParameter: for: self class name) isNil. self assert: (self parseTree: #somethingWithParameter for: self class name) = (RBParser parseMethod: 'somethingWithParameter ^ 2'). self assert: (self parseTree: #somethingThatSends for: self class name) = (RBParser parseMethod: 'somethingThatSends ^ self somethingWithParameter').! ! ORCmdMethodRefactoringTest subclass: #ORCmdRenameMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameMethodRefactoring! ! !ORCmdRenameMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:16'! testRefactoring01 self refactoringFor: (OBMethodNode on: #bogusOtherUniqueSelector inClass: BogusA) interactions: { OBMultiLineTextRequest. 'bogusSelectorNewName' } , self browserRequestInteraction. self assert: (self parseTree: #bogusOtherUniqueSelector for: #BogusA) isNil. self assert: (self parseTree: #bogusSelectorNewName for: #BogusA) = (RBParser parseMethod: 'bogusSelectorNewName ^ self'). self assert: (self parseTree: #bogusHopefullyUniqueSelector for: #BogusA) = (RBParser parseMethod: 'bogusHopefullyUniqueSelector self bogusSelectorNewName').! ! ORCmdMethodRefactoringTest subclass: #ORCmdSwapMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdSwapMethodRefactoringTest class methodsFor: 'support' stamp: 'lr 1/17/2010 15:49'! classSideMethod ^ #classSide! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdSwapMethodRefactoring! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'support' stamp: 'lr 1/17/2010 15:51'! instanceSideMethod ^ #instanceSide! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'running' stamp: 'lr 2/6/2010 16:18'! setUp super setUp. node := OBMethodNode on: #one inClass: BogusA! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:19'! testLabel node := OBMethodNode on: #one inClass: BogusA. self assert: self command label = 'move to class side'. node := OBMethodNode on: #one inClass: BogusA class. self assert: self command label = 'move to instance side'! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:13'! testRefactoring01 self refactoringFor: (OBMethodNode on: #classSideMethod inClass: self class class) interactions: self browserRequestInteraction. self assert: (self parseTree: #classSideMethod for: self class class name) isNil. self assert: (self parseTree: #classSideMethod for: self class name) = (RBParser parseMethod: 'classSideMethod ^ #classSide')! ! !ORCmdSwapMethodRefactoringTest methodsFor: 'testing' stamp: 'lr 2/6/2010 16:13'! testRefactoring02 self refactoringFor: (OBMethodNode on: #instanceSideMethod inClass: self class) interactions: self browserRequestInteraction. self assert: (self parseTree: #instanceSideMethod for: self class class name) = (RBParser parseMethod: 'instanceSideMethod ^ #instanceSide'). self assert: (self parseTree: #instanceSideMethod for: self class name) isNil ! ! !ORCmdRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:26'! isAbstract ^ self name = #ORCmdRefactoringTest! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 1/17/2010 10:33'! browser ^ self! ! !ORCmdRefactoringTest methodsFor: 'utilities' stamp: 'lr 2/6/2010 16:12'! browserRequestInteraction ^ Array with: OBBrowseRequest with: [ :request | self assert: (request browser isKindOf: ORChangesBrowser). self assert: (request browser root change = self change) ]! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 1/21/2010 15:37'! change ^ self model changes! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 1/21/2010 15:37'! changes ^ self change changes! ! !ORCmdRefactoringTest methodsFor: 'accessing-model' stamp: 'lr 1/18/2010 19:23'! classFor: aSymbolOrBehavior ^ self model classNamed: (aSymbolOrBehavior isBehavior ifFalse: [ aSymbolOrBehavior asSymbol ] ifTrue: [ aSymbolOrBehavior name ])! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 1/17/2010 10:37'! command ^ self factory on: self currentOrRootNode for: self browser! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 1/17/2010 10:36'! currentOrRootNode ^ node! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 1/21/2010 15:08'! environment ^ BrowserEnvironment new! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 1/18/2010 19:33'! factory self subclassResponsibility! ! !ORCmdRefactoringTest methodsFor: 'emulating' stamp: 'lr 1/17/2010 14:25'! isSelected: aNode ^ node = aNode! ! !ORCmdRefactoringTest methodsFor: 'accessing' stamp: 'lr 1/21/2010 08:44'! model "Answer the smalltalk model." ^ model! ! !ORCmdRefactoringTest methodsFor: 'accessing-model' stamp: 'lr 1/21/2010 16:04'! parseTree: aSelector for: aSymbolOrBehavior | class method | class := self classFor: aSymbolOrBehavior. class ifNil: [ ^ nil ]. method := class methodFor: aSelector. method ifNil: [ ^ nil ]. ^ method parseTree! ! !ORCmdRefactoringTest methodsFor: 'utilities' stamp: 'lr 1/17/2010 10:47'! refactoringFor: aNode ^ self refactoringFor: aNode interactions: #()! ! !ORCmdRefactoringTest methodsFor: 'utilities' stamp: 'lr 2/6/2010 16:03'! refactoringFor: aNode interactions: anArray | command | node := aNode. command := self command. command model: self model. self assert: command isActive description: command printString , ' is not active'. self assert: command isEnabled description: command printString , ' is not enabled'. self interactions: anArray do: [ command execute ]! ! !ORCmdRefactoringTest methodsFor: 'running' stamp: 'lr 1/21/2010 15:23'! runCase | prompt | prompt := ORCommand promptOnRefactoring. ORCommand promptOnRefactoring: true. [ super runCase ] ensure: [ ORCommand promptOnRefactoring: prompt ]! ! !ORCmdRefactoringTest methodsFor: 'running' stamp: 'lr 1/21/2010 08:51'! setUp super setUp. model := RBNamespace new! ! !ORCmdRefactoringTest methodsFor: 'testing' stamp: 'lr 1/21/2010 08:47'! testModel self assert: (self command model notNil). self assert: (self command description includesSubString: self command label)! ! ORCmdRefactoringTest subclass: #ORCmdSourceRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! ORCmdSourceRefactoringTest subclass: #ORCmdExtractMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdExtractMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdExtractMethodRefactoring! ! ORCmdSourceRefactoringTest subclass: #ORCmdExtractMethodToComponentRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdExtractMethodToComponentRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdExtractMethodToComponentRefactoring! ! ORCmdSourceRefactoringTest subclass: #ORCmdExtractToTemporaryRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdExtractToTemporaryRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdExtractToTemporaryRefactoring! ! ORCmdSourceRefactoringTest subclass: #ORCmdInlineMethodFromComponentRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineMethodFromComponentRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineMethodFromComponentRefactoring! ! ORCmdSourceRefactoringTest subclass: #ORCmdInlineMethodRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineMethodRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineMethodRefactoring! ! ORCmdSourceRefactoringTest subclass: #ORCmdInlineTemporaryRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdInlineTemporaryRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdInlineTemporaryRefactoring! ! ORCmdSourceRefactoringTest subclass: #ORCmdMoveVariableDefinitionRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdMoveVariableDefinitionRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdMoveVariableDefinitionRefactoring! ! ORCmdSourceRefactoringTest subclass: #ORCmdRenameTemporaryRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdRenameTemporaryRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdRenameTemporaryRefactoring! ! !ORCmdSourceRefactoringTest class methodsFor: 'testing' stamp: 'lr 12/28/2009 21:28'! isAbstract ^ self name = #ORCmdSourceRefactoringTest! ! ORCmdSourceRefactoringTest subclass: #ORCmdTemporaryToInstvarRefactoringTest instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-Tests-Refactory-Refactoring'! !ORCmdTemporaryToInstvarRefactoringTest methodsFor: 'accessing' stamp: 'lr 12/28/2009 21:21'! factory ^ ORCmdTemporaryToInstvarRefactoring! !