Guest User

Untitled

a guest
May 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. //
  2. //範囲オブジェクトの確認(日付を使って)
  3. //
  4.  
  5. def a = new Date()
  6. def b = today + 30
  7.  
  8. def range = (a..b)
  9.  
  10. assert range.getClass() == groovy.lang.ObjectRange
  11.  
  12. assert range.contains(a)==true
  13.  
  14. // ここがポイント
  15. assert range.contains( new Date()+1 ) == false
  16. assert range.containsWithinBounds( new Date()+1 ) == true
Add Comment
Please, Sign In to add comment