redho home | products | services
Web Design Forums

Web Design Forums  


Web Hosting, Web Design, Software and Web Development Forums  
 FAQFAQ   MemberlistArchive  Log inLog in   RegisterRegister 
         

testcase and non test classes



 
Post new topic   Reply to topic    Web Design Forums -> JAVA programming forum
View previous topic :: View next topic  
Author Message
Kopilman



Joined: 25 May 2006
Posts: 162
I'm being prevented from unit testing the internals of my application because I like to make things package-private if they shouldn't be used outside the package. But then tests can't test them out
Is it bad to put testcase classes in the same package as the non test classes?
  Reply with quote


Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
That's one reason I believe private/public should be part of the documentation, and not part of the language semantics
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
Or am i doing something else wrong
Lusis Backwood JR, documentation doesn't force anything
I'd prefer an option to say, "only this package and this package can use it"
  Reply with quote
Poolkop



Joined: 01 Jun 2006
Posts: 123
I've seen the tests separated into a different source folder or project, but still in the same package as the classes they test ...
  Reply with quote
Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
Another good approach is taken by lisp, where unexported symbols can still be used in other packages, but using a different syntax
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
Poolkop, interesting
I looked at junit source
And they just have a bunch of methods/classes called internal
I think that's stupid and i'd prefer to avoid it
  Reply with quote
Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
Kopilman, why not just make the members public?
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
I don't know what the definition of a member is unless it's sexual
You talking about instance variables?
  Reply with quote
Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
Member of a class
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
Or the classes?
  Reply with quote
Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
Classes, methods, ivars, etc
  Reply with quote


Kopilman



Joined: 25 May 2006
Posts: 162
Because i don't want people using them
  Reply with quote
Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
Then tell people not to use them
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
Well i may end up having to
But i wish i didn't
I think Poolkop 's idea may be better
  Reply with quote
Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
Having the language enforce privacy is not really compatible with modern development practices
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
Maybe that's cause the development practices are wrong
If my package represents a module
I'd prefer a simple entry point into it
And it would be better if i could prevent people from shooting themselves in the foot
With a compilation error
  Reply with quote
Lusis Backwood JR



Joined: 26 May 2006
Posts: 87
Location: United States
I like systems where I can look at any object or call any piece of code interactively
But java doesn't support this style
  Reply with quote
Kopilman



Joined: 25 May 2006
Posts: 162
I don't know if i've used a language that has
  Reply with quote
Page 1 of 1
Post new topic   Reply to topic    Web Design Forums -> JAVA programming forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group