Re-factoring the build() to call register() in resource state machine and adding unit tests

1) Re-factoring the build() to call register() in resource state machine
2) Adding a unit test for building the map of interactions to Http methods
3) Fixing some unit tests for the above changes