{"id":452,"date":"2011-06-05T00:19:00","date_gmt":"2011-06-05T00:19:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/android-dependency-injection-and-testing-libraries.html"},"modified":"2012-10-21T19:51:43","modified_gmt":"2012-10-21T19:51:43","slug":"android-dependency-injection-testing","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html","title":{"rendered":"Android Dependency Injection and Testing Libraries"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">Anything and everything that makes life easier to develop for Android  should be looked into. There are a couple of libraries that make  testing easier, increase the modularity of your code, and provide  already created mock objects: <\/p>\n<ol>\n<li><a href=\"http:\/\/code.google.com\/p\/roboguice\/\">RoboGuice<\/a>&nbsp;&#8211; This is an adaption of Google\u2019s dependency injection library but for Android<\/li>\n<li><a href=\"http:\/\/pivotal.github.com\/robolectric\/index.html\">Robolectric<\/a>&nbsp;-This is a testing framework\/platform which works to remove the need for  constant mocking of Android objects. &nbsp;It also works with RoboGuice.<\/li>\n<\/ol>\n<p>I can\u2019t begin to thank the guy that first introduced me to dependency  injection enough. Coming from a C++ world, where objects can\u2019t  describe themselves and there is no reflection unless the developer  purposefully implements it himself, to a more modern language I often  created my own static factories to simulate the @inject pattern. But  why reinvent the wheel each and every time if an object can describe  itself perfectly to the virtual machine?<\/p>\n<p>If you\u2019ve never seen Dependency Injection (DI) before look at the <a href=\"http:\/\/code.google.com\/p\/roboguice\/wiki\/SimpleExample?tm=6\">\u201csimple example\u201d<\/a>  RoboGuice provides on their webpage. At first glance it might seem  like a fancy way to clean up the code so that maintainers could focus on  just the specifics of the actions within each method. That is a side  benefit (a really nice one at that) but only a side benefit. The  example does not demonstrate the true power of such a framework in  testing and asserting bug-free code.<\/p>\n<h3>Without DI in your code base<\/h3>\n<p>Let\u2019s take a look at a contrived example of what sort of pain points  DI can help&nbsp;conquer&nbsp;and alleviate. Suppose that I have a method which  needs some sort of widget that takes user input. How can I test such a  method without requiring someone to step through a script (as in written  instructions) wherein they manually enter all the different  combinations which could result in a real world scenario? That\u2019s  expensive and time consuming. I\u2019m not even going to mention the human  factor for mistakes (like skipping a test by accident). Oops, I just  did (see? So easy to make mistakes!)<\/p>\n<p>If there was a way to instantiate mock constructs without having the  parent object\u2019s constructor &nbsp;grow to 20 arguments long I\u2019d love to jump  all over it. Thinking back to design patterns 101, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Factory_method_pattern\">factory objects<\/a>  provide a means for decoupling object creation logic from object  instantiation. Using a static factory object I could insert a test  version whenever I wanted. Take a look:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">public abstract class WidgetBase implements IWidget{\r\n   protected ISomeObject mSomeObject;\r\n\r\n   public WidgetBase(ISomeObject _obj){\r\n      mSomeObject = _obj;\r\n   }\r\n}\r\n\r\npublic AlertWidgetFactory{\r\n   static private WidgetBase mTest = null;\r\n   static private boolean mTestFlag = false;\r\n   static WidgetBase create(ISomeObject _obj){\r\n      if(mTestFlag){\r\n         return mTest;\r\n      }\r\n      return new AlertWidget(_obj);\r\n   }\r\n\r\n   static void setTest(WidgetBase _testWidget){\r\n      mTest = _testWidget;\r\n   }\r\n\r\n   static void setTestFlag(boolean _flag){\r\n      mTestFlag = _false;\r\n   }\r\n}\r\n<\/pre>\n<p>Now when I get down to testing my code I can automate everything.  During the \u201csetUp\u201d phase of my JUnit unit test I can substitute in some  mocked version of \u201cWidgetBase\u201d to return many possible user entries. See how easy to test it makes the following code:<\/p>\n<pre class=\"brush:java\">public void someMethod(String _value){\r\n    if(_value == \"\"){\r\n      ISomeObject foo = new SomeValueAssigner( _value );\r\n      IWidget alert = AlertWidgetFactory.create(foo);\r\n   }\r\n   \/\/more code...\r\n}\r\n<\/pre>\n<p>Of course, if I have a different class type I want to produce from a  factory, I\u2019m going to have to code up a factory just for that object.  &nbsp;(In C++ I\u2019d just template it and have but a single class for a factory. Sometimes templates are a <i>good<\/i> thing, no? Take that generics!).<\/p>\n<h3>With DI in your code<\/h3>\n<p>Some might be screaming at me for not using a plain interface instead  of an abstract class. There was a point to that. Interfaces can\u2019t  describe the constructor and I wanted my object to take parameters in  the constructor. But why?<\/p>\n<p>First have a closer look at the code above. Did you notice up above  that I\u2019ve got a hard-coded dependency in \u201cSomeValueAssigner?\u201d I\u2019m not  truly able to unit test the \u201csomeMethod\u201d function as I can\u2019t remove the  interdependencies without first creating a factory method for that too!  Oh the humanity. How many factory objects are we going to have to  create just to test a decently sized code base? Each time I want a new  object I\u2019ll potentially have to create for it an interface, abstract  base class and\/or a factory object. I might also need to add a new  method to the factory object for each different constructor it has.<\/p>\n<p>I don\u2019t need to say it but that\u2019s a lot of work. Actually it\u2019s too  much work even for the engineers at Google. &nbsp;This is why they came up  with <a href=\"http:\/\/code.google.com\/p\/google-guice\/\">Guice<\/a> in the  first place. DI solves a lot of headaches and saves on needing to  reinvent the wheel time after time with some limitations (see <a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/InjectionPoints\">InjectionPoints<\/a>  on constructor arguments). It isn\u2019t a replacement for your standard  design patterns and doesn\u2019t let you avoid passing arguments into a  constructor. RoboGuice is just another tool in your toolset (a very  powerful and handy tool).<\/p>\n<h3>Avoiding the Emulation Stage<\/h3>\n<p>Wouldn\u2019t you know it but testing UI components is hard work. Not  only do we need to look at the thing in the first place just to see if  all the shapes\/sizes\/colors are displaying correctly but we also need to  make sure it does what it\u2019s supposed to do. Then there\u2019s the waiting  period while the emulated Android device warms up. Quoting from  Robolectric\u2019s website:<\/p>\n<blockquote>\n<p>Running tests on an Android emulator or device is slow!  Building, deploying, and launching the app often takes a minute or more.  That\u2019s no way to do TDD. There must be a better way.<\/p>\n<\/blockquote>\n<p>I couldn\u2019t agree more. Waiting on the emulator to compile and load the application for a small, tiny fix is painful.<br \/>\nRobolectric lets you iterate faster. &nbsp;Iterating quickly leads to  better design. Better design leads to less&nbsp;maintenance&nbsp;problems. Less  maintenance problems leads to more time to add new features or refine  functionality. All these things lead to a better product experience for  the end user.<br \/>\nThat is tremendously beneficial to your bottom line. Even though  this section is very short it\u2019s nearly inversely proportional to the  amount of time it will save you.<\/p>\n<h3>Conclusions<\/h3>\n<p>RoboGuice let\u2019s you test more easily and adds another tool\/idiom to  help decouple your code. Robolectric let\u2019s you test faster. Put them  together and you get an environment where you are working more  efficiently and productively. These are two libraries you shouldn\u2019t be  without.<\/p>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/staticallytyped.wordpress.com\/2011\/06\/04\/android-libraries-you-should-be-using\/\">Android: Libraries you should be using<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> at the <a href=\"http:\/\/staticallytyped.wordpress.com\/\">Statically Typed blog<\/a>.<\/p>\n<div style=\"margin: 0px\"><strong><i>Related Articles :<\/i><\/strong><\/div>\n<ul>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2010\/10\/android-full-application-tutorial.html\">\u201cAndroid Full Application Tutorial\u201d series<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/01\/android-proximity-alerts-tutorial.html\">Android Proximity Alerts Tutorial<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2010\/09\/android-text-to-speech-application.html\">Android Text-To-Speech Application<\/a><\/li>\n<li><a href=\"http:\/\/www.javacodegeeks.com\/2011\/02\/android-google-maps-tutorial.html\">Android Google Maps Tutorial<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Anything and everything that makes life easier to develop for Android should be looked into. There are a couple of libraries that make testing easier, increase the modularity of your code, and provide already created mock objects: RoboGuice&nbsp;&#8211; This is an adaption of Google\u2019s dependency injection library but for Android Robolectric&nbsp;-This is a testing framework\/platform &hellip;<\/p>\n","protected":false},"author":30,"featured_media":46,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[83,124],"class_list":["post-452","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android-core","tag-android-tutorial","tag-dependency-injection"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Dependency Injection and Testing Libraries - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Anything and everything that makes life easier to develop for Android should be looked into. There are a couple of libraries that make testing easier,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Dependency Injection and Testing Libraries - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Anything and everything that makes life easier to develop for Android should be looked into. There are a couple of libraries that make testing easier,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2011-06-05T00:19:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-21T19:51:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Owein Reese\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Owein Reese\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html\"},\"author\":{\"name\":\"Owein Reese\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/1db86d87718c50d7119d8390de703395\"},\"headline\":\"Android Dependency Injection and Testing Libraries\",\"datePublished\":\"2011-06-05T00:19:00+00:00\",\"dateModified\":\"2012-10-21T19:51:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html\"},\"wordCount\":1076,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/android-logo.jpg\",\"keywords\":[\"Android Tutorial\",\"Dependency Injection\"],\"articleSection\":[\"Android Core\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html\",\"name\":\"Android Dependency Injection and Testing Libraries - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/android-logo.jpg\",\"datePublished\":\"2011-06-05T00:19:00+00:00\",\"dateModified\":\"2012-10-21T19:51:43+00:00\",\"description\":\"Anything and everything that makes life easier to develop for Android should be looked into. There are a couple of libraries that make testing easier,\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/android-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2011\\\/06\\\/android-dependency-injection-testing.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/android\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Android Core\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/android\\\/android-core\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Android Dependency Injection and Testing Libraries\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/1db86d87718c50d7119d8390de703395\",\"name\":\"Owein Reese\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/78d25aab97839b2cb04b03e54bf9f156abead8dd2272ef339976800ababda21e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/78d25aab97839b2cb04b03e54bf9f156abead8dd2272ef339976800ababda21e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/78d25aab97839b2cb04b03e54bf9f156abead8dd2272ef339976800ababda21e?s=96&d=mm&r=g\",\"caption\":\"Owein Reese\"},\"sameAs\":[\"http:\\\/\\\/staticallytyped.wordpress.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Owein-Reese\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Dependency Injection and Testing Libraries - Java Code Geeks","description":"Anything and everything that makes life easier to develop for Android should be looked into. There are a couple of libraries that make testing easier,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html","og_locale":"en_US","og_type":"article","og_title":"Android Dependency Injection and Testing Libraries - Java Code Geeks","og_description":"Anything and everything that makes life easier to develop for Android should be looked into. There are a couple of libraries that make testing easier,","og_url":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2011-06-05T00:19:00+00:00","article_modified_time":"2012-10-21T19:51:43+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","type":"image\/jpeg"}],"author":"Owein Reese","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Owein Reese","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html"},"author":{"name":"Owein Reese","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/1db86d87718c50d7119d8390de703395"},"headline":"Android Dependency Injection and Testing Libraries","datePublished":"2011-06-05T00:19:00+00:00","dateModified":"2012-10-21T19:51:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html"},"wordCount":1076,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","keywords":["Android Tutorial","Dependency Injection"],"articleSection":["Android Core"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html","url":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html","name":"Android Dependency Injection and Testing Libraries - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","datePublished":"2011-06-05T00:19:00+00:00","dateModified":"2012-10-21T19:51:43+00:00","description":"Anything and everything that makes life easier to develop for Android should be looked into. There are a couple of libraries that make testing easier,","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2011\/06\/android-dependency-injection-testing.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/www.javacodegeeks.com\/category\/android"},{"@type":"ListItem","position":3,"name":"Android Core","item":"https:\/\/www.javacodegeeks.com\/category\/android\/android-core"},{"@type":"ListItem","position":4,"name":"Android Dependency Injection and Testing Libraries"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/1db86d87718c50d7119d8390de703395","name":"Owein Reese","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/78d25aab97839b2cb04b03e54bf9f156abead8dd2272ef339976800ababda21e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/78d25aab97839b2cb04b03e54bf9f156abead8dd2272ef339976800ababda21e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/78d25aab97839b2cb04b03e54bf9f156abead8dd2272ef339976800ababda21e?s=96&d=mm&r=g","caption":"Owein Reese"},"sameAs":["http:\/\/staticallytyped.wordpress.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Owein-Reese"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=452"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/452\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/46"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}