@@ -69,6 +69,18 @@ main() {
6969 // Assert
7070 expect (method, equals (HttpMethod .DELETE ));
7171 });
72+
73+ test ("with OPTIONS method" , () {
74+ // Arrange
75+ late final HttpMethod method;
76+ final String methodString = "OPTIONS" ;
77+
78+ // Act
79+ method = HttpMethod .fromString (methodString);
80+
81+ // Assert
82+ expect (method, equals (HttpMethod .OPTIONS ));
83+ });
7284 });
7385
7486 group ("Can parse to string" , () {
@@ -138,6 +150,18 @@ main() {
138150 // Assert
139151 expect (methodString, equals ("DELETE" ));
140152 });
153+
154+ test ("to 'OPTIONS' string." , () {
155+ // Arrange
156+ final String methodString;
157+ final HttpMethod method = HttpMethod .OPTIONS ;
158+
159+ // Act
160+ methodString = method.asString;
161+
162+ // Assert
163+ expect (methodString, equals ("OPTIONS" ));
164+ });
141165 });
142166
143167 group ("Can control unsupported values" , () {
@@ -153,4 +177,62 @@ main() {
153177 );
154178 });
155179 });
180+
181+ group ("toString() method returns correct string representation" , () {
182+ test ("for HEAD method" , () {
183+ // Arrange
184+ final HttpMethod method = HttpMethod .HEAD ;
185+
186+ // Act & Assert
187+ expect (method.toString (), equals ("HEAD" ));
188+ });
189+
190+ test ("for GET method" , () {
191+ // Arrange
192+ final HttpMethod method = HttpMethod .GET ;
193+
194+ // Act & Assert
195+ expect (method.toString (), equals ("GET" ));
196+ });
197+
198+ test ("for POST method" , () {
199+ // Arrange
200+ final HttpMethod method = HttpMethod .POST ;
201+
202+ // Act & Assert
203+ expect (method.toString (), equals ("POST" ));
204+ });
205+
206+ test ("for PUT method" , () {
207+ // Arrange
208+ final HttpMethod method = HttpMethod .PUT ;
209+
210+ // Act & Assert
211+ expect (method.toString (), equals ("PUT" ));
212+ });
213+
214+ test ("for PATCH method" , () {
215+ // Arrange
216+ final HttpMethod method = HttpMethod .PATCH ;
217+
218+ // Act & Assert
219+ expect (method.toString (), equals ("PATCH" ));
220+ });
221+
222+ test ("for DELETE method" , () {
223+ // Arrange
224+ final HttpMethod method = HttpMethod .DELETE ;
225+
226+ // Act & Assert
227+ expect (method.toString (), equals ("DELETE" ));
228+ });
229+
230+ test ("for OPTIONS method" , () {
231+ // Arrange
232+ final HttpMethod method = HttpMethod .OPTIONS ;
233+
234+ // Act & Assert
235+ expect (method.toString (), equals ("OPTIONS" ));
236+ });
237+ });
156238}
0 commit comments