'A generic test for NMEA receiver behavior.
@param sentences: The sequence of sentences to simulate receiving.
@type sentences: iterable of C{str}
@param expectedFired: The names of the callbacks expected to fire.
@type expectedFired: iterable of C{str}
@param extraTest: An optional extra test hook.
@type extraTest: nullary callable'

def _receiverTest(self, sentences, expectedFired=(), extraTest=None):

    for sentence in sentences:
        self.protocol.lineReceived(sentence)
    actuallyFired = self.receiver.called.keys()
    self.assertEqual(set(actuallyFired), set(expectedFired))
    if (extraTest is not None):
        extraTest()
    self.receiver.clear()
    self.adapter.clear()
