Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8DFC0F60F for ; Sat, 30 Mar 2013 11:56:37 +0000 (UTC) Received: (qmail 75079 invoked by uid 500); 30 Mar 2013 11:56:37 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 74828 invoked by uid 500); 30 Mar 2013 11:56:36 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 74773 invoked by uid 99); 30 Mar 2013 11:56:35 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 30 Mar 2013 11:56:35 +0000 Received: from localhost (HELO mail-wg0-f42.google.com) (127.0.0.1) (smtp-auth username britter, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Sat, 30 Mar 2013 11:56:34 +0000 Received: by mail-wg0-f42.google.com with SMTP id k13so1048348wgh.5 for ; Sat, 30 Mar 2013 04:56:33 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.89.169 with SMTP id bp9mr7662876wjb.57.1364644593371; Sat, 30 Mar 2013 04:56:33 -0700 (PDT) Received: by 10.194.7.42 with HTTP; Sat, 30 Mar 2013 04:56:33 -0700 (PDT) Date: Sat, 30 Mar 2013 12:56:33 +0100 Message-ID: Subject: [CSV] Working on the test environment From: Benedikt Ritter To: Commons Developers List Content-Type: multipart/alternative; boundary=047d7bf198943b97d804d92314c3 --047d7bf198943b97d804d92314c3 Content-Type: text/plain; charset=ISO-8859-1 Hi, while working on [CSV-58] - Escape Handling needs rethinking [1] I have come to the conclusion that the test environment needs some clean up. The problem that I see is, that some of the tests test several things at once. That makes it hard to identify what exactly is broken, whenever a test fails. I'd like to do some changes but want to have some feedback first. Starting with CSVLexerTest I would like to split up test methods into simpler tests that only test one (or a few things). I hope that this way the testNextTokenX methods become obsolete. After cleaning up the lexer test I want to have a close look at CSVParserTest. To me it looks like, that some of the tests in the parser really belong to the lexer test. The Parser test should mainly be concerned with Records and not to much with the actual contents of tokens (the parsing of tokens is tested in the lexer test). I'm also thinking of implementing matchers for the Token class that can do the following: assertThat(token, hasType(EOF)); assertThat(token, hasContent("expected Content")); This will make the assertTokenEquals method obsolete. Extending a TypeSafeDiagnostingMatcher [2] yields the possibility of adding useful information like: Expected token that has type EOF but was EORECORD I have already added some tests to the CSVLexerTest that may serve as an example of what I'm thinking about [3]. If nobody object's I'll probably start tomorrow or on monday with this. Regards, Benedikt [1] https://issues.apache.org/jira/browse/CSV-58 [2] https://github.com/hamcrest/JavaHamcrest/blob/master/hamcrest-core/src/main/java/org/hamcrest/TypeSafeDiagnosingMatcher.java [3] http://svn.apache.org/viewvc?view=revision&revision=r1460364 -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter --047d7bf198943b97d804d92314c3--