Fixed following TODO items:
1) it's not always good practice to do some logic operations in constructor
2) you can use utility library for working with strings
3) resource should be closed in a finally block
Fixed validateInputs() method (was a bug after refactoring)
Added unit tests