func TestUnregister(t *testing.T) { checker := New(time.Millisecond) indicator := &TestIndicator{ &sync.Mutex{}, false, } checker.RegisterIndicator(indicator) checker.Start() time.Sleep(2 * time.Millisecond) checker.UnregisterIndicator(indicator) indicator.Lock() indicator.hasBeenCalled = false indicator.Unlock() time.Sleep(2 * time.Millisecond) if indicator.hasBeenCalled { t.Error("Unregistration not sucessfull") } }