'If data is passed to L{_IdentityTransferDecoder.dataReceived} after the
finish callback has been invoked, C{RuntimeError} is raised.'

def test_rejectDataAfterFinished(self):

    failures = []
    def finish(bytes):
        try:
            decoder.dataReceived('foo')
        except:
            failures.append(Failure())
    decoder = _IdentityTransferDecoder(5, self.data.append, finish)
    decoder.dataReceived(('x' * 4))
    self.assertEqual(failures, [])
    decoder.dataReceived('y')
    failures[0].trap(RuntimeError)
    self.assertEqual(str(failures[0].value), '_IdentityTransferDecoder    cannot    decode    data    after    finishing')
