trackler 2.0.6.17 → 2.0.6.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/c/exercises/leap/test/test_leap.c +1 -1
  4. data/tracks/coldfusion/{leap → exercises/leap}/example.cfc +0 -0
  5. data/tracks/coldfusion/{leap → exercises/leap}/leap.cfc +0 -0
  6. data/tracks/coldfusion/{leap → exercises/leap}/leap_tests.cfc +0 -0
  7. data/tracks/cpp/CMakeLists.txt +4 -3
  8. data/tracks/cpp/{anagram → exercises/anagram}/CMakeLists.txt +0 -0
  9. data/tracks/cpp/{anagram → exercises/anagram}/anagram_test.cpp +0 -0
  10. data/tracks/cpp/{anagram → exercises/anagram}/example.cpp +0 -0
  11. data/tracks/cpp/{anagram → exercises/anagram}/example.h +0 -0
  12. data/tracks/cpp/{beer-song → exercises/beer-song}/CMakeLists.txt +0 -0
  13. data/tracks/cpp/{beer-song → exercises/beer-song}/beer_song_test.cpp +0 -0
  14. data/tracks/cpp/{beer-song → exercises/beer-song}/example.cpp +0 -0
  15. data/tracks/cpp/{beer-song → exercises/beer-song}/example.h +0 -0
  16. data/tracks/cpp/{binary → exercises/binary}/CMakeLists.txt +0 -0
  17. data/tracks/cpp/{binary → exercises/binary}/binary_test.cpp +0 -0
  18. data/tracks/cpp/{binary → exercises/binary}/example.cpp +0 -0
  19. data/tracks/cpp/{binary → exercises/binary}/example.h +0 -0
  20. data/tracks/cpp/{bob → exercises/bob}/CMakeLists.txt +0 -0
  21. data/tracks/cpp/{bob → exercises/bob}/bob_test.cpp +0 -0
  22. data/tracks/cpp/{bob → exercises/bob}/example.cpp +0 -0
  23. data/tracks/cpp/{bob → exercises/bob}/example.h +0 -0
  24. data/tracks/cpp/{clock → exercises/clock}/CMakeLists.txt +0 -0
  25. data/tracks/cpp/{clock → exercises/clock}/clock_test.cpp +0 -0
  26. data/tracks/cpp/{clock → exercises/clock}/example.cpp +0 -0
  27. data/tracks/cpp/{clock → exercises/clock}/example.h +0 -0
  28. data/tracks/cpp/{crypto-square → exercises/crypto-square}/CMakeLists.txt +0 -0
  29. data/tracks/cpp/{crypto-square → exercises/crypto-square}/crypto_square_test.cpp +0 -0
  30. data/tracks/cpp/{crypto-square → exercises/crypto-square}/example.cpp +0 -0
  31. data/tracks/cpp/{crypto-square → exercises/crypto-square}/example.h +0 -0
  32. data/tracks/cpp/{difference-of-squares → exercises/difference-of-squares}/CMakeLists.txt +0 -0
  33. data/tracks/cpp/{difference-of-squares → exercises/difference-of-squares}/difference_of_squares_test.cpp +0 -0
  34. data/tracks/cpp/{difference-of-squares → exercises/difference-of-squares}/example.cpp +0 -0
  35. data/tracks/cpp/{difference-of-squares → exercises/difference-of-squares}/example.h +0 -0
  36. data/tracks/cpp/{etl → exercises/etl}/CMakeLists.txt +0 -0
  37. data/tracks/cpp/{etl → exercises/etl}/etl_test.cpp +0 -0
  38. data/tracks/cpp/{etl → exercises/etl}/example.cpp +0 -0
  39. data/tracks/cpp/{etl → exercises/etl}/example.h +0 -0
  40. data/tracks/cpp/{etl → exercises/etl}/require_equal_containers.h +0 -0
  41. data/tracks/cpp/{food-chain → exercises/food-chain}/CMakeLists.txt +0 -0
  42. data/tracks/cpp/{food-chain → exercises/food-chain}/example.cpp +0 -0
  43. data/tracks/cpp/{food-chain → exercises/food-chain}/example.h +0 -0
  44. data/tracks/cpp/{food-chain → exercises/food-chain}/food_chain_test.cpp +0 -0
  45. data/tracks/cpp/{gigasecond → exercises/gigasecond}/CMakeLists.txt +0 -0
  46. data/tracks/cpp/{gigasecond → exercises/gigasecond}/example.cpp +0 -0
  47. data/tracks/cpp/{gigasecond → exercises/gigasecond}/example.h +0 -0
  48. data/tracks/cpp/{gigasecond → exercises/gigasecond}/gigasecond_test.cpp +0 -0
  49. data/tracks/cpp/{grade-school → exercises/grade-school}/CMakeLists.txt +0 -0
  50. data/tracks/cpp/{grade-school → exercises/grade-school}/example.cpp +0 -0
  51. data/tracks/cpp/{grade-school → exercises/grade-school}/example.h +0 -0
  52. data/tracks/cpp/{grade-school → exercises/grade-school}/grade_school_test.cpp +0 -0
  53. data/tracks/cpp/{grade-school → exercises/grade-school}/require_equal_containers.h +0 -0
  54. data/tracks/cpp/{grains → exercises/grains}/CMakeLists.txt +0 -0
  55. data/tracks/cpp/{grains → exercises/grains}/example.cpp +0 -0
  56. data/tracks/cpp/{grains → exercises/grains}/example.h +0 -0
  57. data/tracks/cpp/{grains → exercises/grains}/grains_test.cpp +0 -0
  58. data/tracks/cpp/{hamming → exercises/hamming}/CMakeLists.txt +0 -0
  59. data/tracks/cpp/{hamming → exercises/hamming}/example.cpp +0 -0
  60. data/tracks/cpp/{hamming → exercises/hamming}/example.h +0 -0
  61. data/tracks/cpp/{hamming → exercises/hamming}/hamming_test.cpp +0 -0
  62. data/tracks/cpp/{hexadecimal → exercises/hexadecimal}/CMakeLists.txt +0 -0
  63. data/tracks/cpp/{hexadecimal → exercises/hexadecimal}/example.cpp +0 -0
  64. data/tracks/cpp/{hexadecimal → exercises/hexadecimal}/example.h +0 -0
  65. data/tracks/cpp/{hexadecimal → exercises/hexadecimal}/hexadecimal_test.cpp +0 -0
  66. data/tracks/cpp/{leap → exercises/leap}/CMakeLists.txt +0 -0
  67. data/tracks/cpp/{leap → exercises/leap}/example.h +0 -0
  68. data/tracks/cpp/{leap → exercises/leap}/leap_test.cpp +0 -0
  69. data/tracks/cpp/{meetup → exercises/meetup}/CMakeLists.txt +0 -0
  70. data/tracks/cpp/{meetup → exercises/meetup}/example.h +0 -0
  71. data/tracks/cpp/{meetup → exercises/meetup}/meetup_test.cpp +0 -0
  72. data/tracks/cpp/{nth-prime → exercises/nth-prime}/CMakeLists.txt +0 -0
  73. data/tracks/cpp/{nth-prime → exercises/nth-prime}/example.cpp +0 -0
  74. data/tracks/cpp/{nth-prime → exercises/nth-prime}/example.h +0 -0
  75. data/tracks/cpp/{nth-prime → exercises/nth-prime}/nth_prime_test.cpp +0 -0
  76. data/tracks/cpp/{nucleotide-count → exercises/nucleotide-count}/CMakeLists.txt +0 -0
  77. data/tracks/cpp/{nucleotide-count → exercises/nucleotide-count}/example.cpp +0 -0
  78. data/tracks/cpp/{nucleotide-count → exercises/nucleotide-count}/example.h +0 -0
  79. data/tracks/cpp/{nucleotide-count → exercises/nucleotide-count}/nucleotide_count_test.cpp +0 -0
  80. data/tracks/cpp/{nucleotide-count → exercises/nucleotide-count}/require_equal_containers.h +0 -0
  81. data/tracks/cpp/{phone-number → exercises/phone-number}/CMakeLists.txt +0 -0
  82. data/tracks/cpp/{phone-number → exercises/phone-number}/example.cpp +0 -0
  83. data/tracks/cpp/{phone-number → exercises/phone-number}/example.h +0 -0
  84. data/tracks/cpp/{phone-number → exercises/phone-number}/phone_number_test.cpp +0 -0
  85. data/tracks/cpp/{prime-factors → exercises/prime-factors}/CMakeLists.txt +0 -0
  86. data/tracks/cpp/{prime-factors → exercises/prime-factors}/example.cpp +0 -0
  87. data/tracks/cpp/{prime-factors → exercises/prime-factors}/example.h +0 -0
  88. data/tracks/cpp/{prime-factors → exercises/prime-factors}/prime_factors_test.cpp +0 -0
  89. data/tracks/cpp/{queen-attack → exercises/queen-attack}/CMakeLists.txt +0 -0
  90. data/tracks/cpp/{queen-attack → exercises/queen-attack}/example.cpp +0 -0
  91. data/tracks/cpp/{queen-attack → exercises/queen-attack}/example.h +0 -0
  92. data/tracks/cpp/{queen-attack → exercises/queen-attack}/queen_attack_test.cpp +0 -0
  93. data/tracks/cpp/{queen-attack → exercises/queen-attack}/require_equal_containers.h +0 -0
  94. data/tracks/cpp/{raindrops → exercises/raindrops}/CMakeLists.txt +0 -0
  95. data/tracks/cpp/{raindrops → exercises/raindrops}/example.cpp +0 -0
  96. data/tracks/cpp/{raindrops → exercises/raindrops}/example.h +0 -0
  97. data/tracks/cpp/{raindrops → exercises/raindrops}/raindrops_test.cpp +0 -0
  98. data/tracks/cpp/{rna-transcription → exercises/rna-transcription}/CMakeLists.txt +0 -0
  99. data/tracks/cpp/{rna-transcription → exercises/rna-transcription}/example.cpp +0 -0
  100. data/tracks/cpp/{rna-transcription → exercises/rna-transcription}/example.h +0 -0
  101. data/tracks/cpp/{rna-transcription → exercises/rna-transcription}/rna_transcription_test.cpp +0 -0
  102. data/tracks/cpp/{robot-name → exercises/robot-name}/CMakeLists.txt +0 -0
  103. data/tracks/cpp/{robot-name → exercises/robot-name}/example.cpp +0 -0
  104. data/tracks/cpp/{robot-name → exercises/robot-name}/example.h +0 -0
  105. data/tracks/cpp/{robot-name → exercises/robot-name}/robot_name_test.cpp +0 -0
  106. data/tracks/cpp/{roman-numerals → exercises/roman-numerals}/CMakeLists.txt +0 -0
  107. data/tracks/cpp/{roman-numerals → exercises/roman-numerals}/example.cpp +0 -0
  108. data/tracks/cpp/{roman-numerals → exercises/roman-numerals}/example.h +0 -0
  109. data/tracks/cpp/{roman-numerals → exercises/roman-numerals}/roman_numerals_test.cpp +0 -0
  110. data/tracks/cpp/{say → exercises/say}/CMakeLists.txt +0 -0
  111. data/tracks/cpp/{say → exercises/say}/example.cpp +0 -0
  112. data/tracks/cpp/{say → exercises/say}/example.h +0 -0
  113. data/tracks/cpp/{say → exercises/say}/say_test.cpp +0 -0
  114. data/tracks/cpp/{scrabble-score → exercises/scrabble-score}/CMakeLists.txt +0 -0
  115. data/tracks/cpp/{scrabble-score → exercises/scrabble-score}/example.cpp +0 -0
  116. data/tracks/cpp/{scrabble-score → exercises/scrabble-score}/example.h +0 -0
  117. data/tracks/cpp/{scrabble-score → exercises/scrabble-score}/scrabble_score_test.cpp +0 -0
  118. data/tracks/cpp/{series → exercises/series}/CMakeLists.txt +0 -0
  119. data/tracks/cpp/{series → exercises/series}/example.cpp +0 -0
  120. data/tracks/cpp/{series → exercises/series}/example.h +0 -0
  121. data/tracks/cpp/{series → exercises/series}/require_equal_containers.h +0 -0
  122. data/tracks/cpp/{series → exercises/series}/series_test.cpp +0 -0
  123. data/tracks/cpp/{sieve → exercises/sieve}/CMakeLists.txt +0 -0
  124. data/tracks/cpp/{sieve → exercises/sieve}/example.cpp +0 -0
  125. data/tracks/cpp/{sieve → exercises/sieve}/example.h +0 -0
  126. data/tracks/cpp/{sieve → exercises/sieve}/sieve_test.cpp +0 -0
  127. data/tracks/cpp/{space-age → exercises/space-age}/CMakeLists.txt +0 -0
  128. data/tracks/cpp/{space-age → exercises/space-age}/example.cpp +0 -0
  129. data/tracks/cpp/{space-age → exercises/space-age}/example.h +0 -0
  130. data/tracks/cpp/{space-age → exercises/space-age}/space_age_test.cpp +0 -0
  131. data/tracks/cpp/{sum-of-multiples → exercises/sum-of-multiples}/CMakeLists.txt +0 -0
  132. data/tracks/cpp/{sum-of-multiples → exercises/sum-of-multiples}/example.cpp +0 -0
  133. data/tracks/cpp/{sum-of-multiples → exercises/sum-of-multiples}/example.h +0 -0
  134. data/tracks/cpp/{sum-of-multiples → exercises/sum-of-multiples}/sum_of_multiples_test.cpp +0 -0
  135. data/tracks/cpp/{triangle → exercises/triangle}/CMakeLists.txt +0 -0
  136. data/tracks/cpp/{triangle → exercises/triangle}/example.cpp +0 -0
  137. data/tracks/cpp/{triangle → exercises/triangle}/example.h +0 -0
  138. data/tracks/cpp/{triangle → exercises/triangle}/triangle_test.cpp +0 -0
  139. data/tracks/cpp/{trinary → exercises/trinary}/CMakeLists.txt +0 -0
  140. data/tracks/cpp/{trinary → exercises/trinary}/example.cpp +0 -0
  141. data/tracks/cpp/{trinary → exercises/trinary}/example.h +0 -0
  142. data/tracks/cpp/{trinary → exercises/trinary}/trinary_test.cpp +0 -0
  143. data/tracks/cpp/{word-count → exercises/word-count}/CMakeLists.txt +0 -0
  144. data/tracks/cpp/{word-count → exercises/word-count}/example.cpp +0 -0
  145. data/tracks/cpp/{word-count → exercises/word-count}/example.h +0 -0
  146. data/tracks/cpp/{word-count → exercises/word-count}/require_equal_containers.h +0 -0
  147. data/tracks/cpp/{word-count → exercises/word-count}/word_count_test.cpp +0 -0
  148. data/tracks/csharp/exercises/error-handling/ErrorHandlingTest.cs +3 -3
  149. data/tracks/fsharp/exercises/linked-list/Example.fs +4 -4
  150. data/tracks/fsharp/exercises/linked-list/LinkedListTest.fs +35 -19
  151. data/tracks/groovy/docs/ABOUT.md +5 -10
  152. data/tracks/groovy/docs/INSTALLATION.md +7 -10
  153. data/tracks/groovy/docs/LEARNING.md +19 -8
  154. data/tracks/groovy/docs/RESOURCES.md +9 -23
  155. data/tracks/groovy/docs/TESTS.md +14 -51
  156. data/tracks/groovy/exercises/nth-prime/Example.groovy +3 -6
  157. data/tracks/groovy/exercises/nth-prime/PrimeSpec.groovy +27 -0
  158. data/tracks/haxe/{bob → exercises/bob}/.munit +0 -0
  159. data/tracks/haxe/{bob → exercises/bob}/Makefile +0 -0
  160. data/tracks/haxe/{bob → exercises/bob}/src/example.hx +0 -0
  161. data/tracks/haxe/{bob → exercises/bob}/test.hxml +0 -0
  162. data/tracks/haxe/{bob → exercises/bob}/test/BobTest.hx +0 -0
  163. data/tracks/haxe/{bob → exercises/bob}/test/TestMain.hx +0 -0
  164. data/tracks/haxe/{bob → exercises/bob}/test/TestSuite.hx +0 -0
  165. data/tracks/haxe/{hello-world → exercises/hello-world}/.munit +0 -0
  166. data/tracks/haxe/{hello-world → exercises/hello-world}/Makefile +0 -0
  167. data/tracks/haxe/{hello-world → exercises/hello-world}/src/example.hx +0 -0
  168. data/tracks/haxe/{hello-world → exercises/hello-world}/test.hxml +0 -0
  169. data/tracks/haxe/{hello-world → exercises/hello-world}/test/HelloWorldTest.hx +0 -0
  170. data/tracks/haxe/{hello-world → exercises/hello-world}/test/TestMain.hx +0 -0
  171. data/tracks/haxe/{hello-world → exercises/hello-world}/test/TestSuite.hx +0 -0
  172. data/tracks/java/exercises/luhn/src/example/java/LuhnValidator.java +43 -0
  173. data/tracks/java/exercises/luhn/src/test/java/LuhnValidatorTest.java +44 -0
  174. data/tracks/java/exercises/phone-number/src/example/java/PhoneNumber.java +12 -5
  175. data/tracks/java/exercises/phone-number/src/test/java/PhoneNumberTest.java +10 -12
  176. data/tracks/julia/config.json +2 -1
  177. data/tracks/julia/runtests.jl +8 -6
  178. data/tracks/kotlin/exercises/rna-transcription/src/main/kotlin/RnaTranscription.kt +0 -8
  179. data/tracks/kotlin/exercises/rna-transcription/src/test/kotlin/RnaTranscriptionTest.kt +9 -0
  180. data/tracks/scala/config.json +3 -0
  181. data/tracks/scala/exercises/meetup/build.sbt +2 -2
  182. data/tracks/scala/exercises/meetup/example.scala +22 -33
  183. data/tracks/scala/exercises/meetup/src/test/scala/MeetupTest.scala +358 -119
  184. data/tracks/swift/exercises/hello-world/Sources/{deleteme.swift → HelloWorld.swift} +0 -0
  185. metadata +163 -163
  186. data/tracks/groovy/exercises/nth-prime/NthPrimeTest.groovy +0 -29
  187. data/tracks/java/exercises/luhn/src/example/java/Luhn.java +0 -90
  188. data/tracks/java/exercises/luhn/src/test/java/LuhnTest.java +0 -95
