You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-dev@maven.apache.org by Carlos Sanchez <ca...@apache.org> on 2006/07/31 11:51:05 UTC
Re: [Fwd: Re: svn commit: r415196]
Seems that I was not subscribed.
The binary compatibility is not a problem, i added the method in a
previous commit, so it was not in the last release.
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java?r1=398546&r2=415196&pathrev=415196&diff_format=h
IIRC all of these were introduced when i added the option to redirect
all output to files. I needed to know when tests started and ended to
use different files and I introduced this "parsing" code to
encapsulate the string comparison.
On 7/31/06, Brett Porter <br...@apache.org> wrote:
> Hi,
>
> Are you subscribed to surefire-dev@maven.apache.org?
>
> I sent this message a while back and didn't get a response. I'm about to
> take a look at some of the patches available for surefire...
>
> - Brett
>
> --
> Apache Maven - http://maven.apache.org/
> Better Builds with Maven - http://library.mergere.com/
>
>
>
> ---------- Forwarded message ----------
> From: Brett Porter <br...@apache.org>
> To: surefire-dev@maven.apache.org
> Date: Sat, 24 Jun 2006 17:33:25 +1000
> Subject: Re: svn commit: r415196
> Carlos?
>
> On 19/06/2006 8:17 AM, Brett Porter wrote:
> > I'm a little baffled by this commit.
> > Why did the methods need to be static? (and is that even binary
> > compatible?)
> > What is the "is" method for? (I can only see it tested, not used).
> >
> > Something I surely need to improve myself, but we need to think "why"
> > not "what" when writing commit messages. The what speaks for itself in
> > the diff, most of the time, unless it's a high level description of a
> > large set of changes.
> >
> > - Brett
> >
> >
> > carlos@apache.org wrote:
> >> Author: carlos
> >> Date: Sun Jun 18 14:11:24 2006
> >> New Revision: 415196
> >>
> >> URL: http://svn.apache.org/viewvc?rev=415196&view=rev
> >> Log:
> >> Refactor and use static methods
> >>
> >> Modified:
> >>
> >> maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
> >>
> >>
> >> maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
> >>
> >>
> >> maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTest.java
> >>
> >>
> >> Modified:
> >> maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
> >>
> >> URL:
> >> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java?rev=415196&r1=415195&r2=415196&view=diff
> >>
> >> ==============================================================================
> >>
> >> ---
> >> maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
> >> (original)
> >> +++
> >> maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
> >> Sun Jun 18 14:11:24 2006
> >> @@ -93,7 +93,7 @@
> >> * @param report report whose test set is starting
> >> * @return the message
> >> */
> >> - public String getTestSetStartingMessage( ReportEntry report )
> >> + public static String getTestSetStartingMessage( ReportEntry report )
> >> {
> >> StringBuffer message = new StringBuffer();
> >> message.append( TEST_SET_STARTING_PREFIX );
> >> @@ -115,7 +115,7 @@
> >> * @param message
> >> * @return the parsed {@link ReportEntry}
> >> */
> >> - public ReportEntry parseTestSetStartingMessage( String message )
> >> + public static ReportEntry parseTestSetStartingMessage( String
> >> message )
> >> {
> >> ReportEntry reportEntry = new ReportEntry();
> >> int i = message.indexOf( TEST_SET_STARTING_GROUP_PREFIX );
> >> @@ -140,4 +140,17 @@
> >> reportEntry.setName( message.substring(
> >> TEST_SET_STARTING_PREFIX.length(), i ) );
> >> return reportEntry;
> >> }
> >> +
> >> + /**
> >> + * Check if the String passed as argument is a "test starting"
> >> message.
> >> + * If so it can be passed to {@link
> >> #parseTestSetStartingMessage(String)}
> >> + * + * @param message the message to check
> >> + * @return true if it is a "test starting" message
> >> + */
> >> + public static boolean isTestSetStartingMessage( String message )
> >> + {
> >> + return message.startsWith( TEST_SET_STARTING_PREFIX );
> >> + }
> >> +
> >> }
> >>
> >> Modified:
> >> maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
> >>
> >> URL:
> >> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?rev=415196&r1=415195&r2=415196&view=diff
> >>
> >> ==============================================================================
> >>
> >> ---
> >> maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
> >> (original)
> >> +++
> >> maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
> >> Sun Jun 18 14:11:24 2006
> >> @@ -37,6 +37,8 @@
> >>
> >> protected PrintWriter writer;
> >>
> >> + private static final String TEST_SET_COMPLETED_PREFIX = "Tests
> >> run: ";
> >> +
> >> private final String format;
> >>
> >> private List testResults;
> >> @@ -134,7 +136,7 @@
> >> {
> >> StringBuffer buf = new StringBuffer();
> >>
> >> - buf.append( "Tests run: " );
> >> + buf.append( TEST_SET_COMPLETED_PREFIX );
> >> buf.append( completedCount );
> >> buf.append( ", Failures: " );
> >> buf.append( failures );
> >> @@ -179,4 +181,16 @@
> >>
> >> return buf.toString();
> >> }
> >> +
> >> + /**
> >> + * Check if the String passed as argument is a "test set
> >> completed" message.
> >> + * + * @param message the message to check
> >> + * @return true if it is a "test set completed" message
> >> + */
> >> + public static boolean isTestSetCompletedMessage( String message )
> >> + {
> >> + return message.startsWith( TEST_SET_COMPLETED_PREFIX );
> >> + }
> >> +
> >> }
> >>
> >> Modified:
> >> maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTest.java
> >>
> >> URL:
> >> http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTest.java?rev=415196&r1=415195&r2=415196&view=diff
> >>
> >> ==============================================================================
> >>
> >> ---
> >> maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTest.java
> >> (original)
> >> +++
> >> maven/surefire/trunk/surefire-api/src/test/java/org/apache/maven/surefire/report/AbstractConsoleReporterTest.java
> >> Sun Jun 18 14:11:24 2006
> >> @@ -60,11 +60,11 @@
> >> public void testGetTestSetStartingMessage()
> >> throws Exception
> >> {
> >> - String message = consoleReporter.getTestSetStartingMessage(
> >> report );
> >> + String message =
> >> AbstractConsoleReporter.getTestSetStartingMessage( report );
> >> assertEquals( "Running name (of group)", message );
> >>
> >> report.setGroup( null );
> >> - message = consoleReporter.getTestSetStartingMessage( report );
> >> + message = AbstractConsoleReporter.getTestSetStartingMessage(
> >> report );
> >> assertEquals( "Running name", message );
> >> }
> >>
> >> @@ -72,13 +72,26 @@
> >> throws Exception
> >> {
> >> String message = "Running name (of group)";
> >> - ReportEntry actualReport =
> >> consoleReporter.parseTestSetStartingMessage( message );
> >> + ReportEntry actualReport =
> >> AbstractConsoleReporter.parseTestSetStartingMessage( message );
> >> assertEquals( report, actualReport );
> >>
> >> report.setGroup( null );
> >> message = "Running name";
> >> - actualReport = consoleReporter.parseTestSetStartingMessage(
> >> message );
> >> + actualReport =
> >> AbstractConsoleReporter.parseTestSetStartingMessage( message );
> >> assertEquals( report, actualReport );
> >> + }
> >> +
> >> + public void testIsTestSetStartingMessage()
> >> + throws Exception
> >> + {
> >> + String message = "Running name (of group)";
> >> + assertTrue( AbstractConsoleReporter.isTestSetStartingMessage(
> >> message ) );
> >> +
> >> + message = "Running name";
> >> + assertTrue( AbstractConsoleReporter.isTestSetStartingMessage(
> >> message ) );
> >> +
> >> + message = "Xxxx";
> >> + assertFalse(
> >> AbstractConsoleReporter.isTestSetStartingMessage( message ) );
> >> }
> >>
> >> }
> >>
> >>
> >
> >
>
>
> --
> Brett Porter <br...@apache.org>
> Apache Maven - http://maven.apache.org/
> Better Builds with Maven - http://library.mergere.com/
>
>
>
>
--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
-- The Princess Bride