You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2019/11/20 01:50:38 UTC

[juneau] branch master updated: Add @BeanIgnore test.

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new dc35913  Add @BeanIgnore test.
dc35913 is described below

commit dc359131a336ec9fe3b461c8a8b4b0deac894c37
Author: JamesBognar <ja...@apache.org>
AuthorDate: Tue Nov 19 20:50:09 2019 -0500

    Add @BeanIgnore test.
---
 .../apache/juneau/annotation/BeanIgnoreTest.java   | 29 +++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanIgnoreTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanIgnoreTest.java
index 7b2385b..97ae0f1 100644
--- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanIgnoreTest.java
+++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanIgnoreTest.java
@@ -12,9 +12,8 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.annotation;
 
-import static org.junit.Assert.*;
+import static org.apache.juneau.testutils.TestUtils.*;
 
-import org.apache.juneau.json.*;
 import org.junit.*;
 
 public class BeanIgnoreTest {
@@ -36,7 +35,31 @@ public class BeanIgnoreTest {
 
 	@Test
 	public void test() throws Exception {
-		assertEquals("{c:'c',a:'a'}", SimpleJsonSerializer.DEFAULT.toString(new A()));
+		assertObjectEquals("{c:'c',a:'a'}", new A());
+	}
+
+	@Test
+	public void testBeanIgnoreOnBean() throws Exception {
+		assertObjectEquals("{f2:2,f3:'xxx',f4:'xxx'}", new B());
+	}
+
+	@BeanIgnore
+	public static class B1 {
+		public int f = 1;
+
+		@Override
+		public String toString() {
+			return "xxx";
+		}
+	}
+
+	public static class B {
+		public int f2 = 2;
+		public B1 f3 = new B1();
+
+		public B1 getF4() {
+			return new B1();
+		}
 	}
 }