@@ -61,10 +61,10 @@ func TestCanEnableAMonitor(t *testing.T) {
6161 mockByteReader )
6262
6363 // Then...
64- assert .Nil (t , err , "EnableMonitor returned an unexpected error" )
64+ assert .Nil (t , err , "SetMonitor returned an unexpected error" )
6565}
6666
67- func TestEnableMonitorWithBlankNameDisplaysError (t * testing.T ) {
67+ func TestSetMonitorWithBlankNameDisplaysError (t * testing.T ) {
6868 // Given...
6969 monitorName := " "
7070 isEnabled := "true"
@@ -87,7 +87,7 @@ func TestEnableMonitorWithBlankNameDisplaysError(t *testing.T) {
8787 mockByteReader )
8888
8989 // Then...
90- assert .NotNil (t , err , "EnableMonitor did not return an error as expected" )
90+ assert .NotNil (t , err , "SetMonitor did not return an error as expected" )
9191 consoleOutputText := err .Error ()
9292 assert .Contains (t , consoleOutputText , "GAL1225E" )
9393 assert .Contains (t , consoleOutputText , " Invalid monitor name provided" )
@@ -99,14 +99,14 @@ func TestEnableNonExistantMonitorDisplaysError(t *testing.T) {
9999 isEnabled := "true"
100100
101101 // Create the expected HTTP interactions with the API server
102- enableMonitorInteraction := utils .NewHttpInteraction ("/monitors/" + nonExistantMonitor , http .MethodPut )
103- enableMonitorInteraction .WriteHttpResponseFunc = func (writer http.ResponseWriter , req * http.Request ) {
102+ setMonitorInteraction := utils .NewHttpInteraction ("/monitors/" + nonExistantMonitor , http .MethodPut )
103+ setMonitorInteraction .WriteHttpResponseFunc = func (writer http.ResponseWriter , req * http.Request ) {
104104 writer .Header ().Set ("Content-Type" , "application/json" )
105105 writer .WriteHeader (http .StatusNotFound )
106106 writer .Write ([]byte (`{ "error_message": "No such monitor exists" }` ))
107107 }
108108
109- interactions := []utils.HttpInteraction { enableMonitorInteraction }
109+ interactions := []utils.HttpInteraction { setMonitorInteraction }
110110
111111 server := utils .NewMockHttpServer (t , interactions )
112112 defer server .Server .Close ()
@@ -123,23 +123,23 @@ func TestEnableNonExistantMonitorDisplaysError(t *testing.T) {
123123 mockByteReader )
124124
125125 // Then...
126- assert .NotNil (t , err , "EnableMonitor did not return an error but it should have" )
126+ assert .NotNil (t , err , "SetMonitor did not return an error but it should have" )
127127 assert .ErrorContains (t , err , "GAL1231E" )
128128}
129129
130- func TestEnableMonitorFailsWithNoExplanationErrorPayloadGivesCorrectMessage (t * testing.T ) {
130+ func TestSetMonitorFailsWithNoExplanationErrorPayloadGivesCorrectMessage (t * testing.T ) {
131131 // Given...
132132 monitorName := "myMonitor"
133133 isEnabled := "true"
134134
135135 // Create the expected HTTP interactions with the API server
136- enableMonitorInteraction := utils .NewHttpInteraction ("/monitors/" + monitorName , http .MethodPut )
137- enableMonitorInteraction .WriteHttpResponseFunc = func (writer http.ResponseWriter , req * http.Request ) {
136+ setMonitorInteraction := utils .NewHttpInteraction ("/monitors/" + monitorName , http .MethodPut )
137+ setMonitorInteraction .WriteHttpResponseFunc = func (writer http.ResponseWriter , req * http.Request ) {
138138 writer .WriteHeader (http .StatusInternalServerError )
139139 }
140140
141141 interactions := []utils.HttpInteraction {
142- enableMonitorInteraction ,
142+ setMonitorInteraction ,
143143 }
144144
145145 server := utils .NewMockHttpServer (t , interactions )
@@ -157,25 +157,25 @@ func TestEnableMonitorFailsWithNoExplanationErrorPayloadGivesCorrectMessage(t *t
157157 mockByteReader )
158158
159159 // Then...
160- assert .NotNil (t , err , "EnableMonitor did not return an error but it should have" )
160+ assert .NotNil (t , err , "SetMonitor did not return an error but it should have" )
161161 assert .ErrorContains (t , err , "GAL1228E" )
162162}
163163
164- func TestEnableMonitorFailsWithNonJsonContentTypeExplanationErrorPayloadGivesCorrectMessage (t * testing.T ) {
164+ func TestSetMonitorFailsWithNonJsonContentTypeExplanationErrorPayloadGivesCorrectMessage (t * testing.T ) {
165165 // Given...
166166 monitorName := "myMonitor"
167167 isEnabled := "true"
168168
169169 // Create the expected HTTP interactions with the API server
170- enableMonitorInteraction := utils .NewHttpInteraction ("/monitors/" + monitorName , http .MethodPut )
171- enableMonitorInteraction .WriteHttpResponseFunc = func (writer http.ResponseWriter , req * http.Request ) {
170+ setMonitorInteraction := utils .NewHttpInteraction ("/monitors/" + monitorName , http .MethodPut )
171+ setMonitorInteraction .WriteHttpResponseFunc = func (writer http.ResponseWriter , req * http.Request ) {
172172 writer .WriteHeader (http .StatusInternalServerError )
173173 writer .Header ().Set ("Content-Type" , "application/notJsonOnPurpose" )
174174 writer .Write ([]byte ("something not json but non-zero-length." ))
175175 }
176176
177177 interactions := []utils.HttpInteraction {
178- enableMonitorInteraction ,
178+ setMonitorInteraction ,
179179 }
180180
181181 server := utils .NewMockHttpServer (t , interactions )
@@ -193,7 +193,7 @@ func TestEnableMonitorFailsWithNonJsonContentTypeExplanationErrorPayloadGivesCor
193193 mockByteReader )
194194
195195 // Then...
196- assert .NotNil (t , err , "EnableMonitor did not return an error but it should have" )
196+ assert .NotNil (t , err , "SetMonitor did not return an error but it should have" )
197197 assert .ErrorContains (t , err , strconv .Itoa (http .StatusInternalServerError ))
198198 assert .ErrorContains (t , err , "GAL1232E" )
199199 assert .ErrorContains (t , err , "Error details from the server are not in the json format" )
@@ -233,5 +233,5 @@ func TestCanDisableAMonitor(t *testing.T) {
233233 mockByteReader )
234234
235235 // Then...
236- assert .Nil (t , err , "DisableMonitor returned an unexpected error" )
236+ assert .Nil (t , err , "SetMonitor returned an unexpected error" )
237237}
0 commit comments