Clover coverage report - Maven Clover report
Coverage timestamp: Sun Mar 18 2007 17:42:32 CET
file stats: LOC: 85   Methods: 7
NCLOC: 64   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AnyOrderSection.java 100% 100% 100% 100%
coverage
 1    package com.agical.rmock.core.expectation.section;
 2   
 3    import java.util.Iterator;
 4    import java.util.LinkedList;
 5    import java.util.List;
 6   
 7    import com.agical.rmock.core.ExpectationVisitor;
 8    import com.agical.rmock.core.Section;
 9    import com.agical.rmock.core.Visitable;
 10   
 11    /**
 12    * <em>(c) Agical AB 2005</em>
 13    * @author joakim.ohlrogge
 14    *
 15   
 16    */
 17    public class AnyOrderSection implements Section {
 18    private List visitables = new LinkedList();
 19    private final String description;
 20   
 21  1795 public AnyOrderSection(String description ) {
 22  1795 this.description = description;
 23    }
 24   
 25    /**
 26    * @param visitable1
 27    */
 28  1856 public void add(Visitable visitable) {
 29  1856 visitables.add(visitable);
 30    }
 31   
 32  2049 public boolean accept(ExpectationVisitor visitableVisitor, boolean available) {
 33  2049 visitableVisitor.enteredSection( this );
 34  2049 int index = 0;
 35  2049 Iterator iterator = visitables.iterator();
 36  2049 while(iterator.hasNext()) {
 37  3438 Visitable visitable = (Visitable) iterator.next();
 38  3438 boolean accepted = visitable.accept(visitableVisitor, available );
 39  3438 if( !accepted ) {
 40  1941 return false;
 41    }
 42  1497 index++;
 43    }
 44  108 visitableVisitor.exitedSection();
 45  108 return true;
 46    }
 47   
 48  49 public boolean canMatch() {
 49  49 if( visitables.size() == 0 ) {
 50  1 return false;
 51    } else {
 52  48 for (Iterator iter = visitables.iterator(); iter.hasNext();) {
 53  68 Visitable visitable = (Visitable) iter.next();
 54  68 if( visitable.canMatch() ) {
 55  22 return true;
 56    }
 57    }
 58    }
 59  26 return false;
 60    }
 61   
 62  3240 public boolean isSatisfied() {
 63  3240 if( visitables.size() == 0 ) {
 64  1690 return true;
 65    } else {
 66  1550 for (Iterator iter = visitables.iterator(); iter.hasNext();) {
 67  3391 Visitable visitable = (Visitable) iter.next();
 68  3391 if( !visitable.isSatisfied() ) {
 69  3 return false;
 70    }
 71    }
 72    }
 73  1547 return true;
 74    }
 75   
 76  80 public String getDescription() {
 77  80 return description;
 78    }
 79   
 80  21 public String getType() {
 81  21 return "Unordered section";
 82    }
 83   
 84   
 85    }