SampleMIDlet Coverage Report

Metrics: CCN: 1.4 Methods: 5
NCSS: 4.6 Classes: -
JVDC: 20% Packages: -
Need help?
Package # Classes Line Coverage Branch Coverage Method Coverage
org.cobertura4j2me.sample 4
86.7% 
100% 
87.5% 

Class Line Coverage Branch Coverage Method Coverage
SomeClass
81.8% 
100% 
80% 

 1  
 /*
 2  
  * Cobertura for J2ME - http://www.coberura4j2me.org
 3  
  *
 4  
  * Copyright (C) 2005, 2007 Ludovic Dewailly <ludovic.dewailly@cobertura4j2me.org>
 5  
  *
 6  
  * Cobertura for J2ME is free software; you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published
 8  
  * by the Free Software Foundation; either version 2 of the License,
 9  
  * or (at your option) any later version.
 10  
  *
 11  
  * Cobertura for J2ME is distributed in the hope that it will be useful, but
 12  
  * WITHOUT ANY WARRANTY; without even the implied warranty of
 13  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 14  
  * General Public License for more details.
 15  
  *
 16  
  * You should have received a copy of the GNU General Public License
 17  
  * along with Cobertura; if not, write to the Free Software
 18  
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 19  
  * USA
 20  
  */
 21  
 package org.cobertura4j2me.sample;
 22  
 
 23  
 import javax.microedition.lcdui.Form;
 24  
 
 25  6
 public class SomeClass implements SampleInterface {
 26  
 
 27  
         private boolean done;
 28  
         private Form form;
 29  
         
 30  
         
 31  
         /**
 32  
          * Creates a new SomeClass instance
 33  
          * 
 34  
          * @param form
 35  
          */
 36  1
         public SomeClass(Form form) {
 37  1
                 this.form = form;
 38  1
         }
 39  
         
 40  
         /* (non-Javadoc)
 41  
          * @see org.cobertura4j2me.sample.SampleInterface#doSomething()
 42  
          */
 43  
         public void doSomething() {
 44  1
                 done = false;
 45  1
                 new Thread(new Runnable() {
 46  
                         /* (non-Javadoc)
 47  
                          * @see java.lang.Runnable#run()
 48  
                          */
 49  
                         public void run() {
 50  
                                 for (int i = 0; i < 5; i++) {
 51  
                                         form.append("\ndoing something...");
 52  
                                         try {
 53  
                                                 Thread.sleep(1000);
 54  
                                         }
 55  
                                         catch (InterruptedException e) {
 56  
                                                 // TODO Auto-generated catch block
 57  
                                         }
 58  
                                 }
 59  
                                 synchronized (SomeClass.this) {
 60  
                                         done = true;
 61  
                                 }
 62  
                         }
 63  
                 }).start();
 64  1
         }
 65  
 
 66  
         /* (non-Javadoc)
 67  
          * @see org.cobertura4j2me.sample.SampleInterface#doNothing()
 68  
          */
 69  
         public void doNothing() {
 70  
                 // nothing to do
 71  0
         }
 72  
 
 73  
         /* (non-Javadoc)
 74  
          * @see org.cobertura4j2me.sample.SampleInterface#isItDone()
 75  
          */
 76  
         public boolean isItDone() {
 77  11
                 synchronized (this) {
 78  11
                         return done;
 79  0
                 }
 80  
         }
 81  
 }

Legend:
Instrumented line CCN: Cyclomatic Complexity
Covered line NCSS: Non-Commenting Source Statement
Uncovered line JVDC: JaVaDoc Comment