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 2012/12/05 00:41:11 UTC

[42/52] [partial] ISIS-188: consolidating isis-core

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLineSeparated.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLineSeparated.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLineSeparated.java
new file mode 100644
index 0000000..eca9b1c
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLineSeparated.java
@@ -0,0 +1,52 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.commons.lang;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assume.assumeThat;
+
+import org.junit.Test;
+
+public class StringUtils_toLineSeparated {
+
+    @Test
+    public void convertsCarriageReturnToLineSeparator() throws Exception {
+        assertThat(StringUtils.lineSeparated("ok\n"), is("ok" + System.getProperty("line.separator")));
+    }
+
+    @Test
+    public void windowsStyleCarriageReturnLeftUnchanged() throws Exception {
+        assumeThatRunningOnWindows(); // ie windows
+        assertThat(StringUtils.lineSeparated("ok\r\n"), is("ok" + System.getProperty("line.separator")));
+    }
+
+    @Test
+    public void macStyleCarriageReturnLeftUnchanged() throws Exception {
+        assumeThatRunningOnWindows(); // ie windows
+        assertThat(StringUtils.lineSeparated("ok\r"), is("ok\r"));
+    }
+
+    private static void assumeThatRunningOnWindows() {
+        assumeThat(System.getProperty("file.separator"), is(equalTo("\\")));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLowerDashed.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLowerDashed.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLowerDashed.java
new file mode 100644
index 0000000..d068651
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/StringUtils_toLowerDashed.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  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;
+
+public class StringUtils_toLowerDashed {
+
+    @Test
+    public void toLowerDashed() {
+        assertThat(StringUtils.toLowerDashed("An Upper Case"), is("an-upper-case"));
+        assertThat(StringUtils.toLowerDashed("An   Upper   Case"), is("an-upper-case"));
+        assertThat(StringUtils.toLowerDashed("An\nUpper\tCase"), is("an-upper-case"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/TypesTest_filteredList.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/TypesTest_filteredList.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/TypesTest_filteredList.java
new file mode 100644
index 0000000..3da9105
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/lang/TypesTest_filteredList.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.commons.lang;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class TypesTest_filteredList {
+
+    private List<Object> shapes;
+
+    abstract static class Shape {}
+    static class Square extends Shape {}
+    static class Circle extends Shape {}
+    static class Rectangle extends Shape {}
+
+    @Before
+    public void setUp() throws Exception {
+        shapes = Arrays.<Object>asList(new Square(), new Circle(), new Square());
+    }
+    
+    @Test
+    public void empty() throws ClassNotFoundException {
+        final Collection<Object> filtered = Types.filtered(Collections.emptyList(), Object.class);
+        assertThat(filtered.isEmpty(), is(true));
+    }
+
+    @Test
+    public void subtype() throws ClassNotFoundException {
+        final Collection<Square> filtered = Types.filtered(shapes, Square.class);
+        assertThat(filtered.size(), is(2));
+    }
+
+    @Test
+    public void supertype() throws ClassNotFoundException {
+        final Collection<Shape> filtered = Types.filtered(shapes, Shape.class);
+        assertThat(filtered.size(), is(3));
+    }
+
+    @Test
+    public void subtype_whenNonMatching() throws ClassNotFoundException {
+        final Collection<Rectangle> filtered = Types.filtered(shapes, Rectangle.class);
+        assertThat(filtered.size(), is(0));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_ContainsStripNewLinesTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_ContainsStripNewLinesTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_ContainsStripNewLinesTest.java
new file mode 100644
index 0000000..b9d1e74
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_ContainsStripNewLinesTest.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+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;
+
+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));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EndsWithStripNewLinesTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EndsWithStripNewLinesTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EndsWithStripNewLinesTest.java
new file mode 100644
index 0000000..f8efa13
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EndsWithStripNewLinesTest.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+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;
+
+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));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EqualToStripNewLinesTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EqualToStripNewLinesTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EqualToStripNewLinesTest.java
new file mode 100644
index 0000000..6d89f51
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_EqualToStripNewLinesTest.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+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;
+
+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));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringOrNullTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringOrNullTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringOrNullTest.java
new file mode 100644
index 0000000..a1604ee
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringOrNullTest.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+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;
+
+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));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringTest.java
new file mode 100644
index 0000000..6d1afff
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_NonEmptyStringTest.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+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;
+
+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));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_StartsWithStripNewLinesTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_StartsWithStripNewLinesTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_StartsWithStripNewLinesTest.java
new file mode 100644
index 0000000..500c9fd
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/commons/matchers/IsisMatchers_StartsWithStripNewLinesTest.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+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;
+
+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));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelBaseTest_constructDefaults.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelBaseTest_constructDefaults.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelBaseTest_constructDefaults.java
new file mode 100644
index 0000000..a499021
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelBaseTest_constructDefaults.java
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.app;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public class IsisMetaModelBaseTest_constructDefaults {
+
+    @Rule
+    public final JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_ONLY);
+
+    @Mock
+    private RuntimeContext mockContext;
+
+    @Mock
+    private ProgrammingModel mockProgrammingModel;
+    
+    private IsisMetaModel metaModel;
+
+    @Before
+    public void setUp() {
+        metaModel = new IsisMetaModel(mockContext, mockProgrammingModel);
+    }
+
+    @Test
+    public void shouldDefaultConfiguration() {
+        assertThat(metaModel.getConfiguration(), is(notNullValue()));
+    }
+
+    @Test
+    public void shouldDefaultClassSubstitutor() {
+        assertThat(metaModel.getClassSubstitutor(), is(notNullValue()));
+    }
+
+    @Test
+    public void shouldDefaultProgrammingModelFacets() {
+        assertThat(metaModel.getProgrammingModelFacets(), is(notNullValue()));
+    }
+
+    @Test
+    public void shouldDefaultCollectionTypeRegistry() {
+        assertThat(metaModel.getCollectionTypeRegistry(), is(notNullValue()));
+    }
+
+    @Test
+    public void shouldDefaultFacetDecorators() {
+        assertThat(metaModel.getFacetDecorators(), is(notNullValue()));
+    }
+
+    @Test
+    public void shouldHaveNoFacetDecorators() {
+        assertThat(metaModel.getFacetDecorators().size(), is(0));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToShutdown() {
+        metaModel.shutdown();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_constructWithServices.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_constructWithServices.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_constructWithServices.java
new file mode 100644
index 0000000..141d67d
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_constructWithServices.java
@@ -0,0 +1,74 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.app;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.jmock.auto.Mock;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public class IsisMetaModelTest_constructWithServices {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    private RuntimeContext mockContext;
+
+    @Mock
+    private ProgrammingModel mockProgrammingModel;
+
+    @Mock
+    private SomeRepo mockService1;
+
+    @Mock
+    private SomeOtherRepo mockService2;
+
+    private IsisMetaModel metaModel;
+
+    private static class SomeRepo {}
+    private static class SomeOtherRepo {}
+    
+    @Test
+    public void shouldSucceedWithoutThrowingAnyExceptions() {
+        metaModel = new IsisMetaModel(mockContext, mockProgrammingModel);
+    }
+
+    @Test
+    public void shouldBeAbleToRegisterServices() {
+        metaModel = new IsisMetaModel(mockContext, mockProgrammingModel, mockService1, mockService2);
+        final List<Object> services = metaModel.getServices();
+        assertThat(services.size(), is(2));
+        assertThat(services, IsisMatchers.containsObjectOfType(SomeRepo.class));
+        assertThat(services, IsisMatchers.containsObjectOfType(SomeOtherRepo.class));
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_getDomainObjectContainer.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_getDomainObjectContainer.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_getDomainObjectContainer.java
new file mode 100644
index 0000000..3a3419d
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_getDomainObjectContainer.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.app;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import org.jmock.Expectations;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.testsupport.jmock.IsisActions;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public class IsisMetaModelTest_getDomainObjectContainer {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    private RuntimeContext mockContext;
+
+    @Mock
+    private ProgrammingModel mockProgrammingModel;
+    
+    private IsisMetaModel metaModel;
+
+
+    @Before
+    public void setUp() {
+        metaModel = new IsisMetaModel(mockContext, mockProgrammingModel);
+        expectingMetaModelToBeInitialized();
+        metaModel.init();
+    }
+    
+    private void expectingMetaModelToBeInitialized() {
+        context.checking(new Expectations() {
+            {
+                allowing(mockContext).injectInto(with(any(Object.class)));
+                will(IsisActions.injectInto());
+                
+                ignoring(mockContext);
+                
+                ignoring(mockProgrammingModel);
+            }
+        });
+    }
+
+
+    @Test
+    public void happyCase() {
+        assertThat(metaModel.getDomainObjectContainer(), is(notNullValue()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_init.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_init.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_init.java
new file mode 100644
index 0000000..0cf67a4
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_init.java
@@ -0,0 +1,147 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.app;
+
+import java.util.TreeSet;
+
+import com.google.common.collect.Lists;
+
+import org.jmock.Expectations;
+import org.jmock.Sequence;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistry;
+import org.apache.isis.core.testsupport.jmock.IsisActions;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public class IsisMetaModelTest_init {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    private IsisConfiguration mockConfiguration;
+    @Mock
+    private ProgrammingModel mockProgrammingModelFacets;
+    @Mock
+    private FacetDecorator mockFacetDecorator;
+    @Mock
+    private ClassSubstitutor mockClassSubstitutor;
+    @Mock
+    private CollectionTypeRegistry mockCollectionTypeRegistry;
+    @Mock
+    private RuntimeContext mockRuntimeContext;
+
+    private IsisMetaModel metaModel;
+
+    @Before
+    public void setUp() {
+        expectingMetaModelToBeInitialized();
+        metaModel = new IsisMetaModel(mockRuntimeContext, mockProgrammingModelFacets);
+    }
+
+    private void expectingMetaModelToBeInitialized() {
+        final Sequence initSequence = context.sequence("init");
+        context.checking(new Expectations() {
+            {
+                allowing(mockRuntimeContext).injectInto(with(any(Object.class)));
+                will(IsisActions.injectInto());
+                
+                one(mockRuntimeContext).setContainer(with(any(DomainObjectContainer.class)));
+                inSequence(initSequence);
+                
+                one(mockProgrammingModelFacets).init();
+                inSequence(initSequence);
+                
+                one(mockProgrammingModelFacets).getList();
+                inSequence(initSequence);
+                will(returnValue(Lists.newArrayList()));
+                
+                one(mockRuntimeContext).init();
+                inSequence(initSequence);
+            }
+        });
+    }
+
+    @Test
+    public void shouldSucceedWithoutThrowingAnyExceptions() {
+        metaModel.init();
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeConfiguration() {
+        metaModel.init();
+        metaModel.setConfiguration(mockConfiguration);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeProgrammingModelFacets() {
+        metaModel.init();
+        metaModel.setProgrammingModelFacets(mockProgrammingModelFacets);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeCollectionTypeRegistry() {
+        metaModel.init();
+        metaModel.setCollectionTypeRegistry(mockCollectionTypeRegistry);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeClassSubstitutor() {
+        metaModel.init();
+        metaModel.setClassSubstitutor(mockClassSubstitutor);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeFacetDecorators() {
+        metaModel.init();
+        metaModel.setFacetDecorators(new TreeSet<FacetDecorator>());
+    }
+
+    @Test(expected = UnsupportedOperationException.class)
+    public void shouldNotBeAbleToAddToFacetDecorators() {
+        metaModel.init();
+        metaModel.getFacetDecorators().add(mockFacetDecorator);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToInitializeAgain() {
+        metaModel.init();
+        //
+        metaModel.init();
+    }
+
+    @Test
+    public void shouldPrime() {
+        metaModel.init();
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_shutdown.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_shutdown.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_shutdown.java
new file mode 100644
index 0000000..411e8e1
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/app/IsisMetaModelTest_shutdown.java
@@ -0,0 +1,142 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.app;
+
+import java.util.TreeSet;
+
+import com.google.common.collect.Lists;
+
+import org.jmock.Expectations;
+import org.jmock.Sequence;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistry;
+import org.apache.isis.core.testsupport.jmock.IsisActions;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public class IsisMetaModelTest_shutdown {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    
+    @Mock
+    private IsisConfiguration mockConfiguration;
+    @Mock
+    private ProgrammingModel mockProgrammingModel;
+    @Mock
+    private FacetDecorator mockFacetDecorator;
+    @Mock
+    private ClassSubstitutor mockClassSubstitutor;
+    @Mock
+    private CollectionTypeRegistry mockCollectionTypeRegistry;
+    @Mock
+    private RuntimeContext mockRuntimeContext;
+
+    private IsisMetaModel metaModel;
+
+    @Before
+    public void setUp() {
+        expectingMetaModelToBeInitialized();
+        metaModel = new IsisMetaModel(mockRuntimeContext, mockProgrammingModel);
+    }
+
+    private void expectingMetaModelToBeInitialized() {
+        final Sequence initSequence = context.sequence("init");
+        context.checking(new Expectations() {
+            {
+                allowing(mockRuntimeContext).injectInto(with(any(Object.class)));
+                will(IsisActions.injectInto());
+                
+                one(mockRuntimeContext).setContainer(with(any(DomainObjectContainer.class)));
+                inSequence(initSequence);
+                
+                one(mockProgrammingModel).init();
+                inSequence(initSequence);
+                
+                one(mockProgrammingModel).getList();
+                inSequence(initSequence);
+                will(returnValue(Lists.newArrayList()));
+                
+                one(mockRuntimeContext).init();
+                inSequence(initSequence);
+            }
+        });
+    }
+
+    @Test
+    public void shouldSucceedWithoutThrowingAnyExceptions() {
+        metaModel.init();
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeConfiguration() {
+        metaModel.init();
+        metaModel.setConfiguration(mockConfiguration);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeProgrammingModelFacets() {
+        metaModel.init();
+        metaModel.setProgrammingModelFacets(mockProgrammingModel);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeCollectionTypeRegistry() {
+        metaModel.init();
+        metaModel.setCollectionTypeRegistry(mockCollectionTypeRegistry);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeClassSubstitutor() {
+        metaModel.init();
+        metaModel.setClassSubstitutor(mockClassSubstitutor);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToChangeFacetDecorators() {
+        metaModel.init();
+        metaModel.setFacetDecorators(new TreeSet<FacetDecorator>());
+    }
+
+    @Test(expected = UnsupportedOperationException.class)
+    public void shouldNotBeAbleToAddToFacetDecorators() {
+        metaModel.init();
+        metaModel.getFacetDecorators().add(mockFacetDecorator);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotBeAbleToInitializeAgain() {
+        metaModel.init();
+        //
+        metaModel.init();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facetdecorators/help/file/internal/SimpleHelpManagerTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facetdecorators/help/file/internal/SimpleHelpManagerTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facetdecorators/help/file/internal/SimpleHelpManagerTest.java
new file mode 100644
index 0000000..fa9b2e0
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facetdecorators/help/file/internal/SimpleHelpManagerTest.java
@@ -0,0 +1,201 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facetdecorators.help.file.internal;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.StringReader;
+
+import junit.framework.TestCase;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+
+public class SimpleHelpManagerTest extends TestCase {
+
+    public static void main(final String[] args) {
+        junit.textui.TestRunner.run(SimpleHelpManagerTest.class);
+    }
+
+    private TestHelpManager manager;
+
+    @Override
+    protected void setUp() throws Exception {
+        manager = new TestHelpManager(new IsisConfigurationDefault());
+    }
+
+    public void testNoLines() {
+        final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "mth");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("", s);
+    }
+
+    public void testClass() {
+        manager.addLine("C:cls");
+        manager.addLine("Help about class");
+
+        final Identifier identifier = Identifier.classIdentifier("cls");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Help about class\n", s);
+    }
+
+    public void testClassWithNoText() {
+        manager.addLine("C:cls");
+        manager.addLine("C:cls2");
+        manager.addLine("Help about class");
+
+        final Identifier identifier = Identifier.classIdentifier("cls");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("", s);
+    }
+
+    public void testClassTextStopsAtNextClass() {
+        manager.addLine("C:cls");
+        manager.addLine("Help about class");
+        manager.addLine("C:cls2");
+        manager.addLine("Different text");
+
+        final Identifier identifier = Identifier.classIdentifier("cls");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Help about class\n", s);
+    }
+
+    public void testMethodTextStopsAtNextClass() {
+        manager.addLine("C:cls");
+        manager.addLine("M:fld");
+        manager.addLine("Help about method");
+        manager.addLine("C:cls2");
+        manager.addLine("Different text");
+
+        final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Help about method\n", s);
+    }
+
+    public void testMethodTextStopsAtNextMethod() {
+        manager.addLine("C:cls");
+        manager.addLine("M:fld");
+        manager.addLine("Help about method");
+        manager.addLine("M:fld2");
+        manager.addLine("Different text");
+
+        final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Help about method\n", s);
+    }
+
+    public void testClassTextStopsAtFirstMethod() {
+        manager.addLine("C:cls");
+        manager.addLine("Help about class");
+        manager.addLine("M:method");
+        manager.addLine("Different text");
+
+        final Identifier identifier = Identifier.classIdentifier("cls");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Help about class\n", s);
+    }
+
+    public void testEntryWithMultipleLines() {
+        manager.addLine("C:cls");
+        manager.addLine("Help about class");
+        manager.addLine("line 2");
+        manager.addLine("line 3");
+
+        final Identifier identifier = Identifier.classIdentifier("cls");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Help about class\nline 2\nline 3\n", s);
+    }
+
+    public void testFieldWithNoEntry() {
+        manager.addLine("C:cls");
+        manager.addLine("Help about class");
+
+        final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld2");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("", s);
+    }
+
+    public void testMessageForFileError() {
+        final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld2");
+        final HelpManagerUsingFiles manager = new HelpManagerUsingFiles(new IsisConfigurationDefault()) {
+            @Override
+            protected BufferedReader getReader() throws FileNotFoundException {
+                throw new FileNotFoundException("not found");
+            }
+        };
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Failure opening help file: not found", s);
+    }
+
+    public void testField() {
+        manager.addLine("C:cls");
+        manager.addLine("Help about class");
+        manager.addLine("M:fld1");
+        manager.addLine("Help about field");
+        manager.addLine("M:fld2");
+        manager.addLine("Help about second field");
+
+        final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld2");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Help about second field\n", s);
+    }
+
+    public void testReadBlankLines() {
+        manager.addLine("C:cls");
+        manager.addLine("");
+        manager.addLine("");
+        manager.addLine("Help about class");
+
+        final Identifier identifier = Identifier.classIdentifier("cls");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("\n\nHelp about class\n", s);
+
+    }
+
+    public void testSkipComments() {
+        manager.addLine("C:cls");
+        manager.addLine("# comment");
+        manager.addLine("Help about class");
+
+        final Identifier identifier = Identifier.classIdentifier("cls");
+        final String s = manager.getHelpText(identifier);
+        assertEquals("Help about class\n", s);
+
+    }
+}
+
+class TestHelpManager extends HelpManagerUsingFiles {
+    public TestHelpManager(final IsisConfiguration configuration) {
+        super(configuration);
+    }
+
+    private final StringBuffer file = new StringBuffer();
+
+    public void addLine(final String string) {
+        file.append(string);
+        file.append('\n');
+    }
+
+    @Override
+    protected BufferedReader getReader() throws FileNotFoundException {
+        return new BufferedReader(new StringReader(file.toString()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/AbstractFacetFactoryJUnit4TestCase.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/AbstractFacetFactoryJUnit4TestCase.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/AbstractFacetFactoryJUnit4TestCase.java
new file mode 100644
index 0000000..30721ba
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/AbstractFacetFactoryJUnit4TestCase.java
@@ -0,0 +1,109 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.jmock.auto.Mock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetHolderImpl;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facetapi.MethodRemover;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.FacetedMethodParameter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneActionParameter;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest.Customer;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public abstract class AbstractFacetFactoryJUnit4TestCase {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_ONLY);
+
+    @Mock
+    protected SpecificationLoaderSpi reflector;
+    @Mock
+    protected MethodRemover methodRemover;
+    @Mock
+    protected FacetHolder facetHolder;
+
+    protected FacetHolder facetHolderImpl;
+
+    @Mock
+    protected ObjectSpecification objSpec;
+    @Mock
+    protected OneToOneAssociation oneToOneAssociation;
+    @Mock
+    protected OneToManyAssociation oneToManyAssociation;
+    @Mock
+    protected OneToOneActionParameter actionParameter;
+
+    protected FacetedMethod facetedMethod;
+    protected FacetedMethodParameter facetedMethodParameter;
+
+    @Before
+    public void setUpFacetedMethodAndParameter() throws Exception {
+        facetHolderImpl = new FacetHolderImpl();
+        facetedMethod = FacetedMethod.createForProperty(Customer.class, "firstName");
+        facetedMethodParameter = new FacetedMethodParameter(String.class);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        facetHolderImpl = null;
+        facetedMethod = null;
+        facetedMethodParameter = null;
+    }
+    
+    protected boolean contains(final Class<?>[] types, final Class<?> type) {
+        return Utils.contains(types, type);
+    }
+
+    protected boolean contains(final FeatureType[] featureTypes, final FeatureType featureType) {
+        return Utils.contains(featureTypes, featureType);
+    }
+
+    protected static boolean contains(final List<FeatureType> featureTypes, final FeatureType featureType) {
+        return Utils.contains(featureTypes, featureType);
+    }
+
+    protected Method findMethod(final Class<?> type, final String methodName, final Class<?>[] methodTypes) {
+        return Utils.findMethod(type, methodName, methodTypes);
+    }
+
+    protected Method findMethod(final Class<?> type, final String methodName) {
+        return Utils.findMethod(type, methodName);
+    }
+
+    protected void expectNoMethodsRemoved() {
+        context.never(methodRemover);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/AbstractFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/AbstractFacetFactoryTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/AbstractFacetFactoryTest.java
new file mode 100644
index 0000000..34f6e67
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/AbstractFacetFactoryTest.java
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetHolderImpl;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.FacetedMethodParameter;
+
+public abstract class AbstractFacetFactoryTest extends TestCase {
+
+    public static class Customer {
+
+        private String firstName;
+
+        public String getFirstName() {
+            return firstName;
+        }
+
+        public void setFirstName(final String firstName) {
+            this.firstName = firstName;
+        }
+    }
+
+    protected ProgrammableReflector reflector;
+    protected ProgrammableMethodRemover methodRemover;
+
+    protected FacetHolder facetHolder;
+    protected FacetedMethod facetedMethod;
+    protected FacetedMethodParameter facetedMethodParameter;
+
+    @Override
+    protected void setUp() throws Exception {
+        Logger.getRootLogger().setLevel(Level.OFF);
+        super.setUp();
+        BasicConfigurator.configure();
+        reflector = new ProgrammableReflector();
+        facetHolder = new FacetHolderImpl();
+        facetedMethod = FacetedMethod.createForProperty(Customer.class, "firstName");
+        facetedMethodParameter = new FacetedMethodParameter(String.class);
+        methodRemover = new ProgrammableMethodRemover();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        reflector = null;
+        methodRemover = null;
+        facetedMethod = null;
+        super.tearDown();
+    }
+
+    protected static boolean contains(final Class<?>[] types, final Class<?> type) {
+        return Utils.contains(types, type);
+    }
+
+    protected static boolean contains(final List<FeatureType> featureTypes, final FeatureType featureType) {
+        return Utils.contains(featureTypes, featureType);
+    }
+
+    protected static Method findMethod(final Class<?> type, final String methodName, final Class<?>[] methodTypes) {
+        return Utils.findMethod(type, methodName, methodTypes);
+    }
+
+    protected Method findMethod(final Class<?> type, final String methodName) {
+        return Utils.findMethod(type, methodName);
+    }
+
+    protected void assertNoMethodsRemoved() {
+        assertTrue(methodRemover.getRemovedMethodMethodCalls().isEmpty());
+        assertTrue(methodRemover.getRemoveMethodArgsCalls().isEmpty());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ObjectAdapterUtilsTest.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ObjectAdapterUtilsTest.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ObjectAdapterUtilsTest.java
new file mode 100644
index 0000000..81b241d
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ObjectAdapterUtilsTest.java
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.jmock.Expectations;
+import org.jmock.auto.Mock;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectAdapterUtils;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public class ObjectAdapterUtilsTest {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_ONLY);
+
+    @Mock
+    private ObjectAdapter mockObjectAdapter;
+
+    private Object underlyingDomainObject;
+
+    @Test
+    public void testUnwrapObjectWhenNull() {
+        assertNull(ObjectAdapterUtils.unwrapObject(null));
+    }
+
+    @Test
+    public void testUnwrapObjectWhenNotNull() {
+        underlyingDomainObject = new Object(); 
+        expectAdapterWillReturn(underlyingDomainObject);
+        assertEquals(underlyingDomainObject, ObjectAdapterUtils.unwrapObject(mockObjectAdapter));
+    }
+
+    @Test
+    public void testUnwrapStringWhenNull() {
+        assertNull(ObjectAdapterUtils.unwrapObjectAsString(null));
+    }
+
+    @Test
+    public void testUnwrapStringWhenNotNullButNotString() {
+        underlyingDomainObject = new Object(); 
+        expectAdapterWillReturn(underlyingDomainObject);
+        assertNull(ObjectAdapterUtils.unwrapObjectAsString(mockObjectAdapter));
+    }
+
+    @Test
+    public void testUnwrapStringWhenNotNullAndString() {
+        underlyingDomainObject = "huzzah";
+        expectAdapterWillReturn(underlyingDomainObject);
+        assertEquals("huzzah", ObjectAdapterUtils.unwrapObjectAsString(mockObjectAdapter));
+    }
+
+    private void expectAdapterWillReturn(final Object domainObject) {
+        context.checking(new Expectations() {
+            {
+                allowing(mockObjectAdapter).getObject();
+                will(returnValue(domainObject));
+            }
+        });
+    }
+    
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ProgrammableMethodRemover.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ProgrammableMethodRemover.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ProgrammableMethodRemover.java
new file mode 100644
index 0000000..5347058
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ProgrammableMethodRemover.java
@@ -0,0 +1,120 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.MethodRemover;
+import org.apache.isis.core.metamodel.methodutils.MethodScope;
+
+public class ProgrammableMethodRemover implements MethodRemover {
+
+    // ////////////////////////////////////////////////////////////
+    // removeMethod(...): void
+    // ////////////////////////////////////////////////////////////
+
+    static class RemoveMethodArgs {
+        public RemoveMethodArgs(final MethodScope methodScope, final String methodName, final Class<?> returnType, final Class<?>[] parameterTypes) {
+            this.methodScope = methodScope;
+            this.methodName = methodName;
+            this.returnType = returnType;
+            this.parameterTypes = parameterTypes;
+        }
+
+        public MethodScope methodScope;
+        public String methodName;
+        public Class<?> returnType;
+        public Class<?>[] parameterTypes;
+    }
+
+    private final List<RemoveMethodArgs> removeMethodArgsCalls = new ArrayList<RemoveMethodArgs>();
+
+    @Override
+    public void removeMethod(final MethodScope methodScope, final String methodName, final Class<?> returnType, final Class<?>[] parameterTypes) {
+        removeMethodArgsCalls.add(new RemoveMethodArgs(methodScope, methodName, returnType, parameterTypes));
+    }
+
+    public List<RemoveMethodArgs> getRemoveMethodArgsCalls() {
+        return removeMethodArgsCalls;
+    }
+
+    // ////////////////////////////////////////////////////////////
+    // removeMethod(Method): void
+    // ////////////////////////////////////////////////////////////
+
+    private final List<Method> removeMethodMethodCalls = new ArrayList<Method>();
+
+    @Override
+    public void removeMethod(final Method method) {
+        removeMethodMethodCalls.add(method);
+    }
+
+    public List<Method> getRemovedMethodMethodCalls() {
+        return removeMethodMethodCalls;
+    }
+
+    // ////////////////////////////////////////////////////////////
+    // removeMethods(...):List
+    // ////////////////////////////////////////////////////////////
+
+    private List<Method> removeMethodsReturn;
+
+    public void setRemoveMethodsReturn(final List<Method> removeMethodsReturn) {
+        this.removeMethodsReturn = removeMethodsReturn;
+    }
+
+    static class RemoveMethodsArgs {
+        public RemoveMethodsArgs(final MethodScope methodScope, final String prefix, final Class<?> returnType, final boolean canBeVoid, final int paramCount) {
+            this.methodScope = methodScope;
+            this.prefix = prefix;
+            this.returnType = returnType;
+            this.canBeVoid = canBeVoid;
+            this.paramCount = paramCount;
+        }
+
+        public MethodScope methodScope;
+        public String prefix;
+        public Class<?> returnType;
+        public boolean canBeVoid;
+        public int paramCount;
+    }
+
+    private final List<RemoveMethodsArgs> removeMethodsArgs = new ArrayList<RemoveMethodsArgs>();
+
+    @Override
+    public List<Method> removeMethods(final MethodScope methodScope, final String prefix, final Class<?> returnType, final boolean canBeVoid, final int paramCount) {
+        removeMethodsArgs.add(new RemoveMethodsArgs(methodScope, prefix, returnType, canBeVoid, paramCount));
+        return removeMethodsReturn;
+    }
+
+    // ////////////////////////////////////////////////////////////
+    // removeMethods(List):void
+    // ////////////////////////////////////////////////////////////
+
+    @Override
+    public void removeMethods(final List<Method> methods) {
+        for (final Method method : methods) {
+            removeMethod(method);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ProgrammableReflector.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ProgrammableReflector.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ProgrammableReflector.java
new file mode 100644
index 0000000..549b7f8
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/ProgrammableReflector.java
@@ -0,0 +1,144 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.isis.core.commons.components.ApplicationScopedComponent;
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContextAware;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistry;
+import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
+
+public class ProgrammableReflector implements SpecificationLoaderSpi, ApplicationScopedComponent, RuntimeContextAware {
+
+    @Override
+    public void init() {
+    }
+
+    public void installServiceSpecification(final Class<?> cls) {
+    }
+
+    private Collection<ObjectSpecification> allSpecificationsReturn;
+
+    public void setAllSpecificationsReturn(final Collection<ObjectSpecification> allSpecificationsReturn) {
+        this.allSpecificationsReturn = allSpecificationsReturn;
+    }
+
+    @Override
+    public Collection<ObjectSpecification> allSpecifications() {
+        return allSpecificationsReturn;
+    }
+
+    private CollectionTypeRegistry getCollectionTypeRegistryReturn;
+
+    public void setGetCollectionTypeRegistryReturn(final CollectionTypeRegistry getCollectionTypeRegistryReturn) {
+        this.getCollectionTypeRegistryReturn = getCollectionTypeRegistryReturn;
+    }
+
+    public CollectionTypeRegistry getCollectionTypeRegistry() {
+        return getCollectionTypeRegistryReturn;
+    }
+
+    @Override
+    public ObjectSpecification loadSpecification(final Class<?> type) {
+        return loadSpecification(type.getName());
+    }
+
+    private ObjectSpecification loadSpecificationStringReturn;
+
+    public void setLoadSpecificationStringReturn(final ObjectSpecification loadSpecificationStringReturn) {
+        this.loadSpecificationStringReturn = loadSpecificationStringReturn;
+    }
+
+    @Override
+    public ObjectSpecification loadSpecification(final String name) {
+        return loadSpecificationStringReturn;
+    }
+
+    @Override
+    public void shutdown() {
+    }
+
+    @Override
+    public boolean loaded(final Class<?> cls) {
+        throw new NotYetImplementedException();
+    }
+
+    @Override
+    public boolean loaded(final String fullyQualifiedClassName) {
+        throw new NotYetImplementedException();
+    }
+
+    @Override
+    public void injectInto(final Object candidate) {
+    }
+
+    @Override
+    public void setRuntimeContext(final RuntimeContext runtimeContext) {
+        // ignored
+    }
+
+    @Override
+    public void debugData(final DebugBuilder debug) {
+    }
+
+    @Override
+    public String debugTitle() {
+        return null;
+    }
+
+    @Override
+    public boolean loadSpecifications(final List<Class<?>> typesToLoad, final Class<?> typeToIgnore) {
+        return false;
+    }
+
+    @Override
+    public boolean loadSpecifications(final List<Class<?>> typesToLoad) {
+        return false;
+    }
+
+    @Override
+    public ObjectSpecification lookupBySpecId(ObjectSpecId objectSpecId) {
+        return null;
+    }
+
+    @Override
+    public void setServiceClasses(final List<Class<?>> serviceClasses) {
+        throw new NotYetImplementedException();
+    }
+
+    @Override
+    public void validateSpecifications(ValidationFailures validationFailures) {
+        throw new NotYetImplementedException();
+    }
+
+    @Override
+    public ObjectSpecification introspectIfRequired(ObjectSpecification spec) {
+        throw new NotYetImplementedException();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/Utils.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/Utils.java b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/Utils.java
new file mode 100644
index 0000000..6e5670f
--- /dev/null
+++ b/framework/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/Utils.java
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+
+class Utils {
+
+    protected static boolean contains(final Class<?>[] array, final Class<?> val) {
+        for (final Class<?> element : array) {
+            if (element == val) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    protected static boolean contains(final FeatureType[] array, final FeatureType val) {
+        for (final FeatureType element : array) {
+            if (element == val) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    protected static boolean contains(final List<FeatureType> list, final FeatureType val) {
+        return list.contains(val);
+    }
+
+    protected static Method findMethod(final Class<?> type, final String methodName, final Class<?>[] methodTypes) {
+        try {
+            return type.getMethod(methodName, methodTypes);
+        } catch (final SecurityException e) {
+            return null;
+        } catch (final NoSuchMethodException e) {
+            return null;
+        }
+    }
+
+    protected static Method findMethod(final Class<?> type, final String methodName) {
+        return findMethod(type, methodName, new Class[0]);
+    }
+
+}