Partial config update: test update states

Adds a unit test for updating states. Mostly to ensure that replaced
states are calculated correctly.

Also refactor the logic a bit to make it easier to test.

Test: atest statsd_test
Bug: 162323667
Change-Id: Ie0e72c25c879d1c4dd59c330d40e5757ef750ec5
3 files changed