Loading ...
Sorry, an error occurred while loading the content.

[XP] Re: How to you test private inner objects?

Expand Messages
  • Richard Austin
    ... PRIVATE inner objects are a problem. Typically, I have my test cases in the same package as the Class they test. I then create a protected accessor for
    Message 1 of 49 , Mar 2, 2000
    • 0 Attachment
      Jonathan Rasmusson wrote:

      > How do you test an objects private inner objects?

      PRIVATE inner objects are a problem. Typically, I have my test cases
      in the same package as the Class they test. I then create a protected accessor
      for things I want to test.

      You can always make sure that the test Classes are not exported when you
      make .jar files, and having them be able to access protected aspects of the
      class they want to test REALLY helps.

      Best,
      Richard Austin
      WebCriteria, Inc.
    • Dave Kirby
      jonathan rasmusson wrote: original article:http://www.egroups.com/group/extremeprogramming/?start =2690 [snip...] ... as ... I dont know if anyone else has
      Message 49 of 49 , Mar 6, 2000
      • 0 Attachment
        "jonathan rasmusson" wrote: original article:http://www.egroups.com/group/extremeprogramming/?start =2690 [snip...]
        > > To date the most pratical solution I have seen is : > > o make objects protected > o put test cases in same directory > > This seems to allow me to meet both of my afore mentioned goals. I am > compromising because I will make objects protected instead of private > and I am including my test cases in the same directory (which is not
        as
        > neat as having them in their own directory). For now I am willing to > live with this and see how it works.
        I dont know if anyone else has mentioned this, but in Java you dont need to have the test case in the same *directory*, just in the same *package*. You just need a separate directory tree for the test cases and an entry in the classpath pointing to it. It can be a bit of a pain maintaining two identical directory trees, but it does keep the test code and the application code physically separate so I believe the overall maintenance burden is reduced.Just my 0.02 euros worthDave K
      Your message has been successfully submitted and would be delivered to recipients shortly.