Return-Path: X-Original-To: apmail-cayenne-commits-archive@www.apache.org Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 83B6D18912 for ; Fri, 26 Feb 2016 16:03:39 +0000 (UTC) Received: (qmail 12190 invoked by uid 500); 26 Feb 2016 16:03:39 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 12162 invoked by uid 500); 26 Feb 2016 16:03:39 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 12152 invoked by uid 99); 26 Feb 2016 16:03:39 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Feb 2016 16:03:39 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3F8C0E8EF2; Fri, 26 Feb 2016 16:03:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dkazimirchyk@apache.org To: commits@cayenne.apache.org Date: Fri, 26 Feb 2016 16:03:39 -0000 Message-Id: <0dfdd6a1e29f46edbd0d44a7d0ad0fd3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] cayenne git commit: Add failing unit test for BeanAccessors for classes with complex inheritance Repository: cayenne Updated Branches: refs/heads/master fdfeb3ac4 -> f0782d260 Add failing unit test for BeanAccessors for classes with complex inheritance Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/bb0c8c77 Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/bb0c8c77 Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/bb0c8c77 Branch: refs/heads/master Commit: bb0c8c777404bd177c9601a5fae2341ff4ffbde6 Parents: 2f10481 Author: David Feshbach Authored: Thu Feb 25 16:26:24 2016 -0600 Committer: David Feshbach Committed: Thu Feb 25 16:38:50 2016 -0600 ---------------------------------------------------------------------- .../cayenne/reflect/BeanAccessorTest.java | 16 +++++++++++++ .../apache/cayenne/reflect/TstHasRelated.java | 24 ++++++++++++++++++++ .../cayenne/reflect/TstJavaBeanChild.java | 24 ++++++++++++++++++++ 3 files changed, 64 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cayenne/blob/bb0c8c77/cayenne-server/src/test/java/org/apache/cayenne/reflect/BeanAccessorTest.java ---------------------------------------------------------------------- diff --git a/cayenne-server/src/test/java/org/apache/cayenne/reflect/BeanAccessorTest.java b/cayenne-server/src/test/java/org/apache/cayenne/reflect/BeanAccessorTest.java index 9f62fb5..9129aaf 100644 --- a/cayenne-server/src/test/java/org/apache/cayenne/reflect/BeanAccessorTest.java +++ b/cayenne-server/src/test/java/org/apache/cayenne/reflect/BeanAccessorTest.java @@ -81,4 +81,20 @@ public class BeanAccessorTest { assertEquals("Incorrectly set null default", 0, o1.getIntField()); } + @Test + public void testInheritedCovariantProperty() { + + BeanAccessor accessor = new BeanAccessor( + TstJavaBeanChild.class, + "related", + null); + + TstJavaBeanChild o1 = new TstJavaBeanChild(); + + assertNull(o1.getRelated()); + accessor.setValue(o1, o1); + assertSame(o1, o1.getRelated()); + assertSame(o1, accessor.getValue(o1)); + } + } http://git-wip-us.apache.org/repos/asf/cayenne/blob/bb0c8c77/cayenne-server/src/test/java/org/apache/cayenne/reflect/TstHasRelated.java ---------------------------------------------------------------------- diff --git a/cayenne-server/src/test/java/org/apache/cayenne/reflect/TstHasRelated.java b/cayenne-server/src/test/java/org/apache/cayenne/reflect/TstHasRelated.java new file mode 100644 index 0000000..8ce9302 --- /dev/null +++ b/cayenne-server/src/test/java/org/apache/cayenne/reflect/TstHasRelated.java @@ -0,0 +1,24 @@ +/***************************************************************** + * 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.cayenne.reflect; + +public interface TstHasRelated { + Object getRelated(); +} http://git-wip-us.apache.org/repos/asf/cayenne/blob/bb0c8c77/cayenne-server/src/test/java/org/apache/cayenne/reflect/TstJavaBeanChild.java ---------------------------------------------------------------------- diff --git a/cayenne-server/src/test/java/org/apache/cayenne/reflect/TstJavaBeanChild.java b/cayenne-server/src/test/java/org/apache/cayenne/reflect/TstJavaBeanChild.java new file mode 100644 index 0000000..4a0060e --- /dev/null +++ b/cayenne-server/src/test/java/org/apache/cayenne/reflect/TstJavaBeanChild.java @@ -0,0 +1,24 @@ +/***************************************************************** + * 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.cayenne.reflect; + +public class TstJavaBeanChild extends TstJavaBean implements TstHasRelated { + +}