You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <ba...@generationjava.com> on 2002/07/09 09:36:48 UTC

[lang.Strings] Unit Test todo list

Here's a list of the methods still left to be unit tested in Strings.
stripAll needs to be added to the StringsTrimEmptyTest class, but as it's
nearly 4am I think I need to get ready for another long day of work.
Violins, sympathy, chocolate would all be welcome, but I'm sure you're all
in the same state of slog at work at the moment.

The list also represents some of the more esoteric members of the Strings
class, so feel free to ask what business they have in Strings.

  public static String wrapText(String str, String newline, int wrapColumn)
  public static String wordWrap(String str);
  public static String wordWrap(String str, int width);
  public static String wordWrap(String str, int width, String delim, String split);
  public static String escape(String str);
  public static String quoteRegularExpression(String str);
  public static String[] stripAll(String[] strs);
  public static String[] stripAll(String[] strs, String delimiter);
  public static String getNestedString(String str, String tag);
  public static String getNestedString(String str, String open, String close);
  public static int countMatches(String str, String sub);
  public static boolean isAlpha(String str);
  public static boolean isAlphanumeric(String str);
  public static boolean isAlphanumericSpace(String str);
  public static boolean isNumeric(String str);
  public static boolean isNumericSpace(String str);
  public static boolean isLine(String str);
  public static String defaultString(String str);
  public static String defaultString(String str, String defaultString);
  public static String stackTrace(Throwable throwable);
  public static int getLevenshteinDistance(String s, String t);
  public static String convertUnicodeToNative(String source, String charset)
  public static String convertNativeToUnicode(String input, String charset)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang.Strings] Unit Test todo list [lang]

Posted by Henri Yandell <ba...@generationjava.com>.
Inline

On Sat, 13 Jul 2002, Stephen Colebourne wrote:

> From: "Henri Yandell" <ba...@generationjava.com>
> > 1) I'd like to suggest dropping isLine and quoteRegexp.
> +1

Done.

>
> > 3) Ideas for good ways to test stack trace are welcomed.
> My view is that stack trace fits better with either the proposed system
> package, or the exception package. As for testing, well thats tricky. Each

Am going to leave this as is, but before a release we'll need to decide
what to do about it. Throwables or ThrowableUtils in
commons.lang.exception seems like a nice location.

>
> > 4) Views on wordWrap. While good functionality [i think], it has some
> > quirky errors on some forms of boundary cases. Should there be a WordWrap
> > class in another package for text formatting?
> I would support breaking out all the word wrap methods into a separate
> class, lets say WrapUtils. I'm also a little clear about which wrap method I
> would use when.

All wrap methods currently moved to Commons.Util.WordWrapper.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang.Strings] Unit Test todo list [lang]

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Henri Yandell" <ba...@generationjava.com>
> 1) I'd like to suggest dropping isLine and quoteRegexp.
+1

> 3) Ideas for good ways to test stack trace are welcomed.
My view is that stack trace fits better with either the proposed system
package, or the exception package. As for testing, well thats tricky. Each
JVM produces different trace, so really all the test can do is test to see
if the output strings contains certain strings (name of exception, name of
each class in hierarchy, etc)

> 4) Views on wordWrap. While good functionality [i think], it has some
> quirky errors on some forms of boundary cases. Should there be a WordWrap
> class in another package for text formatting?
I would support breaking out all the word wrap methods into a separate
class, lets say WrapUtils. I'm also a little clear about which wrap method I
would use when.

Stephen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang.Strings] Unit Test todo list

Posted by Henri Yandell <ba...@generationjava.com>.
Knocked out the escape, stripAll, getNestedString, defaultString,
getLevenshteinDistance methods.

This basically leaves us with:

wordWrap
quoteRegularExpression
stackTrace
isLine
convertNativeToUnicode
convertUnicodeToNative

