You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2018/05/20 08:00:33 UTC
[isis] 01/03: ISIS-1948: setting the new 'plugin-driven'
Imposteriser as default
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 7daacd943fd3133befee1300e7c44816d7d48ce6
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun May 20 07:21:59 2018 +0200
ISIS-1948: setting the new 'plugin-driven' Imposteriser as default
Task-Url: https://issues.apache.org/jira/browse/ISIS-1948
---
.../scenarios/DomainServiceProviderMockery.java | 11 ++++----
.../jmocking/ImposteriserUsingCodegenPlugin.java | 2 +-
.../unittestsupport/jmocking/Imposterisers.java | 32 ++++++++++++++++++++++
3 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/DomainServiceProviderMockery.java b/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/DomainServiceProviderMockery.java
index e79a19e..6ec6588 100644
--- a/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/DomainServiceProviderMockery.java
+++ b/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/DomainServiceProviderMockery.java
@@ -19,17 +19,16 @@ package org.apache.isis.core.specsupport.scenarios;
import java.util.Map;
import java.util.Set;
-import com.google.common.collect.Maps;
-
+import org.apache.isis.applib.services.factory.FactoryService;
+import org.apache.isis.applib.services.repository.RepositoryService;
+import org.apache.isis.core.unittestsupport.jmocking.Imposterisers;
import org.hamcrest.Description;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.api.Action;
import org.jmock.api.Invocation;
-import org.apache.isis.applib.services.factory.FactoryService;
-import org.apache.isis.applib.services.repository.RepositoryService;
-import org.apache.isis.core.unittestsupport.jmocking.JavassistImposteriser;
+import com.google.common.collect.Maps;
/**
* @deprecated - with no replacement
@@ -51,7 +50,7 @@ class DomainServiceProviderMockery implements DomainServiceProvider {
private void init() {
context = new Mockery() {{
- setImposteriser(JavassistImposteriser.INSTANCE);
+ setImposteriser(Imposterisers.getDefault());
}};
mocks.clear();
}
diff --git a/core/unittestsupport/src/main/java/org/apache/isis/core/unittestsupport/jmocking/ImposteriserUsingCodegenPlugin.java b/core/unittestsupport/src/main/java/org/apache/isis/core/unittestsupport/jmocking/ImposteriserUsingCodegenPlugin.java
index 17b901f..48540d1 100644
--- a/core/unittestsupport/src/main/java/org/apache/isis/core/unittestsupport/jmocking/ImposteriserUsingCodegenPlugin.java
+++ b/core/unittestsupport/src/main/java/org/apache/isis/core/unittestsupport/jmocking/ImposteriserUsingCodegenPlugin.java
@@ -25,7 +25,7 @@ import org.jmock.api.Invocation;
import org.jmock.api.Invokable;
import org.jmock.lib.JavaReflectionImposteriser;
-public class ImposteriserUsingCodegenPlugin implements Imposteriser {
+class ImposteriserUsingCodegenPlugin implements Imposteriser {
public static final Imposteriser INSTANCE = new ImposteriserUsingCodegenPlugin();
diff --git a/core/unittestsupport/src/main/java/org/apache/isis/core/unittestsupport/jmocking/Imposterisers.java b/core/unittestsupport/src/main/java/org/apache/isis/core/unittestsupport/jmocking/Imposterisers.java
new file mode 100644
index 0000000..836218d
--- /dev/null
+++ b/core/unittestsupport/src/main/java/org/apache/isis/core/unittestsupport/jmocking/Imposterisers.java
@@ -0,0 +1,32 @@
+/**
+ * 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.unittestsupport.jmocking;
+
+import org.jmock.api.Imposteriser;
+
+public final class Imposterisers {
+
+ private Imposterisers() {}
+
+ /**
+ * @return framework's default Imposteriser instance
+ */
+ public static Imposteriser getDefault() {
+ return ImposteriserUsingCodegenPlugin.INSTANCE;
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
ahuber@apache.org.