java - Testing a class that implements an interface -


i have been set assignment java course involves creating basic phone directory. have come part involves testing of methods inside arrayphonedirectory class, class implements interface named phonedirectory.

i stuck on how instantiate arrayphonedirectory class within separate tester class, every attempt have made has been returned error cannot instantiated due being abstract class.

phonedirectory interface code:

public interface phonedirectory {  /**  * load file containing directory entries  *  * @param sourcename name of file containing directory entries  */ void loaddata(string sourcename);  /**  * entry.  *  * @param name name of person  * @return telno or null if name not in directory  */ string lookupentry(string name);  **code snipped** 

arrayphonedirectory code:

public abstract class arrayphonedirectory implements phonedirectory {  private static final int init_capacity = 100; private int capacity = init_capacity;  //holds telno of directory entries private int size = 0;  //array contain directory entries private directoryentry[] thedirectory = new directoryentry[capacity];  //holds name of data file read private string sourcename = null;  **code snipped** 

any instantiating arrayphonedirectory class appreciated, please comment if need add more of code, i'm still new this!

inside test create local class extends abstract class. need implement abstract methods. if not important logic inside abstract methods can leave them blank.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -