tests for CustomUpdateTestCaseCategoryRefactoring
authorJakub Nesveda <jakubnesveda@seznam.cz>
Sun, 09 Nov 2014 00:12:01 +0100
changeset 735 50e2617adbb0
parent 734 f8b10fc1ab0e
child 736 cbb808f1f9ff
tests for CustomUpdateTestCaseCategoryRefactoring
CustomUpdateTestCaseCategoryRefactoringTests.st
abbrev.stc
jn_refactoring_custom.st
patches/patches.rc
refactoring_custom.rc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CustomUpdateTestCaseCategoryRefactoringTests.st	Sun Nov 09 00:12:01 2014 +0100
@@ -0,0 +1,181 @@
+"{ Package: 'jn:refactoring_custom' }"
+
+CustomCodeGeneratorOrRefactoringTestCase subclass:#CustomUpdateTestCaseCategoryRefactoringTests
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Refactoring-Custom-Refactorings-Tests'
+!
+
+!CustomUpdateTestCaseCategoryRefactoringTests methodsFor:'accessing'!
+
+generatorOrRefactoring
+    ^ CustomUpdateTestCaseCategoryRefactoring new
+! !
+
+!CustomUpdateTestCaseCategoryRefactoringTests methodsFor:'tests'!
+
+test_available_for_class_fake_test
+
+    |class|
+
+    class := model createClassImmediate: #Dummy01Tests.  
+
+    self deny: (generatorOrRefactoring class availableForClass: class).
+
+    "Created: / 08-11-2014 / 23:40:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_available_for_class_object
+    
+    self deny: (generatorOrRefactoring class availableForClass: Object).
+
+    "Created: / 08-11-2014 / 23:40:01 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_available_for_class_test_case
+    
+    self assert: (generatorOrRefactoring class availableForClass: self class).
+
+    "Modified: / 08-11-2014 / 23:39:22 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_available_in_context_empty
+    
+    self deny: (generatorOrRefactoring class availableInContext: context).
+
+    "Modified: / 08-11-2014 / 23:42:19 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_available_in_context_with_test_class
+
+    context selectedClasses: (Array with: Object with: self class).  
+
+    self assert: (generatorOrRefactoring class availableInContext: context).
+
+    "Created: / 08-11-2014 / 23:43:29 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_available_in_context_without_test_class
+
+    context selectedClasses: (Array with: Object).  
+
+    self deny: (generatorOrRefactoring class availableInContext: context).
+
+    "Created: / 08-11-2014 / 23:44:03 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_available_in_perspective
+    
+    self assert: (generatorOrRefactoring class availableInPerspective: CustomPerspective classPerspective).
+
+    "Modified: / 08-11-2014 / 23:45:17 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_category_updated_model_classes
+    | expectedCategory actualCategory class testClass |
+
+    class := model createClass
+        name: #DummyClass01;
+        category: #Category01;
+        compile;
+        yourself.
+
+    testClass := model createClass
+        name: #DummyClass01Tests;
+        superclassName: #TestCase;
+        category: #Category02;
+        compile;
+        yourself.  
+
+    expectedCategory := #'Category01-Tests'.
+
+    context selectedClasses: (Array with: testClass).  
+
+    generatorOrRefactoring executeInContext: context.
+
+    actualCategory := testClass category.
+
+    self assert: expectedCategory = actualCategory
+
+    "Created: / 08-11-2014 / 23:57:26 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_category_updated_model_classes_category_ok
+    | expectedCategory actualCategory class testClass |
+
+    class := model createClass
+        name: #DummyClass01;
+        category: #Category01;
+        compile;
+        yourself.
+
+    testClass := model createClass
+        name: #DummyClass01Tests;
+        superclassName: #TestCase;
+        category: #'Category01-Tests';
+        compile;
+        yourself.  
+
+    expectedCategory := #'Category01-Tests'.
+
+    context selectedClasses: (Array with: testClass).  
+
+    generatorOrRefactoring executeInContext: context.
+
+    actualCategory := testClass category.
+
+    self assert: expectedCategory = actualCategory
+
+    "Created: / 08-11-2014 / 23:58:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_category_updated_model_classes_wrong_suffix
+    | expectedCategory actualCategory class testClass |
+
+    class := model createClass
+        name: #DummyClass01;
+        category: #Category01;
+        compile;
+        yourself.
+
+    testClass := model createClass
+        name: #DummyClass01Tested;
+        superclassName: #TestCase;
+        category: #Category01;
+        compile;
+        yourself.  
+
+    expectedCategory := #Category01.
+
+    context selectedClasses: (Array with: testClass).  
+
+    generatorOrRefactoring executeInContext: context.
+
+    actualCategory := testClass category.
+
+    self assert: expectedCategory = actualCategory
+
+    "Created: / 09-11-2014 / 00:01:04 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_category_updated_real_classes
+    | expectedCategory actualCategory class testClass |
+
+    class := model createClassImmediate: #DummyClass01 category: #Category01.
+    testClass := model createClassImmediate: #DummyClass01Tests superClassName: #TestCase.
+    testClass category: #Category02.  
+
+    expectedCategory := #'Category01-Tests'.
+
+    context selectedClasses: (Array with: testClass).  
+
+    generatorOrRefactoring executeInContext: context.
+
+    actualCategory := testClass category.
+
+    self assert: expectedCategory = actualCategory
+
+    "Created: / 08-11-2014 / 23:53:04 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
--- a/abbrev.stc	Sat Nov 08 23:35:46 2014 +0100
+++ b/abbrev.stc	Sun Nov 09 00:12:01 2014 +0100
@@ -68,6 +68,7 @@
 CustomSubclassResponsibilityCodeGeneratorTests CustomSubclassResponsibilityCodeGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Generators-Tests' 1
 CustomTestCaseCodeGeneratorTests CustomTestCaseCodeGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Generators-Tests' 1
 CustomTestCaseMethodCodeGeneratorTests CustomTestCaseMethodCodeGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Generators-Tests' 1
