Added test for "No Composites in @Uses" Signed-off-by: niclas <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/630b7856 Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/630b7856 Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/630b7856 Branch: refs/heads/develop Commit: 630b7856b5478223b82d701222cf2acf1d3cb85f Parents: 002794f Author: niclas <[email protected]> Authored: Wed Jun 7 09:21:26 2017 +0800 Committer: niclas <[email protected]> Committed: Wed Jun 7 09:21:26 2017 +0800 ---------------------------------------------------------------------- .../composite/AbstractModifierModel.java | 1 - .../runtime/composite/IsCompositeTest.java | 55 ++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/630b7856/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java index 4a00359..2b2f3d5 100644 --- a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java +++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java @@ -17,7 +17,6 @@ * * */ - package org.apache.polygene.runtime.composite; import java.lang.reflect.Array; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/630b7856/core/runtime/src/test/java/org/apache/polygene/runtime/composite/IsCompositeTest.java ---------------------------------------------------------------------- diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/IsCompositeTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/IsCompositeTest.java new file mode 100644 index 0000000..a7fe462 --- /dev/null +++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/IsCompositeTest.java @@ -0,0 +1,55 @@ +/* + * 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.polygene.runtime.composite; + +import org.apache.polygene.api.common.ConstructionException; +import org.apache.polygene.api.injection.scope.Uses; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.test.AbstractPolygeneTest; +import org.junit.Test; + +public class IsCompositeTest extends AbstractPolygeneTest +{ + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.transients( MyTransient.class ); + module.objects( MyObject.class ); + } + + @Test( expected = ConstructionException.class ) + public void givenCompositeToUsesWhenInstantiatingExpectException() + { + MyTransient myTransient = transientBuilderFactory.newTransient( MyTransient.class ); + objectFactory.newObject( MyObject.class, myTransient ); + } + + public interface MyTransient + {} + + public static class MyObject + { + @Uses + MyTransient my; + } +}
