• Post Reply Bookmark Topic Watch Topic
  • New Topic

create a test class (main method) to start(run) the class in Java  RSS feed

 
Mike Stealth
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe I do not understand something.
So I've created the class in Java, which does some stuff.I need to create a main method or mainClass, that will start(run) my class. (I do not mean JUnit).
Question: how to do it?
is there some sort of methodology?
described in the books somewhere?

Help me please
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the Java tutorials? The very first "Getting started" tutorial shows you how to write a simple main method. Or is that not what you're looking for?
 
Mike Stealth
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No,I mean some complicated class,which for example receives object from other class and does many things
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, like this?
 
Mike Stealth
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and something like this?



though some ideas.in this class I use other classes,which aren't finished now,so I nees to run my class independently without these classes

 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe some background on what your program is trying to accomplish, what you intend to do with TextHandler and what's giving you problems in using it from your main class?
 
Mike Stealth
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a mistake in the previous code.So we have a task to create a simple server which receives requests with GET and POST methods.then there are Request,RequesBuilder,Response,ResponseBuilder.TextHandler has to check if it can handle request , read the file from web-root and then with the help of ResponseBuilder build response.The problem is that I don't know:how to run(start) the class and to see if it works correctly.and without help of Junit.just with MainClass.?



 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!