This is a simple tutorial to show how DevMate works with generics
You can find the code relating to this tutorial on Github in the
Here is the simplest method we could come up with. Let us know if we can make it simpler!
Right click on the
isEqual()method name to generate a test with DevMate.
We’ll start out by instantiating
GenereicDemo (we didn't use a static class this time).
Create a valid representative (click the + icon and select
GenericDemofrom the initializer dropdown).
Make sure you click on the method cell as shown.
Click the Properties button to open up the panel on the right (the properties won’t appear until you do).
You can see the Types dropdown. Choose a type from the dropdown - why not choose an
inttype? You’ll notice that the
<T>has now been replaced by <int>. You can close the properties panel now if you like.
Configuring inputs and outputs
Let’s set up some a simple valid and invalid test.
Let’s create a valid equivalence class value of
g2(they need to be the same as it's testing equality.
We’ll create an invalid equivalence class with value
101(so equality fails).
The valid output equivalence class return
And the invalid,
And with that, you can press Generate Test Code and run your test.