There is a test for the latter two methods, but it seems to have problems
succeeding. In fact it exceptions as bad input for me.
StackTrace is not so easy to test due to the dynamic nature of a stack
trace string. Needs some play.
isLine, wordWrap and quoteRegularExpression are all up for debate imo.
isLine doesn't seem to offer any real functionality as few pieces of text
would not contain punctuation, and quoteRegularExpression seems to be of
little use, plus it doesn't account for character classes. WordWrap is a
very useful method, but probably needs more work.

1) I'd like to suggest dropping isLine and quoteRegexp.
2) Any help with the native/unicode would be welcomed
3) Ideas for good ways to test stack trace are welcomed.
4) Views on wordWrap. While good functionality [i think], it has some
quirky errors on some forms of boundary cases. Should there be a WordWrap
class in another package for text formatting?

Hen

On Tue, 9 Jul 2002, Stephen Colebourne wrote:

> > > Here's a list of the methods still left to be unit tested in Strings.
> > >
> > >   public static String wordWrap(String str);
> > >   public static String wordWrap(String str, int width);
> > >   public static String wordWrap(String str, int width, String delim,
> String split);
> > >   public static String quoteRegularExpression(String str);
> > >   public static boolean isLine(String str);
> > >   public static String stackTrace(Throwable throwable);
> > >   public static String convertUnicodeToNative(String source, String
> charset)
> > >   public static String convertNativeToUnicode(String input, String
> charset)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang.Strings] Unit Test todo list

Posted by Stephen Colebourne <sc...@btopenworld.com>.
removing from the list the isXxx methods

Stephen

> > Here's a list of the methods still left to be unit tested in Strings.
> >
> >   public static String wrapText(String str, String newline, int
wrapColumn)
> >   public static String wordWrap(String str);
> >   public static String wordWrap(String str, int width);
> >   public static String wordWrap(String str, int width, String delim,
String split);
> >   public static String escape(String str);
> >   public static String quoteRegularExpression(String str);
> >   public static String[] stripAll(String[] strs);
> >   public static String[] stripAll(String[] strs, String delimiter);
> >   public static String getNestedString(String str, String tag);
> >   public static String getNestedString(String str, String open, String
close);
> >   public static boolean isLine(String str);
> >   public static String defaultString(String str);
> >   public static String defaultString(String str, String defaultString);
> >   public static String stackTrace(Throwable throwable);
> >   public static int getLevenshteinDistance(String s, String t);
> >   public static String convertUnicodeToNative(String source, String
charset)
> >   public static String convertNativeToUnicode(String input, String
charset)



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang.Strings] Unit Test todo list

Posted by Henri Yandell <ba...@generationjava.com>.
Signing off on, and removing from the list:

countMatches. Added to StringsSubstringTest.

Hen

On Tue, 9 Jul 2002, Henri Yandell wrote:

> Here's a list of the methods still left to be unit tested in Strings.
>
>   public static String wrapText(String str, String newline, int wrapColumn)
>   public static String wordWrap(String str);
>   public static String wordWrap(String str, int width);
>   public static String wordWrap(String str, int width, String delim, String split);
>   public static String escape(String str);
>   public static String quoteRegularExpression(String str);
>   public static String[] stripAll(String[] strs);
>   public static String[] stripAll(String[] strs, String delimiter);
>   public static String getNestedString(String str, String tag);
>   public static String getNestedString(String str, String open, String close);
>   public static boolean isAlpha(String str);
>   public static boolean isAlphanumeric(String str);
>   public static boolean isAlphanumericSpace(String str);
>   public static boolean isNumeric(String str);
>   public static boolean isNumericSpace(String str);
>   public static boolean isLine(String str);
>   public static String defaultString(String str);
>   public static String defaultString(String str, String defaultString);
>   public static String stackTrace(Throwable throwable);
>   public static int getLevenshteinDistance(String s, String t);
>   public static String convertUnicodeToNative(String source, String charset)
>   public static String convertNativeToUnicode(String input, String charset)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>