File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data.class constructor requirements

 
Layne Wakerell
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Data.class needs to implement the DB interface. Does this mean the Data.class can have any constructor you like? e.g.

DB database = new Data("filename.db");

or

DB database = new Data(new File("filename.db"));

or even

DB database = new Data();//where the database file is hardcoded in the Data.class

How will the automated test tool create an instance of our Data.class???
 
Gennadi Oreper
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I have two constructors coded:

Data():
call anyInitDb(dataSource) with dataSource as String from property file || hard coded, also default db file
AND
Constructor with the path to the data file Data(String dataSource) call the same anyInitDb(dataSource)...

Best regards...
 
Mark Smyth
Ranch Hand
Posts: 288
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Layne Wakerell:
The Data.class needs to implement the DB interface. Does this mean the Data.class can have any constructor you like? e.g.

DB database = new Data("filename.db");

or

DB database = new Data(new File("filename.db"));

or even

DB database = new Data();//where the database file is hardcoded in the Data.class

How will the automated test tool create an instance of our Data.class???


You can have as many or as few constructors as you like. And they can be in format you like too, which is nice.
[ July 07, 2007: Message edited by: Mark Smyth ]
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Layne,

Don't worry abut the test automate. The test automate will get (build) a Data instance and in a way or other.

Regards,
M
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic