You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: alerting_test.go
    path of file: ./repos/gatus/watchdog
    
    the code of the file until where you have to start completion: package watchdog

import (
	"os"
	"testing"

	"github.com/TwiN/gatus/v5/alerting"
	"github.com/TwiN/gatus/v5/alerting/alert"
	"github.com/TwiN/gatus/v5/alerting/provider/custom"
	"github.com/TwiN/gatus/v5/alerting/provider/discord"
	"github.com/TwiN/gatus/v5/alerting/provider/email"
	"github.com/TwiN/gatus/v5/alerting/provider/matrix"
	"github.com/TwiN/gatus/v5/alerting/provider/mattermost"
	"github.com/TwiN/gatus/v5/alerting/provider/messagebird"
	"github.com/TwiN/gatus/v5/alerting/provider/pagerduty"
	"github.com/TwiN/gatus/v5/alerting/provider/pushover"
	"github.com/TwiN/gatus/v5/alerting/provider/slack"
	"github.com/TwiN/gatus/v5/alerting/provider/teams"
	"github.com/TwiN/gatus/v5/alerting/provider/telegram"
	"github.com/TwiN/gatus/v5/alerting/provider/twilio"
	"github.com/TwiN/gatus/v5/config"
	"github.com/TwiN/gatus/v5/core"
)

func TestHandleAlerting(t *testing.T) {
	_ = os.Setenv("MOCK_ALERT_PROVIDER", "true")
	defer os.Clearenv()

	cfg := &config.Config{
		Debug: true,
		Alerting: &alerting.Config{
			Custom: &custom.AlertProvider{
				URL:    "https://twin.sh/health",
				Method: "GET",
			},
		},
	}
	enabled := true
	endpoint := &core.Endpoint{
		URL: "https://example.com",
		Alerts: []*alert.Alert{
			{
				Type:             alert.TypeCustom,
				Enabled:          &enabled,
				FailureThreshold: 2,
				SuccessThreshold: 3,
				SendOnResolved:   &enabled,
				Triggered:        false,
			},
		},
	}

	verify(t, endpoint, 0, 0, false, "The alert shouldn't start triggered")
	HandleAlerting(endpoint, &core.Result{Success: false}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 1, 0, false, "The alert shouldn't have triggered")
	HandleAlerti
    
func TestHandleAlerting(t *testing.T) {
	_ = os.Setenv("MOCK_ALERT_PROVIDER", "true")
	defer os.Clearenv()

	cfg := &config.Config{
		Debug: true,
		Alerting: &alerting.Config{
			Custom: &custom.AlertProvider{
				URL:    "https://twin.sh/health",
				Method: "GET",
			},
		},
	}
	enabled := true
	endpoint := &core.Endpoint{
		URL: "https://example.com",
		Alerts: []*alert.Alert{
			{
				Type:             alert.TypeCustom,
				Enabled:          &enabled,
				FailureThreshold: 2,
				SuccessThreshold: 3,
				SendOnResolved:   &enabled,
				Triggered:        false,
			},
		},
	}

	verify(t, endpoint, 0, 0, false, "The alert shouldn't start triggered")
	HandleAlerting(endpoint, &core.Result{Success: false}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 1, 0, false, "The alert shouldn't have triggered")
	HandleAlerting(endpoint, &core.Result{Success: false}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 2, 0, true, "The alert should've triggered")
	HandleAlerting(endpoint, &core.Result{Success: false}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 3, 0, true, "The alert should still be triggered")
	HandleAlerting(endpoint, &core.Result{Success: false}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 4, 0, true, "The alert should still be triggered")
	HandleAlerting(endpoint, &core.Result{Success: true}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 0, 1, true, "The alert should still be triggered (because endpoint.Alerts[0].SuccessThreshold is 3)")
	HandleAlerting(endpoint, &core.Result{Success: true}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 0, 2, true, "The alert should still be triggered (because endpoint.Alerts[0].SuccessThreshold is 3)")
	HandleAlerting(endpoint, &core.Result{Success: true}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 0, 3, false, "The alert should've been resolved")
	HandleAlerting(endpoint, &core.Result{Success: true}, cfg.Alerting, cfg.Debug)
	verify(t, endpoint, 0, 4, false, "The alert should no longer be triggered")
}