I just ran into a bunch of problems trying to set up some simple unit tests. I resolved them and you can see the result here:
https://github.com/rapodaca/Terasology/ ... yTest.java
Inventor depends on Player. Player depends on WorldRenderer. WorldRenderer depends on OpenGL stuff, and it looks like an entire world needs to be generated to just test something simple like Inventory.
So I made some changes that made Inventory testable under reasonable conditions. One change was to mock Player with Mockito:
http://code.google.com/p/mockito/
Another was to not load default items on constructing Inventory, but require Player to do it.
There are some tests in the /tests directory, but very few.
So my question - what's the plan for testing and would there be a problem with these kinds of changes getting added into the MovingBlock master branch?
This exercise has brought up other issues as well. For example, why does an Inventory even need to know about Player in the first place? Should be the other way around, no? Probably a separate issue, though.
https://github.com/rapodaca/Terasology/ ... yTest.java
Inventor depends on Player. Player depends on WorldRenderer. WorldRenderer depends on OpenGL stuff, and it looks like an entire world needs to be generated to just test something simple like Inventory.
So I made some changes that made Inventory testable under reasonable conditions. One change was to mock Player with Mockito:
http://code.google.com/p/mockito/
Another was to not load default items on constructing Inventory, but require Player to do it.
There are some tests in the /tests directory, but very few.
So my question - what's the plan for testing and would there be a problem with these kinds of changes getting added into the MovingBlock master branch?
This exercise has brought up other issues as well. For example, why does an Inventory even need to know about Player in the first place? Should be the other way around, no? Probably a separate issue, though.