Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • How do you test #1? In other words, what do you for testing services without real DB access? If you can't, then Yes, you are tightly coupled to TestAcceessor.Instance Commented Apr 1, 2019 at 18:19
  • How do you instanciate Services in #2? Commented Apr 1, 2019 at 18:23
  • @Laiv thanks for the comment regarding #1. Actually we need our db instance to be running to test the #1 i.e. our service classes. Commented Apr 1, 2019 at 18:46
  • @Laiv our services are stateless. They only implement functions. This is done to avoid multithreading related issues. So we can directly access our services using ServiceName.methodName(). Commented Apr 1, 2019 at 18:47
  • 1
    If you can replace/change the DAO instance without having to change the service (any time), yes. Note that the DI is highly recommended to make the solution more testable. The more testable the better. Solutions should be first testable and then everything else (IMO). Commented Apr 1, 2019 at 19:09