243N/A/*
2362N/A * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
243N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
243N/A *
243N/A * This code is free software; you can redistribute it and/or modify it
243N/A * under the terms of the GNU General Public License version 2 only, as
243N/A * published by the Free Software Foundation.
243N/A *
243N/A * This code is distributed in the hope that it will be useful, but WITHOUT
243N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
243N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
243N/A * version 2 for more details (a copy is included in the LICENSE file that
243N/A * accompanied this code).
243N/A *
243N/A * You should have received a copy of the GNU General Public License version
243N/A * 2 along with this work; if not, write to the Free Software Foundation,
243N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
243N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
243N/A */
243N/A
243N/A/*
243N/A * @test %I% %G%
243N/A * @bug 4935607
243N/A * @summary Tests transient properties
243N/A * @author Sergey Malenkov
243N/A */
243N/A
243N/Aimport java.beans.Transient;
243N/A
243N/Apublic class Test4935607 extends AbstractTest<Test4935607.TransientBean> {
243N/A public static void main(String[] args) {
243N/A new Test4935607().test(true);
243N/A }
243N/A
243N/A @Override
243N/A protected TransientBean getObject() {
243N/A TransientBean bean = new TransientBean();
243N/A bean.setName("some string"); // NON-NLS: some string
243N/A return bean;
243N/A }
243N/A
243N/A @Override
243N/A protected TransientBean getAnotherObject() {
243N/A TransientBean bean = new TransientBean();
243N/A bean.setName("another string"); // NON-NLS: another string
243N/A bean.setComment("some comment"); // NON-NLS: some comment
243N/A return bean;
243N/A }
243N/A
243N/A @Override
243N/A protected void validate(TransientBean before, TransientBean after) {
243N/A if (!before.getName().equals(after.getName()))
243N/A throw new Error("the name property incorrectly encoded");
243N/A
243N/A if (null != after.getComment())
243N/A throw new Error("the comment property should be encoded");
243N/A }
243N/A
243N/A public static class TransientBean {
243N/A private String name;
243N/A private String comment;
243N/A
243N/A public String getName() {
243N/A return this.name;
243N/A }
243N/A
243N/A public void setName(String name) {
243N/A this.name = name;
243N/A }
243N/A
243N/A @Transient
243N/A public String getComment() {
243N/A return this.comment;
243N/A }
243N/A
243N/A public void setComment(String comment) {
243N/A this.comment = comment;
243N/A }
243N/A }
243N/A}