Coverage Report - biz.xsoftware.examples.socket.SysUnderTest
 
Classes in this File Line Coverage Branch Coverage Complexity
SysUnderTest
90%
9/10
N/A
1.5
 
 1  
 /*
 2  
  * Created on Jul 3, 2004
 3  
  *
 4  
  * To change the template for this generated file go to
 5  
  * Window - Preferences - Java - Code Generation - Code and Comments
 6  
  */
 7  
 package biz.xsoftware.examples.socket;
 8  
 
 9  
 import java.io.IOException;
 10  
 import java.nio.ByteBuffer;
 11  
 
 12  
 /**
 13  
  * SysUnderTest that uses TCPSockets to talk to a server.
 14  
  * 
 15  
  * @author Dean Hiller
 16  
  */
 17  
 public class SysUnderTest {
 18  
 
 19  
         private TCPSocket s;
 20  
         private OtherSubsystem userService;
 21  
 
 22  
         /**
 23  
          * @showcode
 24  
          */
 25  1
         public SysUnderTest(TCPSocket s, OtherSubsystem userSvc) {
 26  1
                 this.s = s;
 27  1
                 this.userService = userSvc;
 28  1
         }
 29  
 
 30  
         /**
 31  
          * @showcode
 32  
          */
 33  
         public void sendUserToServer(int id) {
 34  1
                 ByteBuffer userData = userService.getUserData(id);
 35  
 
 36  
                 try {
 37  1
                         s.write(userData);
 38  1
                 } catch(IOException e) {
 39  1
                         userService.failedToSendUser(id);
 40  0
                 }
 41  1
         }
 42  
 }