Next, we move the methods that directly call the system code into their own class, named XTrackDirectInterface, as shown in Listing 23.2. Listing 23.2 XTrackDirectInterface.javaimport xtrack.*; public class XTrackDirectInterface extends XTrackTestInterface { public boolean login( String id,String psw) { XTrackSession session = new XTrackSession(); return session.login(id,psw); } public boolean createUserId( String id, String psw, String email) { XTrackUser user = new XTrackUser(); return user.create(id,psw,email); } public boolean deleteUserId( String id) { XTrackUser user = new XTrackUser(id); return user.delete(); } } The bold text indicates what's new here, which isn't much. We're just wrapping a class around the methods we wrote to call the XTrack system code: you should recognize them as the code currently in XTrackTest. In fact, that's where we get it we just copy the code from XTrackTest and paste it right into XrackDirectTestInterface. Note also the import xtrack.*; statement. We need this here because we're calling the XTrack system code in this class. |