@@ -11,13 +11,20 @@ public class PhoneNumber {
11
11
  }
12
12
 
13
13
  private String normalize(String number) {
14
- if(number.length() == 11 && number.startsWith("1")) {
15
- number = number.substring(1, number.length());
14
+ if(number.length() > 11 || number.length() < 10){
15
+ throw new IllegalArgumentException("Number must be 10 or 11 digits");
16
16
  }
17
17
 
18
- final boolean numberIsValid = (number.length() == 10);
19
- final String normalizedNumber = numberIsValid ? number : "0000000000";
20
- return normalizedNumber;
18
+ if(number.length() == 11){
19
+ if(number.startsWith("1")){
20
+ number = number.substring(1, number.length());
21
+ }
22
+ else{
23
+ throw new IllegalArgumentException("Can only have 11 digits if number starts with '1'");
24
+ }
25
+ }
26
+
27
+ return number;
21
28
  }
22
29
 
23
30
  public String getNumber() {
@@ -1,10 +1,14 @@
1
1
  import org.junit.Test;
2
2
  import org.junit.Ignore;
3
+ import org.junit.Rule;
4
+ import org.junit.rules.ExpectedException;
3
5
 
4
6
  import static org.junit.Assert.*;
5
7
 
6
8
  public class PhoneNumberTest {
7
9
 
10
+ @Rule
11
+ public ExpectedException expectedException = ExpectedException.none();
8
12
 
9
13
  @Test
10
14
  public void cleansNumber() {
@@ -41,23 +45,17 @@ public class PhoneNumberTest {
41
45
  @Ignore
42
46
  @Test
43
47
  public void invalidWhenOnly11Digits() {
44
- final String expectedNumber = "0000000000";
45
- final String actualNumber = new PhoneNumber("21234567890").getNumber();
46
-
47
- assertEquals(
48
- expectedNumber, actualNumber
49
- );
48
+ expectedException.expect(IllegalArgumentException.class);
49
+ expectedException.expectMessage("Can only have 11 digits if number starts with '1'");
50
+ new PhoneNumber("21234567890").getNumber();
50
51
  }
51
52
 
52
53
  @Ignore
53
54
  @Test
54
55
  public void invalidWhen9Digits() {
55
- final String expectedNumber = "0000000000";
56
- final String actualNumber = new PhoneNumber("123456789").getNumber();
57
-
58
- assertEquals(
59
- expectedNumber, actualNumber
60
- );
56
+ expectedException.expect(IllegalArgumentException.class);
57
+ expectedException.expectMessage("Number must be 10 or 11 digits");
58
+ new PhoneNumber("123456789").getNumber();
61
59
  }
62
60
 
63
61
  @Ignore
@@ -13,7 +13,8 @@
13
13
  "ignored": [
14
14
  "bin",
15
15
  "img",
16
- "docs"
16
+ "docs",
17
+ "juliamnt"
17
18
  ],
18
19
  "foregone": [
19
20
 
@@ -16,14 +16,16 @@ for (root, dirs, files) in walkdir("exercises")
16
16
  cp(joinpath(exercise_path, "example.jl"), joinpath(temp_path, "$exercise.jl"))
17
17
  cp(joinpath(exercise_path, "runtests.jl"), joinpath(temp_path, "runtests.jl"))
18
18
 
19
- # Run the tests
20
- result = @testset "$exercise example" begin
21
- include(joinpath(temp_path, "runtests.jl"))
19
+ try
20
+ # Run the tests
21
+ result = @testset "$exercise example" begin
22
+ include(joinpath(temp_path, "runtests.jl"))
23
+ end
24
+ finally
25
+ # Delete the temporary directory
26
+ rm(temp_path, recursive=true)
22
27
  end
23
28
 
24
- # Delete the temporary directory
25
- rm(temp_path, recursive=true)
26
-
27
29
  # Print test output (this is the default behaviour for older versions of Julia)
28
30
  if VERSION > v"0.6.0-dev"
29
31
  Base.Test.print_test_results(result)
@@ -1,9 +1 @@
1
- /*
2
- In Kotlin functions can be declared at top level in a file, meaning
3
- you do not need to create a class to hold a function, like languages
4
- such as Java, C# or Scala.
5
-
6
- http://kotlinlang.org/docs/reference/functions.html#function-scope
7
- */
8
-
9
1
  fun transcribeToRna(dna: String): String = ""
@@ -3,6 +3,15 @@ import org.junit.Test;
3
3
 
4
4
  class RnaTranscriptionTest {
5
5
 
6
+ /*
7
+ In Kotlin functions can be declared at top level in a file, meaning
8
+ you do not need to create a class to hold a function, like languages
9
+ such as Java, C# or Scala.
10
+
11
+ http://kotlinlang.org/docs/reference/functions.html#function-scope
12
+
13
+ */
14
+
6
15
  @Test
7
16
  fun emptyDnaIsEmptyRna() {
8
17
  Assert.assertEquals("", transcribeToRna(""));
@@ -110,6 +110,9 @@
110
110
  "slug": "space-age",
111
111
  "difficulty": 1,
112
112
  "topics": [
113
+ "Dates",
114
+ "Enumerations",
115
+ "Domain-specific languages"
113
116
  ]
114
117
  },
115
118
  {
@@ -1,3 +1,3 @@
1
- scalaVersion := "2.11.7"
1
+ scalaVersion := "2.12.1"
2
2
 
3
- libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.5" % "test"
3
+ libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
@@ -1,44 +1,33 @@
1
- import java.util.{Calendar, GregorianCalendar}
1
+ import java.time.DayOfWeek
2
+ import java.time.LocalDate
2
3
 
3
4
  case class Meetup(month: Int, year: Int) {
4
- private val thirteenth = new GregorianCalendar(year, month - 1, 13)
5
- private val first = new GregorianCalendar(year, month - 1, 1)
6
- private val nextMonth = first.addMonths(1)
5
+ private val thirteenth = LocalDate.of(year, month, 13)
6
+ private val first = LocalDate.of(year, month, 1)
7
+ private val nextMonth = first.plusMonths(1)
7
8
 
8
- def teenth(day: Int): Calendar = thirteenth.next(day)
9
- def first(day: Int): Calendar = first.next(day)
10
- def second(day: Int): Calendar = first(day).addDays(7)
11
- def third(day: Int): Calendar = second(day).addDays(7)
12
- def fourth(day: Int): Calendar = third(day).addDays(7)
13
- def last(day: Int): Calendar = nextMonth.next(day).addDays(-7)
9
+ def teenth(day: Int): LocalDate = thirteenth.next(day)
10
+ def first(day: Int): LocalDate = first.next(day)
11
+ def second(day: Int): LocalDate = first(day).plusDays(7)
12
+ def third(day: Int): LocalDate = second(day).plusDays(7)
13
+ def fourth(day: Int): LocalDate = third(day).plusDays(7)
14
+ def last(day: Int): LocalDate = nextMonth.next(day).minusDays(7)
14
15
 
15
- implicit class ImmutableCalendar(calendar: Calendar) {
16
- def next(dayOfWeek: Int): Calendar = addDays(daysUntil(dayOfWeek))
16
+ implicit class LocalDateOps(self: LocalDate) {
17
+ def next(dayOfWeek: Int): LocalDate = self.plusDays(daysUntil(dayOfWeek))
17
18
 
18
- def addDays(count: Int): Calendar = copyAnd(_.add(Calendar.DAY_OF_YEAR, count))
19
+ def daysUntil(dayOfWeek: Int): Int = (Meetup.Sun - this.dayOfWeek + dayOfWeek) % 7
19
20
 
20
- def addMonths(count: Int): Calendar = copyAnd(_.add(Calendar.MONTH, count))
21
-
22
- def daysUntil(dayOfWeek: Int): Int = (Meetup.Sat - this.dayOfWeek + dayOfWeek) % 7
23
-
24
- def dayOfWeek: Int = calendar.get(Calendar.DAY_OF_WEEK)
25
-
26
- private def copy: Calendar = calendar.clone.asInstanceOf[Calendar]
27
-
28
- private def copyAnd(f: Calendar => Unit) = {
29
- val c = copy
30
- f(c)
31
- c
32
- }
21
+ def dayOfWeek: Int = self.getDayOfWeek.getValue
33
22
  }
34
23
  }
35
24
 
36
25
  object Meetup {
37
- val Mon = Calendar.MONDAY
38
- val Tue = Calendar.TUESDAY
39
- val Wed = Calendar.WEDNESDAY
40
- val Thu = Calendar.THURSDAY
41
- val Fri = Calendar.FRIDAY
42
- val Sat = Calendar.SATURDAY
43
- val Sun = Calendar.SUNDAY
26
+ val Mon = DayOfWeek.MONDAY.getValue
27
+ val Tue = DayOfWeek.TUESDAY.getValue
28
+ val Wed = DayOfWeek.WEDNESDAY.getValue
29
+ val Thu = DayOfWeek.THURSDAY.getValue
30
+ val Fri = DayOfWeek.FRIDAY.getValue
31
+ val Sat = DayOfWeek.SATURDAY.getValue
32
+ val Sun = DayOfWeek.SUNDAY.getValue
44
33
  }
@@ -1,221 +1,460 @@
1
+ import java.time.LocalDate
1
2
  import org.scalatest._
2
- import java.util.GregorianCalendar
3
3
 
4
4
  class MeetupTest extends FunSuite with Matchers {
5
5
  //Note: Java uses 0-indexed months for GregorianCalendar
6
6
  test ("monteenth of may 2013") {
7
- Meetup(5, 2013).teenth(Meetup.Mon) should be (new GregorianCalendar(2013, 4, 13))
7
+ Meetup(5, 2013).teenth(Meetup.Mon) should be (LocalDate.of(2013, 5, 13))
8
8
  }
9
9
 
10
- test ("teenth respects month") {
10
+ test ("monteenth of august 2013") {
11
11
  pending
12
- Meetup(8, 2013).teenth(Meetup.Mon) should be (new GregorianCalendar(2013, 7, 19))
12
+ Meetup(8, 2013).teenth(Meetup.Mon) should be (LocalDate.of(2013, 8, 19))
13
13
  }
14
14
 
15
- test ("teenth respects year") {
15
+ test ("monteenth of september 2013") {
16
16
  pending
17
- Meetup(8, 2016).teenth(Meetup.Mon) should be (new GregorianCalendar(2016, 7, 15))
17
+ Meetup(9, 2013).teenth(Meetup.Mon) should be (LocalDate.of(2013, 9, 16))
18
18
  }
19
19
 
20
- test ("teenth respects weekday") {
20
+ test ("tuesteenth of march 2013") {
21
21
  pending
22
- Meetup(3, 2013).teenth(Meetup.Tue) should be (new GregorianCalendar(2013, 2, 19))
22
+ Meetup(3, 2013).teenth(Meetup.Tue) should be (LocalDate.of(2013, 3, 19))
23
23
  }
24
24
 
25
- test ("teenth works on a variety of dates") {
25
+ test ("tuesteenth of april 2013") {
26
26
  pending
27
- Meetup(4, 2013).teenth(Meetup.Tue) should be (new GregorianCalendar(2013, 3, 16))
28
- Meetup(8, 2013).teenth(Meetup.Tue) should be (new GregorianCalendar(2013, 7, 13))
29
- Meetup(1, 2013).teenth(Meetup.Wed) should be (new GregorianCalendar(2013, 0, 16))
30
- Meetup(2, 2013).teenth(Meetup.Wed) should be (new GregorianCalendar(2013, 1, 13))
31
- Meetup(6, 2013).teenth(Meetup.Wed) should be (new GregorianCalendar(2013, 5, 19))
32
- Meetup(5, 2013).teenth(Meetup.Thu) should be (new GregorianCalendar(2013, 4, 16))
33
- Meetup(6, 2013).teenth(Meetup.Thu) should be (new GregorianCalendar(2013, 5, 13))
34
- Meetup(9, 2013).teenth(Meetup.Thu) should be (new GregorianCalendar(2013, 8, 19))
35
- Meetup(4, 2013).teenth(Meetup.Fri) should be (new GregorianCalendar(2013, 3, 19))
36
- Meetup(8, 2013).teenth(Meetup.Fri) should be (new GregorianCalendar(2013, 7, 16))
37
- Meetup(9, 2013).teenth(Meetup.Fri) should be (new GregorianCalendar(2013, 8, 13))
38
- Meetup(2, 2013).teenth(Meetup.Sat) should be (new GregorianCalendar(2013, 1, 16))
39
- Meetup(4, 2013).teenth(Meetup.Sat) should be (new GregorianCalendar(2013, 3, 13))
40
- Meetup(10, 2013).teenth(Meetup.Sat) should be (new GregorianCalendar(2013, 9, 19))
41
- Meetup(5, 2013).teenth(Meetup.Sun) should be (new GregorianCalendar(2013, 4, 19))
42
- Meetup(6, 2013).teenth(Meetup.Sun) should be (new GregorianCalendar(2013, 5, 16))
43
- Meetup(10, 2013).teenth(Meetup.Sun) should be (new GregorianCalendar(2013, 9, 13))
27
+ Meetup(4, 2013).teenth(Meetup.Tue) should be (LocalDate.of(2013, 4, 16))
28
+ }
29
+
30
+ test ("tuesteenth of august 2013") {
31
+ pending
32
+ Meetup(8, 2013).teenth(Meetup.Tue) should be (LocalDate.of(2013, 8, 13))
33
+ }
34
+
35
+ test ("wednesteenth of january 2013") {
36
+ pending
37
+ Meetup(1, 2013).teenth(Meetup.Wed) should be (LocalDate.of(2013, 1, 16))
38
+ }
39
+
40
+ test ("wednesteenth of february 2013") {
41
+ pending
42
+ Meetup(2, 2013).teenth(Meetup.Wed) should be (LocalDate.of(2013, 2, 13))
43
+ }
44
+
45
+ test ("wednesteenth of june 2013") {
46
+ pending
47
+ Meetup(6, 2013).teenth(Meetup.Wed) should be (LocalDate.of(2013, 6, 19))
48
+ }
49
+
50
+ test ("thursteenth of may 2013") {
51
+ pending
52
+ Meetup(5, 2013).teenth(Meetup.Thu) should be (LocalDate.of(2013, 5, 16))
53
+ }
54
+
55
+ test ("thursteenth of june 2013") {
56
+ pending
57
+ Meetup(6, 2013).teenth(Meetup.Thu) should be (LocalDate.of(2013, 6, 13))
58
+ }
59
+
60
+ test ("thursteenth of september 2013") {
61
+ pending
62
+ Meetup(9, 2013).teenth(Meetup.Thu) should be (LocalDate.of(2013, 9, 19))
63
+ }
64
+
65
+ test ("friteenth of april 2013") {
66
+ pending
67
+ Meetup(4, 2013).teenth(Meetup.Fri) should be (LocalDate.of(2013, 4, 19))
68
+ }
69
+
70
+ test ("friteenth of august 2013") {
71
+ pending
72
+ Meetup(8, 2013).teenth(Meetup.Fri) should be (LocalDate.of(2013, 8, 16))
73
+ }
74
+
75
+ test ("friteenth of september 2013") {
76
+ pending
77
+ Meetup(9, 2013).teenth(Meetup.Fri) should be (LocalDate.of(2013, 9, 13))
78
+ }
79
+
80
+ test ("saturteenth of february 2013") {
81
+ pending
82
+ Meetup(2, 2013).teenth(Meetup.Sat) should be (LocalDate.of(2013, 2, 16))
83
+ }
84
+
85
+ test ("saturteenth of april 2013") {
86
+ pending
87
+ Meetup(4, 2013).teenth(Meetup.Sat) should be (LocalDate.of(2013, 4, 13))
88
+ }
89
+
90
+ test ("saturteenth of october 2013") {
91
+ pending
92
+ Meetup(10, 2013).teenth(Meetup.Sat) should be (LocalDate.of(2013, 10, 19))
93
+ }
94
+
95
+ test ("sunteenth of may 2013") {
96
+ pending
97
+ Meetup(5, 2013).teenth(Meetup.Sun) should be (LocalDate.of(2013, 5, 19))
98
+ }
99
+
100
+ test ("sunteenth of june 2013") {
101
+ pending
102
+ Meetup(6, 2013).teenth(Meetup.Sun) should be (LocalDate.of(2013, 6, 16))
103
+ }
104
+
105
+ test ("sunteenth of october 2013") {
106
+ pending
107
+ Meetup(10, 2013).teenth(Meetup.Sun) should be (LocalDate.of(2013, 10, 13))
44
108
  }
45
109
 
46
110
  test ("first monday of march 2013") {
47
111
  pending
48
- Meetup(3, 2013).first(Meetup.Mon) should be (new GregorianCalendar(2013, 2, 4))
112
+ Meetup(3, 2013).first(Meetup.Mon) should be (LocalDate.of(2013, 3, 4))
113
+ }
114
+
115
+ test ("first monday of april 2013") {
116
+ pending
117
+ Meetup(4, 2013).first(Meetup.Mon) should be (LocalDate.of(2013, 4, 1))
118
+ }
119
+
120
+ test ("first tuesday of may 2013") {
121
+ pending
122
+ Meetup(5, 2013).first(Meetup.Tue) should be (LocalDate.of(2013, 5, 7))
123
+ }
124
+
125
+ test ("first tuesday of june 2013") {
126
+ pending
127
+ Meetup(6, 2013).first(Meetup.Tue) should be (LocalDate.of(2013, 6, 4))
128
+ }
129
+
130
+ test ("first wednesday of july 2013") {
131
+ pending
132
+ Meetup(7, 2013).first(Meetup.Wed) should be (LocalDate.of(2013, 7, 3))
133
+ }
134
+
135
+ test ("first wednesday of august 2013") {
136
+ pending
137
+ Meetup(8, 2013).first(Meetup.Wed) should be (LocalDate.of(2013, 8, 7))
138
+ }
139
+
140
+ test ("first thursday of september 2013") {
141
+ pending
142
+ Meetup(9, 2013).first(Meetup.Thu) should be (LocalDate.of(2013, 9, 5))
143
+ }
144
+
145
+ test ("first thursday of october 2013") {
146
+ pending
147
+ Meetup(10, 2013).first(Meetup.Thu) should be (LocalDate.of(2013, 10, 3))
49
148
  }
50
149
 
51
- test ("first respects month") {
150
+ test ("first friday of november 2013") {
52
151
  pending
53
- Meetup(4, 2013).first(Meetup.Mon) should be (new GregorianCalendar(2013, 3, 1))
152
+ Meetup(11, 2013).first(Meetup.Fri) should be (LocalDate.of(2013, 11, 1))
54
153
  }
55
154
 
56
- test ("first respects year") {
155
+ test ("first friday of december 2013") {
57
156
  pending
58
- Meetup(5, 2016).first(Meetup.Mon) should be (new GregorianCalendar(2016, 4, 2))
157
+ Meetup(12, 2013).first(Meetup.Fri) should be (LocalDate.of(2013, 12, 6))
59
158
  }
60
159
 
61
- test ("first respects weekday") {
160
+ test ("first saturday of january 2013") {
62
161
  pending
63
- Meetup(6, 2013).first(Meetup.Tue) should be (new GregorianCalendar(2013, 5, 4))
162
+ Meetup(1, 2013).first(Meetup.Sat) should be (LocalDate.of(2013, 1, 5))
64
163
  }
65
164
 
66
- test ("first works on a variety of dates") {
165
+ test ("first saturday of february 2013") {
67
166
  pending
68
- Meetup(7, 2013).first(Meetup.Wed) should be (new GregorianCalendar(2013, 6, 3))
69
- Meetup(8, 2013).first(Meetup.Wed) should be (new GregorianCalendar(2013, 7, 7))
70
- Meetup(9, 2013).first(Meetup.Thu) should be (new GregorianCalendar(2013, 8, 5))
71
- Meetup(10, 2013).first(Meetup.Thu) should be (new GregorianCalendar(2013, 9, 3))
72
- Meetup(11, 2013).first(Meetup.Fri) should be (new GregorianCalendar(2013, 10, 1))
73
- Meetup(12, 2013).first(Meetup.Fri) should be (new GregorianCalendar(2013, 11, 6))
74
- Meetup(1, 2013).first(Meetup.Sat) should be (new GregorianCalendar(2013, 0, 5))
75
- Meetup(2, 2013).first(Meetup.Sat) should be (new GregorianCalendar(2013, 1, 2))
76
- Meetup(3, 2013).first(Meetup.Sun) should be (new GregorianCalendar(2013, 2, 3))
77
- Meetup(4, 2013).first(Meetup.Sun) should be (new GregorianCalendar(2013, 3, 7))
167
+ Meetup(2, 2013).first(Meetup.Sat) should be (LocalDate.of(2013, 2, 2))
168
+ }
169
+
170
+ test ("first sunday of march 2013") {
171
+ pending
172
+ Meetup(3, 2013).first(Meetup.Sun) should be (LocalDate.of(2013, 3, 3))
173
+ }
174
+
175
+ test ("first sunday of april 2013") {
176
+ pending
177
+ Meetup(4, 2013).first(Meetup.Sun) should be (LocalDate.of(2013, 4, 7))
78
178
  }
79
179
 
80
180
  test ("second monday of march 2013") {
81
181
  pending
82
- Meetup(3, 2013).second(Meetup.Mon) should be (new GregorianCalendar(2013, 2, 11))
182
+ Meetup(3, 2013).second(Meetup.Mon) should be (LocalDate.of(2013, 3, 11))
183
+ }
184
+
185
+ test ("second monday of april 2013") {
186
+ pending
187
+ Meetup(4, 2013).second(Meetup.Mon) should be (LocalDate.of(2013, 4, 8))
188
+ }
189
+
190
+ test ("second tuesday of may 2013") {
191
+ pending
192
+ Meetup(5, 2013).second(Meetup.Tue) should be (LocalDate.of(2013, 5, 14))
193
+ }
194
+
195
+ test ("second tuesday of june 2013") {
196
+ pending
197
+ Meetup(6, 2013).second(Meetup.Tue) should be (LocalDate.of(2013, 6, 11))
83
198
  }
84
199
 
85
- test ("second respects month") {
200
+ test ("second wednesday of july 2013") {
86
201
  pending
87
- Meetup(4, 2013).second(Meetup.Mon) should be (new GregorianCalendar(2013, 3, 8))
202
+ Meetup(7, 2013).second(Meetup.Wed) should be (LocalDate.of(2013, 7, 10))
88
203
  }
89
204
 
90
- test ("second respects year") {
205
+ test ("second wednesday of august 2013") {
91
206
  pending
92
- Meetup(5, 2016).second(Meetup.Mon) should be (new GregorianCalendar(2016, 4, 9))
207
+ Meetup(8, 2013).second(Meetup.Wed) should be (LocalDate.of(2013, 8, 14))
93
208
  }
94
209
 
95
- test ("second respects weekday") {
210
+ test ("second thursday of september 2013") {
96
211
  pending
97
- Meetup(6, 2013).second(Meetup.Tue) should be (new GregorianCalendar(2013, 5, 11))
212
+ Meetup(9, 2013).second(Meetup.Thu) should be (LocalDate.of(2013, 9, 12))
98
213
  }
99
214
 
100
- test ("second works on a variety of dates") {
215
+ test ("second thursday of october 2013") {
101
216
  pending
102
- Meetup(7, 2013).second(Meetup.Wed) should be (new GregorianCalendar(2013, 6, 10))
103
- Meetup(8, 2013).second(Meetup.Wed) should be (new GregorianCalendar(2013, 7, 14))
104
- Meetup(9, 2013).second(Meetup.Thu) should be (new GregorianCalendar(2013, 8, 12))
105
- Meetup(10, 2013).second(Meetup.Thu) should be (new GregorianCalendar(2013, 9, 10))
106
- Meetup(11, 2013).second(Meetup.Fri) should be (new GregorianCalendar(2013, 10, 8))
107
- Meetup(12, 2013).second(Meetup.Fri) should be (new GregorianCalendar(2013, 11, 13))
108
- Meetup(1, 2013).second(Meetup.Sat) should be (new GregorianCalendar(2013, 0, 12))
109
- Meetup(2, 2013).second(Meetup.Sat) should be (new GregorianCalendar(2013, 1, 9))
110
- Meetup(3, 2013).second(Meetup.Sun) should be (new GregorianCalendar(2013, 2, 10))
111
- Meetup(4, 2013).second(Meetup.Sun) should be (new GregorianCalendar(2013, 3, 14))
217
+ Meetup(10, 2013).second(Meetup.Thu) should be (LocalDate.of(2013, 10, 10))
218
+ }
219
+
220
+ test ("second friday of november 2013") {
221
+ pending
222
+ Meetup(11, 2013).second(Meetup.Fri) should be (LocalDate.of(2013, 11, 8))
223
+ }
224
+
225
+ test ("second friday of december 2013") {
226
+ pending
227
+ Meetup(12, 2013).second(Meetup.Fri) should be (LocalDate.of(2013, 12, 13))
228
+ }
229
+
230
+ test ("second saturday of january 2013") {
231
+ pending
232
+ Meetup(1, 2013).second(Meetup.Sat) should be (LocalDate.of(2013, 1, 12))
233
+ }
234
+
235
+ test ("second saturday of february 2013") {
236
+ pending
237
+ Meetup(2, 2013).second(Meetup.Sat) should be (LocalDate.of(2013, 2, 9))
238
+ }
239
+
240
+ test ("second sunday of march 2013") {
241
+ pending
242
+ Meetup(3, 2013).second(Meetup.Sun) should be (LocalDate.of(2013, 3, 10))
243
+ }
244
+
245
+ test ("second sunday of april 2013") {
246
+ pending
247
+ Meetup(4, 2013).second(Meetup.Sun) should be (LocalDate.of(2013, 4, 14))
112
248
  }
113
249
 
114
250
  test ("third monday of march 2013") {
115
251
  pending
116
- Meetup(3, 2013).third(Meetup.Mon) should be (new GregorianCalendar(2013, 2, 18))
252
+ Meetup(3, 2013).third(Meetup.Mon) should be (LocalDate.of(2013, 3, 18))
253
+ }
254
+
255
+ test ("third monday of april 2013") {
256
+ pending
257
+ Meetup(4, 2013).third(Meetup.Mon) should be (LocalDate.of(2013, 4, 15))
258
+ }
259
+
260
+ test ("third tuesday of may 2013") {
261
+ pending
262
+ Meetup(5, 2013).third(Meetup.Tue) should be (LocalDate.of(2013, 5, 21))
263
+ }
264
+
265
+ test ("third tuesday of june 2013") {
266
+ pending
267
+ Meetup(6, 2013).third(Meetup.Tue) should be (LocalDate.of(2013, 6, 18))
268
+ }
269
+
270
+ test ("third wednesday of july 2013") {
271
+ pending
272
+ Meetup(7, 2013).third(Meetup.Wed) should be (LocalDate.of(2013, 7, 17))
117
273
  }
118
274
 
119
- test ("third respects month") {
275
+ test ("third wednesday of august 2013") {
120
276
  pending
121
- Meetup(4, 2013).third(Meetup.Mon) should be (new GregorianCalendar(2013, 3, 15))
277
+ Meetup(8, 2013).third(Meetup.Wed) should be (LocalDate.of(2013, 8, 21))
122
278
  }
123
279
 
124
- test ("third respects year") {
280
+ test ("third thursday of september 2013") {
125
281
  pending
126
- Meetup(5, 2016).third(Meetup.Mon) should be (new GregorianCalendar(2016, 4, 16))
282
+ Meetup(9, 2013).third(Meetup.Thu) should be (LocalDate.of(2013, 9, 19))
127
283
  }
128
284
 
129
- test ("third respects weekday") {
285
+ test ("third thursday of october 2013") {
130
286
  pending
131
- Meetup(6, 2013).third(Meetup.Tue) should be (new GregorianCalendar(2013, 5, 18))
287
+ Meetup(10, 2013).third(Meetup.Thu) should be (LocalDate.of(2013, 10, 17))
132
288
  }
133
289
 
134
- test ("third works for a variety of dates") {
290
+ test ("third friday of november 2013") {
135
291
  pending
136
- Meetup(7, 2013).third(Meetup.Wed) should be (new GregorianCalendar(2013, 6, 17))
137
- Meetup(8, 2013).third(Meetup.Wed) should be (new GregorianCalendar(2013, 7, 21))
138
- Meetup(9, 2013).third(Meetup.Thu) should be (new GregorianCalendar(2013, 8, 19))
139
- Meetup(10, 2013).third(Meetup.Thu) should be (new GregorianCalendar(2013, 9, 17))
140
- Meetup(11, 2013).third(Meetup.Fri) should be (new GregorianCalendar(2013, 10, 15))
141
- Meetup(12, 2013).third(Meetup.Fri) should be (new GregorianCalendar(2013, 11, 20))
142
- Meetup(1, 2013).third(Meetup.Sat) should be (new GregorianCalendar(2013, 0, 19))
143
- Meetup(2, 2013).third(Meetup.Sat) should be (new GregorianCalendar(2013, 1, 16))
144
- Meetup(3, 2013).third(Meetup.Sun) should be (new GregorianCalendar(2013, 2, 17))
145
- Meetup(4, 2013).third(Meetup.Sun) should be (new GregorianCalendar(2013, 3, 21))
292
+ Meetup(11, 2013).third(Meetup.Fri) should be (LocalDate.of(2013, 11, 15))
293
+ }
294
+
295
+ test ("third friday of december 2013") {
296
+ pending
297
+ Meetup(12, 2013).third(Meetup.Fri) should be (LocalDate.of(2013, 12, 20))
298
+ }
299
+
300
+ test ("third saturday of january 2013") {
301
+ pending
302
+ Meetup(1, 2013).third(Meetup.Sat) should be (LocalDate.of(2013, 1, 19))
303
+ }
304
+
305
+ test ("third saturday of february 2013") {
306
+ pending
307
+ Meetup(2, 2013).third(Meetup.Sat) should be (LocalDate.of(2013, 2, 16))
308
+ }
309
+
310
+ test ("third sunday of march 2013") {
311
+ pending
312
+ Meetup(3, 2013).third(Meetup.Sun) should be (LocalDate.of(2013, 3, 17))
313
+ }
314
+
315
+ test ("third sunday of april 2013") {
316
+ pending
317
+ Meetup(4, 2013).third(Meetup.Sun) should be (LocalDate.of(2013, 4, 21))
146
318
  }
147
319
 
148
320
  test ("fourth monday of march 2013") {
149
321
  pending
150
- Meetup(3, 2013).fourth(Meetup.Mon) should be (new GregorianCalendar(2013, 2, 25))
322
+ Meetup(3, 2013).fourth(Meetup.Mon) should be (LocalDate.of(2013, 3, 25))
323
+ }
324
+
325
+ test ("fourth monday of april 2013") {
326
+ pending
327
+ Meetup(4, 2013).fourth(Meetup.Mon) should be (LocalDate.of(2013, 4, 22))
328
+ }
329
+
330
+ test ("fourth tuesday of may 2013") {
331
+ pending
332
+ Meetup(5, 2013).fourth(Meetup.Tue) should be (LocalDate.of(2013, 5, 28))
333
+ }
334
+
335
+ test ("fourth tuesday of june 2013") {
336
+ pending
337
+ Meetup(6, 2013).fourth(Meetup.Tue) should be (LocalDate.of(2013, 6, 25))
338
+ }
339
+
340
+ test ("fourth wednesday of july 2013") {
341
+ pending
342
+ Meetup(7, 2013).fourth(Meetup.Wed) should be (LocalDate.of(2013, 7, 24))
343
+ }
344
+
345
+ test ("fourth wednesday of august 2013") {
346
+ pending
347
+ Meetup(8, 2013).fourth(Meetup.Wed) should be (LocalDate.of(2013, 8, 28))
348
+ }
349
+
350
+ test ("fourth thursday of september 2013") {
351
+ pending
352
+ Meetup(9, 2013).fourth(Meetup.Thu) should be (LocalDate.of(2013, 9, 26))
151
353
  }
152
354
 
153
- test ("fourth respects month") {
355
+ test ("fourth thursday of october 2013") {
154
356
  pending
155
- Meetup(4, 2013).fourth(Meetup.Mon) should be (new GregorianCalendar(2013, 3, 22))
357
+ Meetup(10, 2013).fourth(Meetup.Thu) should be (LocalDate.of(2013, 10, 24))
156
358
  }
157
359
 
158
- test ("fourth respects year") {
360
+ test ("fourth friday of november 2013") {
159
361
  pending
160
- Meetup(5, 2016).fourth(Meetup.Mon) should be (new GregorianCalendar(2016, 4, 23))
362
+ Meetup(11, 2013).fourth(Meetup.Fri) should be (LocalDate.of(2013, 11, 22))
161
363
  }
162
364
 
163
- test ("fourth respects weekday") {
365
+ test ("fourth friday of december 2013") {
164
366
  pending
165
- Meetup(6, 2013).fourth(Meetup.Tue) should be (new GregorianCalendar(2013, 5, 25))
367
+ Meetup(12, 2013).fourth(Meetup.Fri) should be (LocalDate.of(2013, 12, 27))
166
368
  }
167
369
 
168
- test ("fourth works on a variety of dates") {
370
+ test ("fourth saturday of january 2013") {
169
371
  pending
170
- Meetup(7, 2013).fourth(Meetup.Wed) should be (new GregorianCalendar(2013, 6, 24))
171
- Meetup(8, 2013).fourth(Meetup.Wed) should be (new GregorianCalendar(2013, 7, 28))
172
- Meetup(9, 2013).fourth(Meetup.Thu) should be (new GregorianCalendar(2013, 8, 26))
173
- Meetup(10, 2013).fourth(Meetup.Thu) should be (new GregorianCalendar(2013, 9, 24))
174
- Meetup(11, 2013).fourth(Meetup.Fri) should be (new GregorianCalendar(2013, 10, 22))
175
- Meetup(12, 2013).fourth(Meetup.Fri) should be (new GregorianCalendar(2013, 11, 27))
176
- Meetup(1, 2013).fourth(Meetup.Sat) should be (new GregorianCalendar(2013, 0, 26))
177
- Meetup(2, 2013).fourth(Meetup.Sat) should be (new GregorianCalendar(2013, 1, 23))
178
- Meetup(3, 2013).fourth(Meetup.Sun) should be (new GregorianCalendar(2013, 2, 24))
179
- Meetup(4, 2013).fourth(Meetup.Sun) should be (new GregorianCalendar(2013, 3, 28))
372
+ Meetup(1, 2013).fourth(Meetup.Sat) should be (LocalDate.of(2013, 1, 26))
373
+ }
374
+
375
+ test ("fourth saturday of february 2013") {
376
+ pending
377
+ Meetup(2, 2013).fourth(Meetup.Sat) should be (LocalDate.of(2013, 2, 23))
378
+ }
379
+
380
+ test ("fourth sunday of march 2013") {
381
+ pending
382
+ Meetup(3, 2013).fourth(Meetup.Sun) should be (LocalDate.of(2013, 3, 24))
383
+ }
384
+
385
+ test ("fourth sunday of april 2013") {
386
+ pending
387
+ Meetup(4, 2013).fourth(Meetup.Sun) should be (LocalDate.of(2013, 4, 28))
180
388
  }
181
389
 
182
390
  test ("last monday of march 2013") {
183
391
  pending
184
- Meetup(3, 2013).last(Meetup.Mon) should be (new GregorianCalendar(2013, 2, 25))
392
+ Meetup(3, 2013).last(Meetup.Mon) should be (LocalDate.of(2013, 3, 25))
393
+ }
394
+
395
+ test ("last monday of april 2013") {
396
+ pending
397
+ Meetup(4, 2013).last(Meetup.Mon) should be (LocalDate.of(2013, 4, 29))
185
398
  }
186
399
 
187
- test ("last respects month") {
400
+ test ("last tuesday of may 2013") {
188
401
  pending
189
- Meetup(4, 2013).last(Meetup.Mon) should be (new GregorianCalendar(2013, 3, 29))
402
+ Meetup(5, 2013).last(Meetup.Tue) should be (LocalDate.of(2013, 5, 28))
190
403
  }
191
404
 
192
- test ("last respects year") {
405
+ test ("last tuesday of june 2013") {
193
406
  pending
194
- Meetup(6, 2016).last(Meetup.Mon) should be (new GregorianCalendar(2016, 5, 27))
407
+ Meetup(6, 2013).last(Meetup.Tue) should be (LocalDate.of(2013, 6, 25))
195
408
  }
196
409
 
197
- test ("last respects weekday") {
410
+ test ("last wednesday of july 2013") {
198
411
  pending
199
- Meetup(5, 2013).last(Meetup.Tue) should be (new GregorianCalendar(2013, 4, 28))
412
+ Meetup(7, 2013).last(Meetup.Wed) should be (LocalDate.of(2013, 7, 31))
200
413
  }
201
414
 
202
- test ("works on a leap year") {
415
+ test ("last wednesday of august 2013") {
203
416
  pending
204
- Meetup(2, 2016).last(Meetup.Sun) should be (new GregorianCalendar(2016, 1, 28))
205
- Meetup(2, 2016).last(Meetup.Mon) should be (new GregorianCalendar(2016, 1, 29))
417
+ Meetup(8, 2013).last(Meetup.Wed) should be (LocalDate.of(2013, 8, 28))
206
418
  }
207
419
 
208
- test ("last works on a variety of dates") {
420
+ test ("last thursday of september 2013") {
209
421
  pending
210
- Meetup(7, 2013).last(Meetup.Wed) should be (new GregorianCalendar(2013, 6, 31))
211
- Meetup(8, 2013).last(Meetup.Wed) should be (new GregorianCalendar(2013, 7, 28))
212
- Meetup(9, 2013).last(Meetup.Thu) should be (new GregorianCalendar(2013, 8, 26))
213
- Meetup(10, 2013).last(Meetup.Thu) should be (new GregorianCalendar(2013, 9, 31))
214
- Meetup(11, 2013).last(Meetup.Fri) should be (new GregorianCalendar(2013, 10, 29))
215
- Meetup(12, 2013).last(Meetup.Fri) should be (new GregorianCalendar(2013, 11, 27))
216
- Meetup(1, 2013).last(Meetup.Sat) should be (new GregorianCalendar(2013, 0, 26))
217
- Meetup(2, 2013).last(Meetup.Sat) should be (new GregorianCalendar(2013, 1, 23))
218
- Meetup(3, 2013).last(Meetup.Sun) should be (new GregorianCalendar(2013, 2, 31))
219
- Meetup(4, 2013).last(Meetup.Sun) should be (new GregorianCalendar(2013, 3, 28))
422
+ Meetup(9, 2013).last(Meetup.Thu) should be (LocalDate.of(2013, 9, 26))
423
+ }
424
+
425
+ test ("last thursday of october 2013") {
426
+ pending
427
+ Meetup(10, 2013).last(Meetup.Thu) should be (LocalDate.of(2013, 10, 31))
428
+ }
429
+
430
+ test ("last friday of november 2013") {
431
+ pending
432
+ Meetup(11, 2013).last(Meetup.Fri) should be (LocalDate.of(2013, 11, 29))
433
+ }
434
+
435
+ test ("last friday of december 2013") {
436
+ pending
437
+ Meetup(12, 2013).last(Meetup.Fri) should be (LocalDate.of(2013, 12, 27))
438
+ }
439
+
440
+ test ("last saturday of january 2013") {
441
+ pending
442
+ Meetup(1, 2013).last(Meetup.Sat) should be (LocalDate.of(2013, 1, 26))
443
+ }
444
+
445
+ test ("last saturday of february 2013") {
446
+ pending
447
+ Meetup(2, 2013).last(Meetup.Sat) should be (LocalDate.of(2013, 2, 23))
448
+ }
449
+
450
+ test ("last sunday of march 2013") {
451
+ pending
452
+ Meetup(3, 2013).last(Meetup.Sun) should be (LocalDate.of(2013, 3, 31))
453
+ }
454
+
455
+ test ("last sunday of april 2013") {
456
+ pending
457
+ Meetup(4, 2013).last(Meetup.Sun) should be (LocalDate.of(2013, 4, 28))
220
458
  }
221
459
  }
460
+