'Asserts that an observer created by L{jsonFileLogObserver} with the
given arguments writes events serialized as JSON text, using the given
record separator.
@param recordSeparator: A record separator.
@type recordSeparator: L{unicode}
@param kwargs: Keyword arguments to pass to L{jsonFileLogObserver}.
@type kwargs: L{dict}'

def assertObserverWritesJSON(self, **kwargs):

    recordSeparator = kwargs.get('recordSeparator', u'\x1e')
    with StringIO() as fileHandle:
        observer = jsonFileLogObserver(fileHandle, **kwargs)
        event = dict(x=1)
        observer(event)
        self.assertEqual(fileHandle.getvalue(), u'{0}{{"x":    1}}\n'.format(recordSeparator))
