1 29 30 package net.sourceforge.groboutils.autodoc.v1; 31 32 import org.apache.log4j.Logger; 33 34 import junit.framework.Assert; 35 36 import net.sourceforge.groboutils.autodoc.v1.spi.*; 37 38 39 48 public class MockAutoDoc extends AutoDoc 49 { 50 private static final Logger LOG = Logger.getLogger( MockAutoDoc.class ); 51 52 private AutoDocFactory factory; 53 private int getFactoryCallCount = 0; 54 55 public MockAutoDoc( Class c, AutoDocFactory f ) 56 { 57 super( c ); 58 mockSetupFactory( f ); 59 } 60 61 62 65 protected AutoDocFactory getFactory() 66 { 67 ++this.getFactoryCallCount; 68 return this.factory; 69 } 70 71 72 75 public void mockSetupFactory( AutoDocFactory f ) 76 { 77 this.factory = f; 78 } 79 80 81 84 public int mockGetFactoryCallCount() 85 { 86 return this.getFactoryCallCount; 87 } 88 89 90 93 public void mockVerify() 94 { 95 Assert.assertEquals( 96 "Did not match the expected getFactory() call count.", 97 1, 98 mockGetFactoryCallCount() ); 99 } 100 } 101 102 | Popular Tags |