jDummySourceForge.net Logo

net.sf.jdummy.generator
Class DummyValueFactory

java.lang.Object
  extended by java.util.Random
      extended by net.sf.jdummy.generator.DummyValueFactory
All Implemented Interfaces:
java.io.Serializable

public class DummyValueFactory
extends java.util.Random

Factory for generating dummy data. To genearte a value for type T, will use the Generator set for T if one exists (see setGenerator(Class, Generator) and DefaultGeneratorBuilder.

If no explicit Generator exists for T, the factory will create a 'dummy', i.e., create a Mock of T, give it a dummy value generating default stub, and return the proxy.

DummyValueFactory inherits from Random. Tests that use random values should use a single instance of DummyValueFactory to generate all values. Unlike Random, the factory's seed is 0L by default. This makes tests using the factory repeatable: the same sequence value-creation requests will yield the same values.

Author:
Mark G. Mendel
See Also:
DummyValueGeneratingStubFactory, Serialized Form

Nested Class Summary
(package private) static class DummyValueFactory.CompatibleMockery
           
 
Constructor Summary
DummyValueFactory(Mockery mockery)
           
DummyValueFactory(VerifyingTestCase verifier)
          Deprecated.  
 
Method Summary
 java.lang.Object dummy(java.lang.Class type)
           
 java.lang.Object dummy(java.lang.Class type, java.lang.String name)
           
protected  DynamicMock dynamicMockForProxy(java.lang.Object dummy)
           
 Generator getGenerator(java.lang.Class type)
           
protected  java.lang.Object makeDummyArray(java.lang.Class arrayType, java.lang.String arrayName)
           
 Mock mockForProxy(java.lang.Object dummy)
           
 java.lang.Object newMockWithValueGeneratingStub(java.lang.Class type)
           
 java.lang.Object newMockWithValueGeneratingStub(java.lang.Class type, java.lang.String name)
           
 java.lang.String nextName(java.lang.String baseName)
          Returns the next unique name string of the form baseName, baseName-2, ...
 java.lang.String OLD_nextName(java.lang.String baseName)
          Returns the next unique name string of the form baseName-1, baseName-2, ...
 void setGenerator(java.lang.Class type, Generator generator)
           
 
Methods inherited from class java.util.Random
next, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyValueFactory

public DummyValueFactory(VerifyingTestCase verifier)
Deprecated. 


DummyValueFactory

public DummyValueFactory(Mockery mockery)
Method Detail

dummy

public java.lang.Object dummy(java.lang.Class type)

dummy

public java.lang.Object dummy(java.lang.Class type,
                              java.lang.String name)

mockForProxy

public Mock mockForProxy(java.lang.Object dummy)

dynamicMockForProxy

protected DynamicMock dynamicMockForProxy(java.lang.Object dummy)

setGenerator

public void setGenerator(java.lang.Class type,
                         Generator generator)

getGenerator

public Generator getGenerator(java.lang.Class type)

makeDummyArray

protected java.lang.Object makeDummyArray(java.lang.Class arrayType,
                                          java.lang.String arrayName)

newMockWithValueGeneratingStub

public java.lang.Object newMockWithValueGeneratingStub(java.lang.Class type)

newMockWithValueGeneratingStub

public java.lang.Object newMockWithValueGeneratingStub(java.lang.Class type,
                                                       java.lang.String name)

OLD_nextName

public java.lang.String OLD_nextName(java.lang.String baseName)
Returns the next unique name string of the form baseName-1, baseName-2, ...


nextName

public java.lang.String nextName(java.lang.String baseName)
Returns the next unique name string of the form baseName, baseName-2, ...


jDummySourceForge.net Logo

Copyright 2005-2005-2006 Mark G. Mendel. All Rights Reserved.