11package beginner ;
22
3- // FYI - usually bad practice to import statically, but can make code cleaner
4-
53import com .sandwich .koan .Koan ;
64
75import 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 );
0 commit comments