Skip to content

Commit 76c375d

Browse files
committed
a few comments and koans added
1 parent bd2660e commit 76c375d

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

‎koans/src/beginner/AboutAssertions.java‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package beginner;
22

3-
// FYI - usually bad practice to import statically, but can make code cleaner
4-
53
import com.sandwich.koan.Koan;
64

75
import static com.sandwich.koan.constant.KoanConstants.__;
@@ -11,7 +9,8 @@ public class AboutAssertions {
119

1210
@Koan
1311
public void assertBooleanTrue() {
14-
assertTrue(__); // should be true really
12+
// there are two possibilities, true or false, what would it be here?
13+
assertTrue(__);
1514
}
1615

1716
@Koan
@@ -21,12 +20,21 @@ public void assertBooleanFalse() {
2120

2221
@Koan
2322
public void assertNullObject() {
23+
// reference to the object can be null, a magic keyword, null, which means
24+
// that there is nothing there
2425
assertNull(__);
2526
}
2627

28+
@Koan
29+
public void assertNullObjectReference() {
30+
Object someObject = __;
31+
assertNull(someObject);
32+
}
33+
2734
@Koan
2835
public void assertNotNullObject() {
29-
assertNotNull(null); // anything other than null should pass here...
36+
// but what when there should not be a null value?
37+
assertNotNull(null);
3038
}
3139

3240
@Koan
@@ -35,7 +43,8 @@ public void assertEqualsUsingExpression() {
3543
}
3644

3745
@Koan
38-
public void assertEqualsWithBetterFailureMessage() {
46+
public void assertEqualsUsingBetterAssert() {
47+
assertEquals("Hello World!", __);
3948
assertEquals(1, __);
4049
}
4150

@@ -49,6 +58,8 @@ public void assertEqualsWithDescriptiveMessage() {
4958

5059
@Koan
5160
public void assertSameInstance() {
61+
// Just because something is equal doesn't mean that it is the same.
62+
// It's only the same if the reference is the same.
5263
Object same = new Integer(1);
5364
Object sameReference = __;
5465
assertSame(same, sameReference);

‎koans/src/beginner/AboutKoans.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ public class AboutKoans {
88

99
@Koan
1010
public void findAboutKoansFile() {
11-
fail("delete this line");
11+
// Hello, I'm a koan. I'm a piece of code, piece of wisdom,
12+
// which you learn JAVA with. Every koan is a small task to solve.
13+
// To solve it is to make it pass, or not to fail.
14+
fail("delete this line or a koan will fail");
1215
}
1316

1417
@Koan
1518
public void definitionOfKoanCompletion() {
1619
boolean koanIsComplete = false;
1720
if (!koanIsComplete) {
18-
fail("what if koanIsComplete was true?");
21+
fail("what if koanIsComplete variable was true?");
1922
}
2023
}
2124

0 commit comments

Comments
 (0)