@@ -62,7 +62,7 @@ class HttpHeadersTest {
6262 httpHeaders. setAccept(mediaTypes)
6363
6464 def acceptMediaTypes = httpHeaders. getAccept()
65- assertEquals acceptMediaTypes. size(), 2
65+ assertThat acceptMediaTypes, hasSize( 2 )
6666 assertTrue acceptMediaTypes. contains(MediaType . APPLICATION_JSON )
6767 assertTrue acceptMediaTypes. contains(MediaType . APPLICATION_FORM_URLENCODED )
6868 }
@@ -71,7 +71,7 @@ class HttpHeadersTest {
7171 void testAcceptCharsetEmpty () {
7272
7373 def acceptCharSets = httpHeaders. getAcceptCharset()
74- assertEquals acceptCharSets. size(), 0
74+ assertThat acceptCharSets, empty()
7575 }
7676
7777 @Test
@@ -81,7 +81,7 @@ class HttpHeadersTest {
8181 httpHeaders. setAcceptCharset(charSets)
8282
8383 def acceptCharSets = httpHeaders. getAcceptCharset()
84- assertEquals acceptCharSets. size(), 2
84+ assertThat acceptCharSets, hasSize( 2 )
8585 assertTrue acceptCharSets. contains(Charset . forName(" UTF-8" ))
8686 assertTrue acceptCharSets. contains(Charset . forName(" UTF-16" ))
8787 }
@@ -90,7 +90,7 @@ class HttpHeadersTest {
9090 void testAllowMethodEmpty () {
9191
9292 def allowedMethods = httpHeaders. getAllow()
93- assertEquals allowedMethods. size(), 0
93+ assertThat allowedMethods, empty()
9494 }
9595
9696 @Test
@@ -100,7 +100,7 @@ class HttpHeadersTest {
100100 httpHeaders. setAllow(methods)
101101
102102 def allowedMethods = httpHeaders. getAllow()
103- assertEquals allowedMethods. size(), 2
103+ assertThat allowedMethods, hasSize( 2 )
104104 assertTrue allowedMethods. contains(HttpMethod . GET )
105105 assertTrue allowedMethods. contains(HttpMethod . POST )
106106 }
@@ -166,7 +166,7 @@ class HttpHeadersTest {
166166 assertEquals httpHeaders. get(" Date" ), [dateFormat. format(new Date (now))]
167167
168168 long droppedMillis = 1000 * (now/ 1000 ). longValue()
169- assertEquals httpHeaders. getDate(), droppedMillis
169+ assertThat httpHeaders. getDate(), is( droppedMillis)
170170 }
171171
172172 @Test
@@ -197,7 +197,7 @@ class HttpHeadersTest {
197197 assertEquals httpHeaders. get(" Expires" ), [dateFormat. format(new Date (now))]
198198
199199 long droppedMillis = 1000 * (now/ 1000 ). longValue()
200- assertEquals httpHeaders. getExpires(), droppedMillis
200+ assertThat httpHeaders. getExpires(), is( droppedMillis)
201201 }
202202
203203 @Test
@@ -212,7 +212,7 @@ class HttpHeadersTest {
212212 assertEquals httpHeaders. get(" If-Modified-Since" ), [dateFormat. format(new Date (now))]
213213
214214 long droppedMillis = 1000 * (now/ 1000 ). longValue()
215- assertEquals httpHeaders. getIfNotModifiedSince(), droppedMillis
215+ assertThat httpHeaders. getIfNotModifiedSince(), is( droppedMillis)
216216 }
217217
218218 @Test
@@ -242,7 +242,7 @@ class HttpHeadersTest {
242242 assertEquals httpHeaders. get(" Last-Modified" ), [dateFormat. format(new Date (now))]
243243
244244 long droppedMillis = 1000 * (now/ 1000 ). longValue()
245- assertEquals httpHeaders. getLastModified(), droppedMillis
245+ assertThat httpHeaders. getLastModified(), is( droppedMillis)
246246 }
247247
248248 @Test
@@ -289,7 +289,7 @@ class HttpHeadersTest {
289289 httpHeaders. setAll(headerMap)
290290
291291 headerMap = httpHeaders. toSingleValueMap()
292- assertEquals headerMap. size(), 2
292+ assertThat headerMap, aMapWithSize( 2 )
293293 assertEquals headerMap. get(" Pragma" ), " no-cache"
294294 assertEquals headerMap. get(" Content-Type" ), MediaType . APPLICATION_FORM_URLENCODED_VALUE
295295 }
@@ -349,7 +349,7 @@ class HttpHeadersTest {
349349 ])
350350
351351 def keySet = httpHeaders. keySet()
352- assertEquals keySet. size(), 2
352+ assertThat keySet, hasSize( 2 )
353353 assertTrue keySet. contains(" Pragma" )
354354 assertTrue keySet. contains(" ETag" )
355355 }
@@ -363,7 +363,7 @@ class HttpHeadersTest {
363363 ])
364364
365365 def values = httpHeaders. values()
366- assertEquals values. size(), 2
366+ assertThat values, hasSize( 2 )
367367 assertTrue values. contains([" no-cache" ])
368368 assertTrue values. contains([" 123456789" ])
369369 }
@@ -404,7 +404,7 @@ class HttpHeadersTest {
404404 httpHeaders. setExpires(3600 )
405405 httpHeaders. setLocation(new URI (location))
406406
407- assertEquals httpHeaders. hashCode(), other. hashCode()
407+ assertThat httpHeaders. hashCode(), is( other. hashCode() )
408408 }
409409
410410 @Test
0 commit comments