Add Junit for AppStates
Code cleaning