reuvenlax commented on code in PR #32757:
URL: https://github.com/apache/beam/pull/32757#discussion_r1799844572


##########
sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/JavaBeanSchemaTest.java:
##########
@@ -625,4 +626,41 @@ public void testSetterConstructionWithRenamedFields() 
throws NoSuchSchemaExcepti
     assertEquals(
         registry.getFromRowFunction(BeanWithCaseFormat.class).apply(row), 
beanWithCaseFormat);
   }
+
+  @Test
+  public void testRegisterBeamWithTypeParameter() throws NoSuchSchemaException 
{
+    SchemaRegistry registry = SchemaRegistry.createDefault();
+    TypeDescriptor<TestJavaBeans.SimpleParameterizedBean<String, Long, 
Boolean, SimpleBean>>
+        typeDescriptor =
+            new TypeDescriptor<
+                TestJavaBeans.SimpleParameterizedBean<String, Long, Boolean, 
SimpleBean>>() {};
+    Schema schema = registry.getSchema(typeDescriptor);
+
+    final Schema expectedSchema =
+        Schema.builder()
+            .addBooleanField("value1")
+            .addStringField("value2")
+            .addInt64Field("value3")
+            .addRowField("value4", SIMPLE_BEAN_SCHEMA)
+            .build();
+    assertTrue(expectedSchema.equivalent(schema));
+  }
+
+  @Test
+  public void testRegisterBeanWithInheritedTypeParameter() throws 
NoSuchSchemaException {
+    SchemaRegistry registry = SchemaRegistry.createDefault();
+    TypeDescriptor<TestJavaBeans.SimpleParameterizedBeanSubclass<Short>> 
typeDescriptor =
+        new 
TypeDescriptor<TestJavaBeans.SimpleParameterizedBeanSubclass<Short>>() {};
+    Schema schema = registry.getSchema(typeDescriptor);
+
+    final Schema expectedSchema =
+        Schema.builder()
+            .addBooleanField("value1")
+            .addStringField("value2")
+            .addInt64Field("value3")
+            .addRowField("value4", SIMPLE_BEAN_SCHEMA)
+            .addInt16Field("value5")
+            .build();
+    assertTrue(expectedSchema.equivalent(schema));
+  }

Review Comment:
   Added



##########
sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/JavaBeanSchemaTest.java:
##########
@@ -625,4 +626,41 @@ public void testSetterConstructionWithRenamedFields() 
throws NoSuchSchemaExcepti
     assertEquals(
         registry.getFromRowFunction(BeanWithCaseFormat.class).apply(row), 
beanWithCaseFormat);
   }
+
+  @Test
+  public void testRegisterBeamWithTypeParameter() throws NoSuchSchemaException 
{

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to