 
 class JSQNotificationObserverKitTests: XCTestCase {
 
-    func test() {
+    func test_ThatNotificationIsPosted_AndReceivedByObserver_WithValueAndSender() {
 
-        // GIVEN: a notification, sender, and observer
-        let fakeSender = FakeSender()
-        let fakeValue = FakeValue()
-        let notification = Notification<FakeValue, FakeSender>(name: "\(__FUNCTION__)", sender: fakeSender)
+        // GIVEN: a sender, value, notification, and observer
+        let fakeSender = TestSender()
+        let fakeValue = TestValue()
+        let notification = Notification<TestValue, TestSender>(name: "\(__FUNCTION__)", sender: fakeSender)
 
         let expectation = self.expectationWithDescription("\(__FUNCTION__)")
 


// MARK: Fakes

class FakeSender {
    let sender = NSUUID().UUIDString
}

struct FakeValue {
    let value = NSUUID().UUIDString
}


            expectation.fulfill()
        }

        // WHEN: the notification is posted
        postNotification(notification, value: fakeValue)

        // THEN: the observer receives the notification and executes its handler
        self.waitForExpectationsWithTimeout(2, handler: { (error) -> Void in
            XCTAssertNil(error, "Expectation should not error")
        })
    }

    func test_ThatNotificationIsPosted_AndReceivedByObserver_WithValueOnly() {

        // GIVEN: value, notification without a sender, and observer
        let fakeValue = TestValue()
        let notification = Notification<TestValue, AnyObject>(name: "\(__FUNCTION__)")

        let expectation = self.expectationWithDescription("\(__FUNCTION__)")

        let observer = NotificationObserver(notification: notification) { (value, sender) -> Void in

            XCTAssertEqual(value.value, fakeValue.value, "Values should be equal")
            XCTAssertNil(sender, "Sender should be nil")

            expectation.fulfill()
        }

        // WHEN: the notification is posted without a specific sender
        postNotification(notification, value: fakeValue)

        // THEN: the observer receives the notification and executes its handler
        self.waitForExpectationsWithTimeout(2, handler: { (error) -> Void in
            XCTAssertNil(error, "Expectation should not error")
        })
    }

    func test_ThatObserverUnregistersForNotificationsOnDeinit() {

        // GIVEN: a value, notification, and observer
        let fakeValue = TestValue()
        let notification = Notification<TestValue, AnyObject>(name: "\(__FUNCTION__)")

        var didCallHandler = false
        var observer: NotificationObserver? = NotificationObserver(notification: notification) { (value, sender) -> Void in
            didCallHandler = true
        }

        observer = nil

        // WHEN: the notification is posted after the observer is dealloc'd
        postNotification(notification, value: fakeValue)

        // THEN: the observer does not receive the notification and does not execute its handler
        XCTAssertFalse(didCallHandler)
    }

    
}