+CustomUpdateTestCaseCategoryRefactoringTests CustomUpdateTestCaseCategoryRefactoringTests jn:refactoring_custom 'Interface-Refactoring-Custom-Refactorings-Tests' 1
 CustomUserDialog CustomUserDialog jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomValueHolderAccessMethodsCodeGeneratorTests CustomValueHolderAccessMethodsCodeGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Generators-Tests' 1
 CustomValueHolderGetterMethodsCodeGeneratorTests CustomValueHolderGetterMethodsCodeGeneratorTests jn:refactoring_custom 'Interface-Refactoring-Custom-Generators-Tests' 1
--- a/jn_refactoring_custom.st	Sat Nov 08 23:35:46 2014 +0100
+++ b/jn_refactoring_custom.st	Sun Nov 09 00:12:01 2014 +0100
@@ -161,6 +161,7 @@
         (CustomSubclassResponsibilityCodeGeneratorTests autoload)
         (CustomTestCaseCodeGeneratorTests autoload)
         (CustomTestCaseMethodCodeGeneratorTests autoload)
+        (CustomUpdateTestCaseCategoryRefactoringTests autoload)
         CustomUserDialog
         (CustomValueHolderAccessMethodsCodeGeneratorTests autoload)
         (CustomValueHolderGetterMethodsCodeGeneratorTests autoload)
--- a/patches/patches.rc	Sat Nov 08 23:35:46 2014 +0100
+++ b/patches/patches.rc	Sun Nov 09 00:12:01 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "LibraryName\0"
       VALUE "ProductVersion", "6.2.4.1420\0"
-      VALUE "ProductDate", "Sat, 08 Nov 2014 22:34:37 GMT\0"
+      VALUE "ProductDate", "Sat, 08 Nov 2014 23:11:17 GMT\0"
     END
 
   END
--- a/refactoring_custom.rc	Sat Nov 08 23:35:46 2014 +0100
+++ b/refactoring_custom.rc	Sun Nov 09 00:12:01 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "ProductName\0"
       VALUE "ProductVersion", "6.2.4.1420\0"
-      VALUE "ProductDate", "Sat, 08 Nov 2014 22:34:34 GMT\0"
+      VALUE "ProductDate", "Sat, 08 Nov 2014 23:11:14 GMT\0"
     END
 
   END