mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-02 11:05:29 -04:00
TMC-LANG: Made test case OS agnostic (now builds on Windows too). Thanks Omri Spector!
This commit is contained in:
parent
33ffc14e3f
commit
f5b5e818c5
@ -1,5 +1,7 @@
|
|||||||
package com.twelvemonkeys.util.convert;
|
package com.twelvemonkeys.util.convert;
|
||||||
|
|
||||||
|
import com.twelvemonkeys.lang.Validate;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ public class DefaultConverterTestCase extends PropertyConverterAbstractTestCase
|
|||||||
|
|
||||||
// Object array test
|
// Object array test
|
||||||
new Conversion("foo, bar", new FooBar[] {new FooBar("foo"), new FooBar("bar")}),
|
new Conversion("foo, bar", new FooBar[] {new FooBar("foo"), new FooBar("bar")}),
|
||||||
new Conversion("/temp, /usr/local/bin", new File[] {new File("/temp"), new File("/usr/local/bin")}),
|
new Conversion("/temp, /usr/local/bin".replace('/', File.separatorChar), new File[] {new File("/temp"), new File("/usr/local/bin")}),
|
||||||
new Conversion("file:/temp, http://java.net/", new URI[] {URI.create("file:/temp"), URI.create("http://java.net/")}),
|
new Conversion("file:/temp, http://java.net/", new URI[] {URI.create("file:/temp"), URI.create("http://java.net/")}),
|
||||||
|
|
||||||
// TODO: More tests
|
// TODO: More tests
|
||||||
@ -57,13 +59,12 @@ public class DefaultConverterTestCase extends PropertyConverterAbstractTestCase
|
|||||||
// TODO: Test boolean -> Boolean conversion
|
// TODO: Test boolean -> Boolean conversion
|
||||||
|
|
||||||
public static class FooBar {
|
public static class FooBar {
|
||||||
private final String mBar;
|
private final String bar;
|
||||||
|
|
||||||
public FooBar(String pFoo) {
|
public FooBar(String pFoo) {
|
||||||
if (pFoo == null) {
|
Validate.notNull(pFoo, "foo");
|
||||||
throw new IllegalArgumentException("pFoo == null");
|
|
||||||
}
|
bar = reverse(pFoo);
|
||||||
mBar = reverse(pFoo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String reverse(String pFoo) {
|
private String reverse(String pFoo) {
|
||||||
@ -77,16 +78,15 @@ public class DefaultConverterTestCase extends PropertyConverterAbstractTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return reverse(mBar);
|
return reverse(bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return obj == this || (obj instanceof FooBar && ((FooBar) obj).mBar.equals(mBar));
|
return obj == this || (obj != null && obj.getClass() == getClass() && ((FooBar) obj).bar.equals(bar));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return 7 * mBar.hashCode();
|
return 7 * bar.hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user