Created
August 12, 2011 02:21
-
-
Save coderunner/1141302 to your computer and use it in GitHub Desktop.
Revisions
-
coderunner revised this gist
Feb 23, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ public class ExampleClass { private final DependencyInterface dependency; //no dependency injection public ExampleClass() { //this makes the class hard to test this.dependency = new Dependency(); //... } -
coderunner revised this gist
Aug 12, 2011 . 1 changed file with 26 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,31 +1,31 @@ public class ExampleClass { private DependencyInterface dependency; //no dependency injection public ExampleClass() { //this makes the class hard to test dependency = new Dependency(); //... } //inject the concrete dependency public ExampleClass(Dependency dependency) { //this makes the class slightly more testable //if proper test tools are used because //the dependency can be setup or mocked this.dependency = dependency; //... } //inject the interface public ExampleClass(DependencyInterface dependency) { //this makes the class easily testable as a test //implementation can be supplied this.dependency = dependency; //... } } -
coderunner created this gist
Aug 12, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ public class ExampleClass { private DependencyInterface dependency; //no dependency injection public ExampleClass() { //this makes the class hard to test dependency = new Dependency(); //... } //inject the concrete dependency public ExampleClass(Dependency dependency) { //this makes the class slightly more testable //if proper test tools are used because //the dependency can be setup or mocked this.dependency = dependency; //... } //inject the interface public ExampleClass(DependencyInterface dependency) { //this makes the class easily testable as a test //implementation can be supplied this.dependency = dependency; //... } }