Added tests and demos for State pattern.