You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2011/04/25 11:19:32 UTC
svn commit: r1096439 [7/7] - in /incubator/isis/trunk/core/commons/src:
main/java/org/apache/isis/core/commons/authentication/
main/java/org/apache/isis/core/commons/components/
main/java/org/apache/isis/core/commons/config/ main/java/org/apache/isis/c...
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefault_WhitespaceTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefault_WhitespaceTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefault_WhitespaceTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefault_WhitespaceTest.java Mon Apr 25 09:19:29 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.core.commons.config;
import java.util.Properties;
@@ -28,9 +27,6 @@ import org.apache.log4j.BasicConfigurato
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
-import org.apache.isis.core.commons.config.IsisConfigurationDefault;
-
-
public class IsisConfigurationDefault_WhitespaceTest extends TestCase {
private IsisConfigurationDefault configuration;
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/debug/DebugStringTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/debug/DebugStringTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/debug/DebugStringTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/debug/DebugStringTest.java Mon Apr 25 09:19:29 2011
@@ -17,14 +17,10 @@
* under the License.
*/
-
package org.apache.isis.core.commons.debug;
-import org.apache.isis.core.commons.debug.DebugString;
-
import junit.framework.TestCase;
-
public class DebugStringTest extends TestCase {
private DebugString str;
@@ -72,21 +68,14 @@ public class DebugStringTest extends Tes
str.appendln("text 2");
str.endSection();
str.startSection("Section B");
- assertEquals("\n1. Section A\n" +
- "------------\n" +
- " text 1\n" +
- " text 2\n\n\n" +
- "2. Section B\n" +
- "------------\n", str.toString());
+ assertEquals("\n1. Section A\n" + "------------\n" + " text 1\n" + " text 2\n\n\n" + "2. Section B\n"
+ + "------------\n", str.toString());
}
public void testTitle() {
str.appendTitle("New Section");
str.appendln("text");
- assertEquals("\nNew Section\n" +
- "-----------\n" +
- "text\n", str.toString());
+ assertEquals("\nNew Section\n" + "-----------\n" + "text\n", str.toString());
}
-
-}
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/encoding/ByteEncoderDecoderRoundtripTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/encoding/ByteEncoderDecoderRoundtripTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/encoding/ByteEncoderDecoderRoundtripTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/encoding/ByteEncoderDecoderRoundtripTest.java Mon Apr 25 09:19:29 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.core.commons.encoding;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -34,13 +33,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.apache.isis.core.commons.encoding.DataInputExtended;
-import org.apache.isis.core.commons.encoding.DataInputStreamExtended;
-import org.apache.isis.core.commons.encoding.DataOutputExtended;
-import org.apache.isis.core.commons.encoding.DataOutputStreamExtended;
-import org.apache.isis.core.commons.encoding.Encodable;
-
-
public class ByteEncoderDecoderRoundtripTest {
private DataOutputStreamExtended outputImpl;
@@ -48,16 +40,16 @@ public class ByteEncoderDecoderRoundtrip
@Before
public void setUp() throws Exception {
- PipedInputStream pipedInputStream = new PipedInputStream();
- PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream);
- outputImpl = new DataOutputStreamExtended(pipedOutputStream);
- inputImpl = new DataInputStreamExtended(pipedInputStream);
+ final PipedInputStream pipedInputStream = new PipedInputStream();
+ final PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream);
+ outputImpl = new DataOutputStreamExtended(pipedOutputStream);
+ inputImpl = new DataInputStreamExtended(pipedInputStream);
}
-
+
@After
- public void tearDown() throws Exception {
- // does nothing yet
- }
+ public void tearDown() throws Exception {
+ // does nothing yet
+ }
@Test
public void encodeAndDecodeBoolean() throws IOException {
@@ -70,11 +62,11 @@ public class ByteEncoderDecoderRoundtrip
@Test
public void encodeAndDecodeByteArray() throws IOException {
- byte[] bytes = {3, 76, -1, 21};
- outputImpl.writeBytes(bytes);
- byte[] decodedBytes = inputImpl.readBytes();
-
- assertThatArraysEqual(bytes, decodedBytes);
+ final byte[] bytes = { 3, 76, -1, 21 };
+ outputImpl.writeBytes(bytes);
+ final byte[] decodedBytes = inputImpl.readBytes();
+
+ assertThatArraysEqual(bytes, decodedBytes);
}
@Test
@@ -101,9 +93,9 @@ public class ByteEncoderDecoderRoundtrip
final Object object = inputImpl.readEncodable(Object.class);
assertThat(object, is(instanceOf(EncodableObject.class)));
-
- EncodableObject encodeableObject = (EncodableObject) object;
- assertThat(encodeableObject.field, is(equalTo("test field")));
+
+ final EncodableObject encodeableObject = (EncodableObject) object;
+ assertThat(encodeableObject.field, is(equalTo("test field")));
}
@Test
@@ -114,23 +106,18 @@ public class ByteEncoderDecoderRoundtrip
assertThat(object, is(nullValue()));
}
-
@Test
public void encodeAndDecodeObjectArray() throws IOException {
- final EncodableObject[] array =
- new EncodableObject[] {
- new EncodableObject(),
- new EncodableObject(),
- new EncodableObject() };
+ final EncodableObject[] array =
+ new EncodableObject[] { new EncodableObject(), new EncodableObject(), new EncodableObject() };
outputImpl.writeEncodables(array);
final Encodable[] objects = inputImpl.readEncodables(Encodable.class);
assertThat(objects.length, is(3));
- EncodableObject encodeableObject = (EncodableObject) objects[2];
+ final EncodableObject encodeableObject = (EncodableObject) objects[2];
assertThat(encodeableObject.field, is(equalTo("test field")));
}
-
@Test
public void encodeAndDecodeNullObjectArray() throws IOException {
outputImpl.writeEncodables(null);
@@ -163,27 +150,28 @@ public class ByteEncoderDecoderRoundtrip
assertThat(returnedList[2], is(equalTo(list[2])));
}
- private void assertThatArraysEqual(byte[] bytes, byte[] decodedBytes) {
- assertThat(decodedBytes.length, is(equalTo(bytes.length)));
- for(int i=0; i<bytes.length; i++) {
- assertThat(decodedBytes[i], is(equalTo(bytes[i])));
- }
- }
+ private void assertThatArraysEqual(final byte[] bytes, final byte[] decodedBytes) {
+ assertThat(decodedBytes.length, is(equalTo(bytes.length)));
+ for (int i = 0; i < bytes.length; i++) {
+ assertThat(decodedBytes[i], is(equalTo(bytes[i])));
+ }
+ }
}
class EncodableObject implements Encodable {
String field;
- public EncodableObject() {}
+ public EncodableObject() {
+ }
public EncodableObject(final DataInputExtended input) throws IOException {
field = input.readUTF();
}
+ @Override
public void encode(final DataOutputExtended output) throws IOException {
output.writeUTF("test field");
}
}
-
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/encoding/EncodabilityContractTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/encoding/EncodabilityContractTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/encoding/EncodabilityContractTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/encoding/EncodabilityContractTest.java Mon Apr 25 09:19:29 2011
@@ -17,9 +17,8 @@
* under the License.
*/
+package org.apache.isis.core.commons.encoding;
-package org.apache.isis.core.commons.encoding;
-
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -29,69 +28,62 @@ import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.jmock.Mockery;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.Before;
import org.junit.Test;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.encoding.DataInputExtended;
-import org.apache.isis.core.commons.encoding.DataInputStreamExtended;
-import org.apache.isis.core.commons.encoding.DataOutputStreamExtended;
-import org.apache.isis.core.commons.encoding.Encodable;
-
-public abstract class EncodabilityContractTest {
-
- protected final Mockery context = new JUnit4Mockery();
- protected AuthenticationSession mockAuthSession;
-
- protected Encodable encodable;
-
- public EncodabilityContractTest() {
- super();
- }
-
- @Before
- public void setUp() throws Exception {
- encodable = createEncodable();
- mockAuthSession = context.mock(AuthenticationSession.class);
- }
-
-
- /**
- * Hook for subclasses to provide object to be tested.
- */
- protected abstract Encodable createEncodable();
-
- @Test
- public void shouldImplementEncodeable() throws Exception {
- assertThat(encodable, is(instanceOf(Encodable.class)));
- }
-
- @Test
- public void shouldHaveOneArgConstructorThatAcceptsInput() {
- Object o = encodable;
- try {
- o.getClass().getConstructor(DataInputExtended.class);
- } catch (Exception e) {
- fail("could not locate 1-arg constructor accepting a DataInputExtended instance");
- }
- }
-
- @Test
- public void shouldRoundTrip() throws IOException {
- PipedInputStream pipedInputStream = new PipedInputStream();
- PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream);
- DataOutputStreamExtended outputImpl = new DataOutputStreamExtended(pipedOutputStream);
- DataInputStreamExtended inputImpl = new DataInputStreamExtended(pipedInputStream);
-
- outputImpl.writeEncodable(encodable);
- Object decodedEncodable = inputImpl.readEncodable(Object.class);
-
- assertRoundtripped(decodedEncodable, encodable);
- }
-
- protected abstract void assertRoundtripped(Object decodedEncodable, Object originalEncodable);
-
-
+public abstract class EncodabilityContractTest {
+
+ protected final Mockery context = new JUnit4Mockery();
+ protected AuthenticationSession mockAuthSession;
+
+ protected Encodable encodable;
+
+ public EncodabilityContractTest() {
+ super();
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ encodable = createEncodable();
+ mockAuthSession = context.mock(AuthenticationSession.class);
+ }
+
+ /**
+ * Hook for subclasses to provide object to be tested.
+ */
+ protected abstract Encodable createEncodable();
+
+ @Test
+ public void shouldImplementEncodeable() throws Exception {
+ assertThat(encodable, is(instanceOf(Encodable.class)));
+ }
+
+ @Test
+ public void shouldHaveOneArgConstructorThatAcceptsInput() {
+ final Object o = encodable;
+ try {
+ o.getClass().getConstructor(DataInputExtended.class);
+ } catch (final Exception e) {
+ fail("could not locate 1-arg constructor accepting a DataInputExtended instance");
+ }
+ }
+
+ @Test
+ public void shouldRoundTrip() throws IOException {
+ final PipedInputStream pipedInputStream = new PipedInputStream();
+ final PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream);
+ final DataOutputStreamExtended outputImpl = new DataOutputStreamExtended(pipedOutputStream);
+ final DataInputStreamExtended inputImpl = new DataInputStreamExtended(pipedInputStream);
+
+ outputImpl.writeEncodable(encodable);
+ final Object decodedEncodable = inputImpl.readEncodable(Object.class);
+
+ assertRoundtripped(decodedEncodable, encodable);
+ }
+
+ protected abstract void assertRoundtripped(Object decodedEncodable, Object originalEncodable);
+
}
\ No newline at end of file
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/ensure/Ensure_GivenValueThatDoesMatchTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/ensure/Ensure_GivenValueThatDoesMatchTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/ensure/Ensure_GivenValueThatDoesMatchTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/ensure/Ensure_GivenValueThatDoesMatchTest.java Mon Apr 25 09:19:29 2011
@@ -17,62 +17,59 @@
* under the License.
*/
+package org.apache.isis.core.commons.ensure;
-package org.apache.isis.core.commons.ensure;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.CoreMatchers.sameInstance;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-import org.apache.isis.core.commons.ensure.Ensure;
-
-
-public class Ensure_GivenValueThatDoesMatchTest {
-
- @Test
- public void whenCallEnsureThatArgThenShouldReturnOriginalObject() {
- String object = "foo";
- String returnedObject = Ensure.ensureThatArg(object, is(not(nullValue(String.class))));
- assertThat(returnedObject, sameInstance(object));
- }
-
- @Test
- public void whenCallEnsureThatArgWithOverloadedShouldReturnOriginalObject() {
- String object = "foo";
- String returnedObject = Ensure.ensureThatArg(object, is(not(nullValue(String.class))), "some message");
- assertThat(returnedObject, sameInstance(object));
- }
-
- @Test
- public void whenCallEnsureThatStateThenShouldReturnOriginalObject() {
- String object = "foo";
- String returnedObject = Ensure.ensureThatState(object, is(not(nullValue(String.class))));
- assertThat(returnedObject, sameInstance(object));
- }
-
- @Test
- public void whenCallEnsureThatStateWithOverloadedShouldReturnOriginalObject() {
- String object = "foo";
- String returnedObject = Ensure.ensureThatState(object, is(not(nullValue(String.class))), "some message");
- assertThat(returnedObject, sameInstance(object));
- }
-
- @Test
- public void whenCallEnsureThatContextThenShouldReturnOriginalObject() {
- String object = "foo";
- String returnedObject = Ensure.ensureThatContext(object, is(not(nullValue(String.class))));
- assertThat(returnedObject, sameInstance(object));
- }
-
- @Test
- public void whenCallEnsureThatContextWithOverloadedShouldReturnOriginalObject() {
- String object = "foo";
- String returnedObject = Ensure.ensureThatContext(object, is(not(nullValue(String.class))), "some message");
- assertThat(returnedObject, sameInstance(object));
- }
-
-
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.sameInstance;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class Ensure_GivenValueThatDoesMatchTest {
+
+ @Test
+ public void whenCallEnsureThatArgThenShouldReturnOriginalObject() {
+ final String object = "foo";
+ final String returnedObject = Ensure.ensureThatArg(object, is(not(nullValue(String.class))));
+ assertThat(returnedObject, sameInstance(object));
+ }
+
+ @Test
+ public void whenCallEnsureThatArgWithOverloadedShouldReturnOriginalObject() {
+ final String object = "foo";
+ final String returnedObject = Ensure.ensureThatArg(object, is(not(nullValue(String.class))), "some message");
+ assertThat(returnedObject, sameInstance(object));
+ }
+
+ @Test
+ public void whenCallEnsureThatStateThenShouldReturnOriginalObject() {
+ final String object = "foo";
+ final String returnedObject = Ensure.ensureThatState(object, is(not(nullValue(String.class))));
+ assertThat(returnedObject, sameInstance(object));
+ }
+
+ @Test
+ public void whenCallEnsureThatStateWithOverloadedShouldReturnOriginalObject() {
+ final String object = "foo";
+ final String returnedObject = Ensure.ensureThatState(object, is(not(nullValue(String.class))), "some message");
+ assertThat(returnedObject, sameInstance(object));
+ }
+
+ @Test
+ public void whenCallEnsureThatContextThenShouldReturnOriginalObject() {
+ final String object = "foo";
+ final String returnedObject = Ensure.ensureThatContext(object, is(not(nullValue(String.class))));
+ assertThat(returnedObject, sameInstance(object));
+ }
+
+ @Test
+ public void whenCallEnsureThatContextWithOverloadedShouldReturnOriginalObject() {
+ final String object = "foo";
+ final String returnedObject =
+ Ensure.ensureThatContext(object, is(not(nullValue(String.class))), "some message");
+ assertThat(returnedObject, sameInstance(object));
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/ensure/Ensure_GivenValueThatDoesNotMatchTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/ensure/Ensure_GivenValueThatDoesNotMatchTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/ensure/Ensure_GivenValueThatDoesNotMatchTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/ensure/Ensure_GivenValueThatDoesNotMatchTest.java Mon Apr 25 09:19:29 2011
@@ -17,79 +17,75 @@
* under the License.
*/
+package org.apache.isis.core.commons.ensure;
-package org.apache.isis.core.commons.ensure;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import org.junit.Test;
-import org.apache.isis.core.commons.ensure.Ensure;
-
-
-public class Ensure_GivenValueThatDoesNotMatchTest {
-
- @Test
- public void whenCallEnsureThatArgShouldThrowIllegalArgumentException() {
- try {
- Ensure.ensureThatArg("foo", is(nullValue()));
- fail();
- } catch(IllegalArgumentException ex) {
- assertThat(ex.getMessage(), is("illegal argument, expected: is null"));
- }
- }
-
- @Test
- public void whenCallEnsureThatArgOverloadedShouldThrowIllegalArgumentExceptionUsingSuppliedMessage() {
- try {
- Ensure.ensureThatArg("foo", is(nullValue()), "my message");
- fail();
- } catch(IllegalArgumentException ex) {
- assertThat(ex.getMessage(), is("my message"));
- }
- }
-
- @Test
- public void whenCallEnsureThatStateShouldThrowIllegalStateException() {
- try {
- Ensure.ensureThatState("foo", is(nullValue()));
- fail();
- } catch(IllegalStateException ex) {
- assertThat(ex.getMessage(), is("illegal argument, expected: is null"));
- }
- }
-
- @Test
- public void whenCallEnsureThatStateOverloadedShouldThrowIllegalStateExceptionUsingSuppliedMessage() {
- try {
- Ensure.ensureThatState("foo", is(nullValue()), "my message");
- fail();
- } catch(IllegalStateException ex) {
- assertThat(ex.getMessage(), is("my message"));
- }
- }
-
- @Test
- public void whenCallEnsureThatContextShouldThrowIllegalThreadStateException() {
- try {
- Ensure.ensureThatContext("foo", is(nullValue()));
- fail();
- } catch(IllegalThreadStateException ex) {
- assertThat(ex.getMessage(), is("illegal argument, expected: is null"));
- }
- }
-
- @Test
- public void whenCallEnsureThatContextOverloadedShouldThrowIllegalThreadStateExceptionUsingSuppliedMessage() {
- try {
- Ensure.ensureThatContext("foo", is(nullValue()), "my message");
- fail();
- } catch(IllegalThreadStateException ex) {
- assertThat(ex.getMessage(), is("my message"));
- }
- }
-
-
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+public class Ensure_GivenValueThatDoesNotMatchTest {
+
+ @Test
+ public void whenCallEnsureThatArgShouldThrowIllegalArgumentException() {
+ try {
+ Ensure.ensureThatArg("foo", is(nullValue()));
+ fail();
+ } catch (final IllegalArgumentException ex) {
+ assertThat(ex.getMessage(), is("illegal argument, expected: is null"));
+ }
+ }
+
+ @Test
+ public void whenCallEnsureThatArgOverloadedShouldThrowIllegalArgumentExceptionUsingSuppliedMessage() {
+ try {
+ Ensure.ensureThatArg("foo", is(nullValue()), "my message");
+ fail();
+ } catch (final IllegalArgumentException ex) {
+ assertThat(ex.getMessage(), is("my message"));
+ }
+ }
+
+ @Test
+ public void whenCallEnsureThatStateShouldThrowIllegalStateException() {
+ try {
+ Ensure.ensureThatState("foo", is(nullValue()));
+ fail();
+ } catch (final IllegalStateException ex) {
+ assertThat(ex.getMessage(), is("illegal argument, expected: is null"));
+ }
+ }
+
+ @Test
+ public void whenCallEnsureThatStateOverloadedShouldThrowIllegalStateExceptionUsingSuppliedMessage() {
+ try {
+ Ensure.ensureThatState("foo", is(nullValue()), "my message");
+ fail();
+ } catch (final IllegalStateException ex) {
+ assertThat(ex.getMessage(), is("my message"));
+ }
+ }
+
+ @Test
+ public void whenCallEnsureThatContextShouldThrowIllegalThreadStateException() {
+ try {
+ Ensure.ensureThatContext("foo", is(nullValue()));
+ fail();
+ } catch (final IllegalThreadStateException ex) {
+ assertThat(ex.getMessage(), is("illegal argument, expected: is null"));
+ }
+ }
+
+ @Test
+ public void whenCallEnsureThatContextOverloadedShouldThrowIllegalThreadStateExceptionUsingSuppliedMessage() {
+ try {
+ Ensure.ensureThatContext("foo", is(nullValue()), "my message");
+ fail();
+ } catch (final IllegalThreadStateException ex) {
+ assertThat(ex.getMessage(), is("my message"));
+ }
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/IoUtils_CopyTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/IoUtils_CopyTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/IoUtils_CopyTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/IoUtils_CopyTest.java Mon Apr 25 09:19:29 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.core.commons.lang;
import static org.junit.Assert.assertThat;
@@ -32,9 +31,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.apache.isis.core.commons.lang.IoUtils;
-
-
public class IoUtils_CopyTest {
private static final class ArrayMatcher extends TypeSafeMatcher<byte[]> {
@@ -58,6 +54,7 @@ public class IoUtils_CopyTest {
return true;
}
+ @Override
public void describeTo(final Description arg0) {
arg0.appendText("does not match expected array");
}
@@ -66,7 +63,8 @@ public class IoUtils_CopyTest {
private static int BUF_INTERNAL_SIZE = 1024;
@Before
- public void setUp() throws Exception {}
+ public void setUp() throws Exception {
+ }
@After
public void tearDown() throws Exception {
@@ -136,4 +134,3 @@ public class IoUtils_CopyTest {
}
}
-
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/JavaClassUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/JavaClassUtilsTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/JavaClassUtilsTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/JavaClassUtilsTest.java Mon Apr 25 09:19:29 2011
@@ -17,49 +17,43 @@
* under the License.
*/
+package org.apache.isis.core.commons.lang;
-package org.apache.isis.core.commons.lang;
-
-import static org.junit.Assert.assertEquals;
-
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.apache.isis.core.commons.lang.JavaClassUtils;
-
-
-@RunWith(JMock.class)
-public class JavaClassUtilsTest {
-
- @SuppressWarnings("unused")
- private final Mockery context = new JUnit4Mockery();
-
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void voidBuiltIns() throws ClassNotFoundException {
- assertEquals(JavaClassUtils.getBuiltIn("void"), void.class);
- assertEquals(JavaClassUtils.getBuiltIn("boolean"), boolean.class);
- assertEquals(JavaClassUtils.getBuiltIn("byte"), byte.class);
- assertEquals(JavaClassUtils.getBuiltIn("short"), short.class);
- assertEquals(JavaClassUtils.getBuiltIn("int"), int.class);
- assertEquals(JavaClassUtils.getBuiltIn("long"), long.class);
- assertEquals(JavaClassUtils.getBuiltIn("char"), char.class);
- assertEquals(JavaClassUtils.getBuiltIn("float"), float.class);
- assertEquals(JavaClassUtils.getBuiltIn("double"), double.class);
- }
-
-
-}
-
+import static org.junit.Assert.assertEquals;
+
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(JMock.class)
+public class JavaClassUtilsTest {
+
+ @SuppressWarnings("unused")
+ private final Mockery context = new JUnit4Mockery();
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void voidBuiltIns() throws ClassNotFoundException {
+ assertEquals(JavaClassUtils.getBuiltIn("void"), void.class);
+ assertEquals(JavaClassUtils.getBuiltIn("boolean"), boolean.class);
+ assertEquals(JavaClassUtils.getBuiltIn("byte"), byte.class);
+ assertEquals(JavaClassUtils.getBuiltIn("short"), short.class);
+ assertEquals(JavaClassUtils.getBuiltIn("int"), int.class);
+ assertEquals(JavaClassUtils.getBuiltIn("long"), long.class);
+ assertEquals(JavaClassUtils.getBuiltIn("char"), char.class);
+ assertEquals(JavaClassUtils.getBuiltIn("float"), float.class);
+ assertEquals(JavaClassUtils.getBuiltIn("double"), double.class);
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/LocaleUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/LocaleUtilsTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/LocaleUtilsTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/LocaleUtilsTest.java Mon Apr 25 09:19:29 2011
@@ -17,23 +17,20 @@
* under the License.
*/
+package org.apache.isis.core.commons.lang;
-package org.apache.isis.core.commons.lang;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-import org.apache.isis.core.commons.lang.LocaleUtils;
-
-public class LocaleUtilsTest {
-
-
- @Test
- public void canFindEnGB() throws Exception {
- assertThat(LocaleUtils.findLocale("en_GB"), is(not(nullValue())));
-
- }
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class LocaleUtilsTest {
+
+ @Test
+ public void canFindEnGB() throws Exception {
+ assertThat(LocaleUtils.findLocale("en_GB"), is(not(nullValue())));
+
+ }
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/NameUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/NameUtilTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/NameUtilTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/NameUtilTest.java Mon Apr 25 09:19:29 2011
@@ -17,70 +17,66 @@
* under the License.
*/
+package org.apache.isis.core.commons.lang;
-package org.apache.isis.core.commons.lang;
-
import junit.framework.TestCase;
-import org.apache.isis.core.commons.lang.NameUtils;
-
-
-public class NameUtilTest extends TestCase {
-
- public void testNaturalNameAddsSpacesToCamelCaseWords() {
- assertEquals("Camel Case Word", NameUtils.naturalName("CamelCaseWord"));
- }
-
- public void testNaturalNameAddsSpacesBeforeNumbers() {
- assertEquals("One 2 One", NameUtils.naturalName("One2One"));
- assertEquals("Type 123", NameUtils.naturalName("Type123"));
- assertEquals("4321 Go", NameUtils.naturalName("4321Go"));
- }
-
- public void testNaturalNameRecognisesAcronymns() {
- assertEquals("TNT Power", NameUtils.naturalName("TNTPower"));
- assertEquals("Spam RAM Can", NameUtils.naturalName("SpamRAMCan"));
- assertEquals("DOB", NameUtils.naturalName("DOB"));
- }
-
- public void testNaturalNameWithShortNames() {
- assertEquals("At", NameUtils.naturalName("At"));
- assertEquals("I", NameUtils.naturalName("I"));
- }
-
- public void testNaturalNameNoChange() {
- assertEquals("Camel Case Word", NameUtils.naturalName("CamelCaseWord"));
- assertEquals("Almost Normal english sentence", NameUtils.naturalName("Almost Normal english sentence"));
- }
-
- public void testPluralNameAdd_S() {
- assertEquals("Cans", NameUtils.pluralName("Can"));
- assertEquals("Spaces", NameUtils.pluralName("Space"));
- assertEquals("Noses", NameUtils.pluralName("Nose"));
- }
-
- public void testPluralNameReplace_Y_With_IES() {
- assertEquals("Babies", NameUtils.pluralName("Baby"));
- assertEquals("Cities", NameUtils.pluralName("City"));
- }
-
- public void testPluralNameReplaceAdd_ES() {
- assertEquals("Foxes", NameUtils.pluralName("Fox"));
- assertEquals("Bosses", NameUtils.pluralName("Boss"));
- }
-
- public void testSimpleNameAllToLowerCase() {
- assertEquals("abcde", NameUtils.simpleName("ABCDE"));
- assertEquals("camelcaseword", NameUtils.simpleName("CamelCaseWord"));
- }
-
- public void testSimpleNameNoChanges() {
- assertEquals("nochanges", NameUtils.simpleName("nochanges"));
- }
-
- public void testSimpleNameRemoveSpaces() {
- assertEquals("abcde", NameUtils.simpleName("a bc de "));
- assertEquals("twoparts", NameUtils.simpleName("two parts"));
- }
-
-}
+public class NameUtilTest extends TestCase {
+
+ public void testNaturalNameAddsSpacesToCamelCaseWords() {
+ assertEquals("Camel Case Word", NameUtils.naturalName("CamelCaseWord"));
+ }
+
+ public void testNaturalNameAddsSpacesBeforeNumbers() {
+ assertEquals("One 2 One", NameUtils.naturalName("One2One"));
+ assertEquals("Type 123", NameUtils.naturalName("Type123"));
+ assertEquals("4321 Go", NameUtils.naturalName("4321Go"));
+ }
+
+ public void testNaturalNameRecognisesAcronymns() {
+ assertEquals("TNT Power", NameUtils.naturalName("TNTPower"));
+ assertEquals("Spam RAM Can", NameUtils.naturalName("SpamRAMCan"));
+ assertEquals("DOB", NameUtils.naturalName("DOB"));
+ }
+
+ public void testNaturalNameWithShortNames() {
+ assertEquals("At", NameUtils.naturalName("At"));
+ assertEquals("I", NameUtils.naturalName("I"));
+ }
+
+ public void testNaturalNameNoChange() {
+ assertEquals("Camel Case Word", NameUtils.naturalName("CamelCaseWord"));
+ assertEquals("Almost Normal english sentence", NameUtils.naturalName("Almost Normal english sentence"));
+ }
+
+ public void testPluralNameAdd_S() {
+ assertEquals("Cans", NameUtils.pluralName("Can"));
+ assertEquals("Spaces", NameUtils.pluralName("Space"));
+ assertEquals("Noses", NameUtils.pluralName("Nose"));
+ }
+
+ public void testPluralNameReplace_Y_With_IES() {
+ assertEquals("Babies", NameUtils.pluralName("Baby"));
+ assertEquals("Cities", NameUtils.pluralName("City"));
+ }
+
+ public void testPluralNameReplaceAdd_ES() {
+ assertEquals("Foxes", NameUtils.pluralName("Fox"));
+ assertEquals("Bosses", NameUtils.pluralName("Boss"));
+ }
+
+ public void testSimpleNameAllToLowerCase() {
+ assertEquals("abcde", NameUtils.simpleName("ABCDE"));
+ assertEquals("camelcaseword", NameUtils.simpleName("CamelCaseWord"));
+ }
+
+ public void testSimpleNameNoChanges() {
+ assertEquals("nochanges", NameUtils.simpleName("nochanges"));
+ }
+
+ public void testSimpleNameRemoveSpaces() {
+ assertEquals("abcde", NameUtils.simpleName("a bc de "));
+ assertEquals("twoparts", NameUtils.simpleName("two parts"));
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/PrintLocale.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/PrintLocale.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/PrintLocale.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/PrintLocale.java Mon Apr 25 09:19:29 2011
@@ -17,14 +17,12 @@
* under the License.
*/
-
package org.apache.isis.core.commons.lang;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.TimeZone;
-
public class PrintLocale {
public static void main(final String[] args) {
if (args.length >= 2) {
@@ -59,4 +57,3 @@ public class PrintLocale {
System.out.println("DST: " + timezone.getDSTSavings() / (1000 * 60 * 60));
}
}
-
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NaturalNameTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NaturalNameTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NaturalNameTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NaturalNameTest.java Mon Apr 25 09:19:29 2011
@@ -17,15 +17,12 @@
* under the License.
*/
-
package org.apache.isis.core.commons.lang;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
-import org.apache.isis.core.commons.lang.StringUtils;
-
public class StringUtils_NaturalNameTest {
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NaturalizeTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NaturalizeTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NaturalizeTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NaturalizeTest.java Mon Apr 25 09:19:29 2011
@@ -17,15 +17,12 @@
* under the License.
*/
-
package org.apache.isis.core.commons.lang;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
-import org.apache.isis.core.commons.lang.StringUtils;
-
public class StringUtils_NaturalizeTest {
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NormalizedTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NormalizedTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NormalizedTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NormalizedTest.java Mon Apr 25 09:19:29 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.core.commons.lang;
import static org.hamcrest.CoreMatchers.is;
@@ -31,32 +30,29 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
-
@RunWith(Parameterized.class)
public class StringUtils_NormalizedTest {
@Parameters
public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][]{
- {null, null, }, // null
- {"", "", }, // empty string
- {"yada Foobar", "yada Foobar", }, // alreadyNormalized
- { "Yada\tFoobar", "Yada Foobar", } , // tab
- { "Yada\t Foobar", "Yada Foobar", }, // tab and space
- {"Yada foobar", "Yada foobar", }, // two spaces
- {"Yada\nfoobar", "Yada foobar", }, // new line
+ return Arrays.asList(new Object[][] { { null, null, }, // null
+ { "", "", }, // empty string
+ { "yada Foobar", "yada Foobar", }, // alreadyNormalized
+ { "Yada\tFoobar", "Yada Foobar", }, // tab
+ { "Yada\t Foobar", "Yada Foobar", }, // tab and space
+ { "Yada foobar", "Yada foobar", }, // two spaces
+ { "Yada\nfoobar", "Yada foobar", }, // new line
{ "Yada\n Foobar", "Yada Foobar", }, // newline and space
{ "Yada\r\n Foobar", "Yada Foobar", }, // windows newline
{ "Yada\r Foobar", "Yada Foobar", }, // macos newline
{ "Yada\r \tFoo \n\tbar Baz", "Yada Foo bar Baz", }, // multiple
});
}
-
+
private final String input;
private final String expected;
-
-
- public StringUtils_NormalizedTest(String input, String expected) {
+
+ public StringUtils_NormalizedTest(final String input, final String expected) {
this.input = input;
this.expected = expected;
}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NormalizedVarargsTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NormalizedVarargsTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NormalizedVarargsTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_NormalizedVarargsTest.java Mon Apr 25 09:19:29 2011
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.isis.core.commons.lang;
import static org.hamcrest.CoreMatchers.is;
@@ -31,23 +30,19 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
-
@RunWith(Parameterized.class)
public class StringUtils_NormalizedVarargsTest {
@Parameters
public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][]{
- {new String[]{"yada Foobar","Yada\r \tFoo \n\tbar Baz"},
- new String[]{"yada Foobar", "Yada Foo bar Baz"}, },
- });
+ return Arrays.asList(new Object[][] { { new String[] { "yada Foobar", "Yada\r \tFoo \n\tbar Baz" },
+ new String[] { "yada Foobar", "Yada Foo bar Baz" }, }, });
}
-
+
private final String[] input;
private final String[] expected;
-
-
- public StringUtils_NormalizedVarargsTest(String[] input, String[] expected) {
+
+ public StringUtils_NormalizedVarargsTest(final String[] input, final String[] expected) {
this.input = input;
this.expected = expected;
}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_RemoveLeadingWhiteSpace.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_RemoveLeadingWhiteSpace.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_RemoveLeadingWhiteSpace.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_RemoveLeadingWhiteSpace.java Mon Apr 25 09:19:29 2011
@@ -1,6 +1,5 @@
package org.apache.isis.core.commons.lang;
-import org.apache.isis.core.commons.lang.StringUtils;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_SplitOnCommas.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_SplitOnCommas.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_SplitOnCommas.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_SplitOnCommas.java Mon Apr 25 09:19:29 2011
@@ -2,7 +2,6 @@ package org.apache.isis.core.commons.lan
import java.util.List;
-import org.apache.isis.core.commons.lang.StringUtils;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_StripLeadingSlashTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_StripLeadingSlashTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_StripLeadingSlashTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_StripLeadingSlashTest.java Mon Apr 25 09:19:29 2011
@@ -17,15 +17,12 @@
* under the License.
*/
-
package org.apache.isis.core.commons.lang;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
-import org.apache.isis.core.commons.lang.StringUtils;
-
public class StringUtils_StripLeadingSlashTest {
@@ -44,9 +41,9 @@ public class StringUtils_StripLeadingSla
assertThat(StringUtils.stripLeadingSlash("/"), is(""));
}
- @Test(expected=NullPointerException.class)
+ @Test(expected = NullPointerException.class)
public void shouldFailOnNull() {
- StringUtils.stripLeadingSlash(null);
+ StringUtils.stripLeadingSlash(null);
}
}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_StripNewLinesTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_StripNewLinesTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_StripNewLinesTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_StripNewLinesTest.java Mon Apr 25 09:19:29 2011
@@ -17,15 +17,12 @@
* under the License.
*/
-
package org.apache.isis.core.commons.lang;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Test;
-import org.apache.isis.core.commons.lang.StringUtils;
-
public class StringUtils_StripNewLinesTest {
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLineSeparated.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLineSeparated.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLineSeparated.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLineSeparated.java Mon Apr 25 09:19:29 2011
@@ -24,7 +24,6 @@ import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeThat;
-import org.apache.isis.core.commons.lang.StringUtils;
import org.junit.Test;
public class StringUtils_toLineSeparated {
@@ -50,5 +49,4 @@ public class StringUtils_toLineSeparated
assumeThat(System.getProperty("file.separator"), is(equalTo("\\")));
}
-
}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_ContainsStripNewLinesTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_ContainsStripNewLinesTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_ContainsStripNewLinesTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_ContainsStripNewLinesTest.java Mon Apr 25 09:19:29 2011
@@ -17,55 +17,52 @@
* under the License.
*/
+package org.apache.isis.core.commons.matchers;
-package org.apache.isis.core.commons.matchers;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.hamcrest.Matcher;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-
-
-public class IsisMatchers_ContainsStripNewLinesTest {
-
- private Matcher<String> fooMatcher;
-
- @Before
- public void setUp() {
- fooMatcher = IsisMatchers.containsStripNewLines("foo");
- }
-
- @Test
- public void shouldMatchExactString() {
- assertThat(fooMatcher.matches("foo"), is(true));
- }
-
- @Test
- public void shouldMatchIfContainsStringNoNewLines() {
- assertThat(fooMatcher.matches("abcfoodef"), is(true));
- }
-
- @Test
- public void shouldMatchIfContainsStringHasNewLinesBefore() {
- assertThat(fooMatcher.matches("a\nb\rc\r\ndfoodef"), is(true));
- }
-
- @Test
- public void shouldMatchIfContainsStringHasNewLinesAfter() {
- assertThat(fooMatcher.matches("abrdfood\ne\rfan\rg"), is(true));
- }
-
- @Test
- public void shouldMatchIfContainsStringHasNewLinesWithin() {
- assertThat(fooMatcher.matches("abcf\ro\nodef"), is(true));
- }
-
- @Test
- public void shouldNotMatchIfDoesNotContainsString() {
- assertThat(fooMatcher.matches("fob"), is(false));
- }
-
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.hamcrest.Matcher;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IsisMatchers_ContainsStripNewLinesTest {
+
+ private Matcher<String> fooMatcher;
+
+ @Before
+ public void setUp() {
+ fooMatcher = IsisMatchers.containsStripNewLines("foo");
+ }
+
+ @Test
+ public void shouldMatchExactString() {
+ assertThat(fooMatcher.matches("foo"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfContainsStringNoNewLines() {
+ assertThat(fooMatcher.matches("abcfoodef"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfContainsStringHasNewLinesBefore() {
+ assertThat(fooMatcher.matches("a\nb\rc\r\ndfoodef"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfContainsStringHasNewLinesAfter() {
+ assertThat(fooMatcher.matches("abrdfood\ne\rfan\rg"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfContainsStringHasNewLinesWithin() {
+ assertThat(fooMatcher.matches("abcf\ro\nodef"), is(true));
+ }
+
+ @Test
+ public void shouldNotMatchIfDoesNotContainsString() {
+ assertThat(fooMatcher.matches("fob"), is(false));
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EndsWithStripNewLinesTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EndsWithStripNewLinesTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EndsWithStripNewLinesTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EndsWithStripNewLinesTest.java Mon Apr 25 09:19:29 2011
@@ -17,50 +17,47 @@
* under the License.
*/
+package org.apache.isis.core.commons.matchers;
-package org.apache.isis.core.commons.matchers;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.hamcrest.Matcher;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-
-
-public class IsisMatchers_EndsWithStripNewLinesTest {
-
- private Matcher<String> fooMatcher;
-
- @Before
- public void setUp() {
- fooMatcher = IsisMatchers.endsWithStripNewLines("foo");
- }
-
- @Test
- public void shouldMatchExactString() {
- assertThat(fooMatcher.matches("foo"), is(true));
- }
-
- @Test
- public void shouldMatchIfEndsWithAndStringNoNewLines() {
- assertThat(fooMatcher.matches("abcfoo"), is(true));
- }
-
- @Test
- public void shouldMatchIfEndsWithStringHasNewLinesAfter() {
- assertThat(fooMatcher.matches("a\nb\rc\r\nfoo"), is(true));
- }
-
- @Test
- public void shouldMatchIfEndsWithStringHasNewLinesWithin() {
- assertThat(fooMatcher.matches("abcf\ro\no"), is(true));
- }
-
- @Test
- public void shouldNotMatchIfDoesNotEndsWithString() {
- assertThat(fooMatcher.matches("fob"), is(false));
- }
-
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.hamcrest.Matcher;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IsisMatchers_EndsWithStripNewLinesTest {
+
+ private Matcher<String> fooMatcher;
+
+ @Before
+ public void setUp() {
+ fooMatcher = IsisMatchers.endsWithStripNewLines("foo");
+ }
+
+ @Test
+ public void shouldMatchExactString() {
+ assertThat(fooMatcher.matches("foo"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfEndsWithAndStringNoNewLines() {
+ assertThat(fooMatcher.matches("abcfoo"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfEndsWithStringHasNewLinesAfter() {
+ assertThat(fooMatcher.matches("a\nb\rc\r\nfoo"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfEndsWithStringHasNewLinesWithin() {
+ assertThat(fooMatcher.matches("abcf\ro\no"), is(true));
+ }
+
+ @Test
+ public void shouldNotMatchIfDoesNotEndsWithString() {
+ assertThat(fooMatcher.matches("fob"), is(false));
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EqualToStripNewLinesTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EqualToStripNewLinesTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EqualToStripNewLinesTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EqualToStripNewLinesTest.java Mon Apr 25 09:19:29 2011
@@ -17,50 +17,47 @@
* under the License.
*/
+package org.apache.isis.core.commons.matchers;
-package org.apache.isis.core.commons.matchers;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.hamcrest.Matcher;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-
-
-public class IsisMatchers_EqualToStripNewLinesTest {
-
- private Matcher<String> fooMatcher;
-
- @Before
- public void setUp() {
- fooMatcher = IsisMatchers.equalToStripNewLines("foo");
- }
-
- @Test
- public void shouldMatchExactString() {
- assertThat(fooMatcher.matches("foo"), is(true));
- }
-
- @Test
- public void shouldNotMatchIfStartsWithAnything() {
- assertThat(fooMatcher.matches("afoo"), is(false));
- }
-
- @Test
- public void shouldNotMatchIfEndsWithAnything() {
- assertThat(fooMatcher.matches("fooz"), is(false));
- }
-
- @Test
- public void shouldMatchIfEqualToStringHasNewLinesWithin() {
- assertThat(fooMatcher.matches("f\ro\no"), is(true));
- }
-
- @Test
- public void shouldNotMatchIfDoesNotStartWithString() {
- assertThat(fooMatcher.matches("fob"), is(false));
- }
-
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.hamcrest.Matcher;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IsisMatchers_EqualToStripNewLinesTest {
+
+ private Matcher<String> fooMatcher;
+
+ @Before
+ public void setUp() {
+ fooMatcher = IsisMatchers.equalToStripNewLines("foo");
+ }
+
+ @Test
+ public void shouldMatchExactString() {
+ assertThat(fooMatcher.matches("foo"), is(true));
+ }
+
+ @Test
+ public void shouldNotMatchIfStartsWithAnything() {
+ assertThat(fooMatcher.matches("afoo"), is(false));
+ }
+
+ @Test
+ public void shouldNotMatchIfEndsWithAnything() {
+ assertThat(fooMatcher.matches("fooz"), is(false));
+ }
+
+ @Test
+ public void shouldMatchIfEqualToStringHasNewLinesWithin() {
+ assertThat(fooMatcher.matches("f\ro\no"), is(true));
+ }
+
+ @Test
+ public void shouldNotMatchIfDoesNotStartWithString() {
+ assertThat(fooMatcher.matches("fob"), is(false));
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringOrNullTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringOrNullTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringOrNullTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringOrNullTest.java Mon Apr 25 09:19:29 2011
@@ -17,40 +17,37 @@
* under the License.
*/
+package org.apache.isis.core.commons.matchers;
-package org.apache.isis.core.commons.matchers;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.hamcrest.Matcher;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-
-
-public class IsisMatchers_NonEmptyStringOrNullTest {
-
- private Matcher<String> fooMatcher;
-
- @Before
- public void setUp() {
- fooMatcher = IsisMatchers.nonEmptyStringOrNull();
- }
-
- @Test
- public void shouldMatchNonEmptyString() {
- assertThat(fooMatcher.matches("foo"), is(true));
- }
-
- @Test
- public void shouldNotMatchEmptyString() {
- assertThat(fooMatcher.matches(""), is(false));
- }
-
- @Test
- public void shouldMatchNullString() {
- assertThat(fooMatcher.matches(null), is(true));
- }
-
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.hamcrest.Matcher;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IsisMatchers_NonEmptyStringOrNullTest {
+
+ private Matcher<String> fooMatcher;
+
+ @Before
+ public void setUp() {
+ fooMatcher = IsisMatchers.nonEmptyStringOrNull();
+ }
+
+ @Test
+ public void shouldMatchNonEmptyString() {
+ assertThat(fooMatcher.matches("foo"), is(true));
+ }
+
+ @Test
+ public void shouldNotMatchEmptyString() {
+ assertThat(fooMatcher.matches(""), is(false));
+ }
+
+ @Test
+ public void shouldMatchNullString() {
+ assertThat(fooMatcher.matches(null), is(true));
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringTest.java Mon Apr 25 09:19:29 2011
@@ -17,40 +17,37 @@
* under the License.
*/
+package org.apache.isis.core.commons.matchers;
-package org.apache.isis.core.commons.matchers;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.hamcrest.Matcher;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-
-
-public class IsisMatchers_NonEmptyStringTest {
-
- private Matcher<String> fooMatcher;
-
- @Before
- public void setUp() {
- fooMatcher = IsisMatchers.nonEmptyString();
- }
-
- @Test
- public void shouldMatchNonEmptyString() {
- assertThat(fooMatcher.matches("foo"), is(true));
- }
-
- @Test
- public void shouldNotMatchEmptyString() {
- assertThat(fooMatcher.matches(""), is(false));
- }
-
- @Test
- public void shouldNotMatchNullString() {
- assertThat(fooMatcher.matches(null), is(false));
- }
-
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.hamcrest.Matcher;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IsisMatchers_NonEmptyStringTest {
+
+ private Matcher<String> fooMatcher;
+
+ @Before
+ public void setUp() {
+ fooMatcher = IsisMatchers.nonEmptyString();
+ }
+
+ @Test
+ public void shouldMatchNonEmptyString() {
+ assertThat(fooMatcher.matches("foo"), is(true));
+ }
+
+ @Test
+ public void shouldNotMatchEmptyString() {
+ assertThat(fooMatcher.matches(""), is(false));
+ }
+
+ @Test
+ public void shouldNotMatchNullString() {
+ assertThat(fooMatcher.matches(null), is(false));
+ }
+
+}
Modified: incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_StartsWithStripNewLinesTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_StartsWithStripNewLinesTest.java?rev=1096439&r1=1096438&r2=1096439&view=diff
==============================================================================
--- incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_StartsWithStripNewLinesTest.java (original)
+++ incubator/isis/trunk/core/commons/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_StartsWithStripNewLinesTest.java Mon Apr 25 09:19:29 2011
@@ -17,50 +17,47 @@
* under the License.
*/
+package org.apache.isis.core.commons.matchers;
-package org.apache.isis.core.commons.matchers;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.hamcrest.Matcher;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-
-
-public class IsisMatchers_StartsWithStripNewLinesTest {
-
- private Matcher<String> fooMatcher;
-
- @Before
- public void setUp() {
- fooMatcher = IsisMatchers.startsWithStripNewLines("foo");
- }
-
- @Test
- public void shouldMatchExactString() {
- assertThat(fooMatcher.matches("foo"), is(true));
- }
-
- @Test
- public void shouldMatchIfStartsWithAndStringNoNewLines() {
- assertThat(fooMatcher.matches("foodef"), is(true));
- }
-
- @Test
- public void shouldMatchIfStartsWithStringHasNewLinesAfter() {
- assertThat(fooMatcher.matches("food\ne\rfan\rg"), is(true));
- }
-
- @Test
- public void shouldMatchIfStartsWithStringHasNewLinesWithin() {
- assertThat(fooMatcher.matches("f\ro\nodef"), is(true));
- }
-
- @Test
- public void shouldNotMatchIfDoesNotStartWithString() {
- assertThat(fooMatcher.matches("fob"), is(false));
- }
-
-}
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.hamcrest.Matcher;
+import org.junit.Before;
+import org.junit.Test;
+
+public class IsisMatchers_StartsWithStripNewLinesTest {
+
+ private Matcher<String> fooMatcher;
+
+ @Before
+ public void setUp() {
+ fooMatcher = IsisMatchers.startsWithStripNewLines("foo");
+ }
+
+ @Test
+ public void shouldMatchExactString() {
+ assertThat(fooMatcher.matches("foo"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfStartsWithAndStringNoNewLines() {
+ assertThat(fooMatcher.matches("foodef"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfStartsWithStringHasNewLinesAfter() {
+ assertThat(fooMatcher.matches("food\ne\rfan\rg"), is(true));
+ }
+
+ @Test
+ public void shouldMatchIfStartsWithStringHasNewLinesWithin() {
+ assertThat(fooMatcher.matches("f\ro\nodef"), is(true));
+ }
+
+ @Test
+ public void shouldNotMatchIfDoesNotStartWithString() {
+ assertThat(fooMatcher.matches("fob"), is(false));
+ }
+
+}