Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5564#discussion_r170297941
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/descriptors/DescriptorTestBase.scala
 ---
    @@ -18,37 +18,85 @@
     
     package org.apache.flink.table.descriptors
     
    +import org.apache.flink.util.Preconditions
     import org.junit.Assert.assertEquals
    +import org.junit.Test
    +
    +import scala.collection.JavaConverters._
     
     abstract class DescriptorTestBase {
     
       /**
    -    * Returns a valid descriptor.
    +    * Returns a set of valid descriptors.
    +    * This method is implemented in both Scala and Java.
    +    */
    +  def descriptors(): java.util.List[Descriptor]
    +
    +  /**
    +    * Returns a set of properties for each valid descriptor.
    +    * This code is implemented in both Scala and Java.
         */
    -  def descriptor(): Descriptor
    +  def properties(): java.util.List[java.util.Map[String, String]]
     
       /**
    -    * Returns a validator that can validate this descriptor.
    +    * Returns a validator that can validate all valid descriptors.
         */
       def validator(): DescriptorValidator
     
    -  def verifyProperties(descriptor: Descriptor, expected: Seq[(String, 
String)]): Unit = {
    +  @Test
    +  def testValidation(): Unit = {
    +    val d = descriptors().asScala
    +    val p = properties().asScala
    +
    +    Preconditions.checkArgument(d.length == p.length)
    +
    +    d.zip(p).foreach { case (desc, props) =>
    +      verifyProperties(desc, props.asScala.toMap)
    +    }
    +  }
    +
    +  def verifyProperties(descriptor: Descriptor, expected: Map[String, 
String]): Unit = {
         val normProps = new DescriptorProperties
         descriptor.addProperties(normProps)
    -    assertEquals(expected.toMap, normProps.asMap)
    +    assertEquals(expected, normProps.asScalaMap)
       }
     
    -  def verifyInvalidProperty(property: String, invalidValue: String): Unit 
= {
    +  def verifyInvalidProperty(
    +      descriptor: Descriptor,
    +      property: String,
    +      invalidValue: String): Unit = {
         val properties = new DescriptorProperties
    -    descriptor().addProperties(properties)
    +    descriptor.addProperties(properties)
         properties.unsafePut(property, invalidValue)
         validator().validate(properties)
       }
     
    -  def verifyMissingProperty(removeProperty: String): Unit = {
    +  def verifyMissingProperty(descriptor: Descriptor, removeProperty: 
String): Unit = {
    --- End diff --
    
    rename to `removePropertyAndVerify()`


---

Reply via email to