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 2014/05/16 16:49:35 UTC

git commit: ISIS-783: very minor enhancement to IsisSystemForTest.Builder

Repository: isis
Updated Branches:
  refs/heads/master def282f29 -> 5c27c8bfb


ISIS-783: very minor enhancement to IsisSystemForTest.Builder


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5c27c8bf
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5c27c8bf
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5c27c8bf

Branch: refs/heads/master
Commit: 5c27c8bfb5ff11c7184056062a57ba2fef26eec7
Parents: def282f
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri May 16 15:49:22 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri May 16 15:49:22 2014 +0100

----------------------------------------------------------------------
 .../integtestsupport/IsisSystemForTest.java     | 24 ++++++++++++--------
 .../scenarios/ScenarioExecution.java            |  2 +-
 2 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/5c27c8bf/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
index 5c4fc79..4a8a2dd 100644
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
@@ -176,8 +176,8 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
         private MetaModelValidator metaModelValidator;
         private ProgrammingModel programmingModel;
 
-        private Object[] services;
-        private InstallableFixture[] fixtures;
+        private final List<Object> services = Lists.newArrayList();
+        private final List<InstallableFixture> fixtures = Lists.newArrayList();
         
         private final List <Listener> listeners = Lists.newArrayList();
 
@@ -199,12 +199,12 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
         }
 
         public Builder withServices(Object... services) {
-            this.services = services;
+            this.services.addAll(Arrays.asList(services));
             return this;
         }
 
         public Builder withFixtures(InstallableFixture... fixtures) {
-            this.fixtures = fixtures;
+            this.fixtures.addAll(Arrays.asList(fixtures));
             return this;
         }
         
@@ -214,18 +214,22 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
         }
 
         public IsisSystemForTest build() {
-            final List<Object> servicesIfAny = asList(services);
-            final List<InstallableFixture> fixturesIfAny = asList(fixtures);
-            IsisSystemForTest isisSystem = new IsisSystemForTest(configuration, programmingModel, metaModelValidator, persistenceMechanismInstaller, authenticationRequest, servicesIfAny, fixturesIfAny, listeners);
+            final IsisSystemForTest isisSystem =
+                    new IsisSystemForTest(
+                            configuration,
+                            programmingModel,
+                            metaModelValidator,
+                            persistenceMechanismInstaller,
+                            authenticationRequest,
+                            services,
+                            fixtures,
+                            listeners);
             if(level != null) {
                 isisSystem.setLevel(level);
             }
             return isisSystem;
         }
 
-        private static <T> List<T> asList(T[] objects) {
-            return objects != null? Arrays.asList(objects): Collections.<T>emptyList();
-        }
 
         public Builder with(Listener listener) {
             if(listener != null) {

http://git-wip-us.apache.org/repos/asf/isis/blob/5c27c8bf/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/ScenarioExecution.java
----------------------------------------------------------------------
diff --git a/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/ScenarioExecution.java b/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/ScenarioExecution.java
index 33f7575..7a6179c 100644
--- a/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/ScenarioExecution.java
+++ b/core/specsupport/src/main/java/org/apache/isis/core/specsupport/scenarios/ScenarioExecution.java
@@ -67,7 +67,7 @@ public abstract class ScenarioExecution {
     public static ScenarioExecution current() {
         final ScenarioExecution execution = current.get();
         if(execution == null) {
-            throw new IllegalStateException("Scenario has not yet been instantiated by Cukes");
+            throw new IllegalStateException("Scenario has not yet been instantiated");
         } 
         return execution;
     }