In this tutorial we learn how to use factory methods in Devmate UTST for mocking with a simple code example.
The class to test MockDemo has a field of the interface IDemo. We want to test the method MethodToTest which uses the method getInt of IDemo.
Without an implementation of IDemo we need to mock it. We start devmate normally and create an instance of MockDemo.


As an interface IDemo cannot be instantiated so we use a factory method instead(image createFactory) (useFactory)


When we are finished with creating the representants and tests, we can generate the code .

The code is generated without an implementation of the factory method and needs to be edited. We need to create a new mock object of type IDemo and tell it in the setup what it should return when the getInt method is called.

And done. The tests should now run as expected.
