Refactored ComponentStatus

Refactored ComponentStatus because of the high cyclomatic
complexity. Added some parameterized unit tests first to ensure
identical behaviour before and after the refactoring. After that,
simplified the fromValue method by comparing values in a loop
instead of checking each individual value in a switch statement.