Skip to content

Commit

Permalink
Add comment to exmplain type and value of subject inside block (robst…
Browse files Browse the repository at this point in the history
  • Loading branch information
rhushikesh committed Oct 10, 2021
1 parent 04a0e50 commit 68e79ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ class LocalDateTimeExpectationSamples {
fun year() {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56))
.year {
// subject inside this block is of type Int (actually 2021)
toEqual(2021)
toBeGreaterThan(2020)
}

fails {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56))
.year {
// subject inside this block is of type Int (actually 2021)
notToEqual(2022)
toBeGreaterThan(2022)
toBeLessThan(2020)
Expand All @@ -31,13 +33,15 @@ class LocalDateTimeExpectationSamples {
fun month() {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56))
.month {
// subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10)
toEqual(Month.OCTOBER.value)
notToEqual(Month.SEPTEMBER.value)
}

fails {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56))
.month {
// subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10)
toEqual(Month.SEPTEMBER.value)
notToEqual(Month.OCTOBER.value)
}
Expand All @@ -48,13 +52,15 @@ class LocalDateTimeExpectationSamples {
fun dayOfWeek() {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56))
.dayOfWeek {
// subject inside this block is of type DayOfWeek (actually SATURDAY)
toEqual(DayOfWeek.SATURDAY)
notToEqual(DayOfWeek.SUNDAY)
}

fails {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56))
.dayOfWeek {
// subject inside this block is of type DayOfWeek (actually SATURDAY)
toEqual(DayOfWeek.MONDAY)
notToEqual(DayOfWeek.SATURDAY)
}
Expand All @@ -65,13 +71,15 @@ class LocalDateTimeExpectationSamples {
fun day() {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56))
.day {
// subject inside this block is of type Int (actually 9)
toEqual(9)
toBeGreaterThan(5)
}

fails {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56))
.day {
// subject inside this block is of type Int (actually 9)
toEqual(5)
toBeLessThan(7)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ class LocalDateTimeExpectationSamples {
@Test
fun year() {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) year {
// subject inside this block is of type Int (actually 2021)
it toEqual 2021
it toBeGreaterThan 2020
}

fails {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) year {
// subject inside this block is of type Int (actually 2021)
it notToEqual 2022
it toBeGreaterThan 2022
it toBeLessThan 2020
Expand All @@ -28,12 +30,14 @@ class LocalDateTimeExpectationSamples {
@Test
fun month() {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) month {
// subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10)
it toEqual Month.OCTOBER.value
it notToEqual Month.SEPTEMBER.value
}

fails {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) month {
// subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10)
it toEqual Month.SEPTEMBER.value
it notToEqual Month.OCTOBER.value
}
Expand All @@ -43,12 +47,14 @@ class LocalDateTimeExpectationSamples {
@Test
fun dayOfWeek() {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) dayOfWeek {
// subject inside this block is of type DayOfWeek (actually SATURDAY)
it toEqual DayOfWeek.SATURDAY
it notToEqual DayOfWeek.SUNDAY
}

fails {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) dayOfWeek {
// subject inside this block is of type DayOfWeek (actually SATURDAY)
it toEqual DayOfWeek.MONDAY
it notToEqual DayOfWeek.SATURDAY
}
Expand All @@ -58,12 +64,14 @@ class LocalDateTimeExpectationSamples {
@Test
fun day() {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) day {
// subject inside this block is of type Int (actually 9)
it toEqual 9
it toBeGreaterThan 5
}

fails {
expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) day {
// subject inside this block is of type Int (actually 9)
it toEqual 5
it toBeLessThan 7
}
Expand Down

0 comments on commit 68e79ff

Please sign in to comment.