类 TestPropertySourceAttributes

java.lang.Object
cn.taketoday.test.context.support.TestPropertySourceAttributes

class TestPropertySourceAttributes extends Object
TestPropertySourceAttributes encapsulates attributes declared via @TestPropertySource annotations.

In addition to encapsulating declared attributes, TestPropertySourceAttributes also enforces configuration rules.

从以下版本开始:
4.0
作者:
Sam Brannen, Phillip Webb, Harry Yang
另请参阅:
  • 字段详细资料

    • SLASH

      private static final String SLASH
      另请参阅:
    • logger

      private static final cn.taketoday.logging.Logger logger
    • declaringClass

      private final Class<?> declaringClass
    • rootAnnotation

      private final cn.taketoday.core.annotation.MergedAnnotation<?> rootAnnotation
    • descriptors

      private final ArrayList<cn.taketoday.core.io.PropertySourceDescriptor> descriptors
    • inheritLocations

      private final boolean inheritLocations
    • properties

      private final ArrayList<String> properties
    • inheritProperties

      private final boolean inheritProperties
  • 构造器详细资料

    • TestPropertySourceAttributes

      TestPropertySourceAttributes(cn.taketoday.core.annotation.MergedAnnotation<TestPropertySource> mergedAnnotation)
  • 方法详细资料

    • mergeWith

      void mergeWith(TestPropertySourceAttributes attributes)
      Merge this TestPropertySourceAttributes instance with the supplied TestPropertySourceAttributes, asserting that the two sets of test property source attributes have identical values for the TestPropertySource.inheritLocations() and TestPropertySource.inheritProperties() flags and that the two underlying annotations were declared on the same class.
    • assertSameBooleanAttribute

      private void assertSameBooleanAttribute(boolean expected, boolean actual, String attributeName, TestPropertySourceAttributes that)
    • addPropertiesAndLocationsFrom

      private void addPropertiesAndLocationsFrom(cn.taketoday.core.annotation.MergedAnnotation<TestPropertySource> mergedAnnotation, Class<?> declaringClass)
    • mergePropertiesAndLocationsFrom

      private void mergePropertiesAndLocationsFrom(TestPropertySourceAttributes attributes)
    • addPropertiesAndLocations

      private void addPropertiesAndLocations(List<cn.taketoday.core.io.PropertySourceDescriptor> descriptors, String[] properties, Class<?> declaringClass, @Nullable String encoding, boolean prepend)
    • addAll

      private void addAll(boolean prepend, List<cn.taketoday.core.io.PropertySourceDescriptor> list, List<cn.taketoday.core.io.PropertySourceDescriptor> elements)
      Add all the supplied elements to the provided list, honoring the prepend flag.

      If the prepend flag is false, the elements will be appended to the list.

      参数:
      prepend - whether the elements should be prepended to the list
      list - the list to which to add the elements
      elements - the elements to add to the list
    • addAll

      private void addAll(boolean prepend, List<String> list, String... elements)
      Add all the supplied elements to the provided list, honoring the prepend flag.

      If the prepend flag is false, the elements will be appended to the list.

      参数:
      prepend - whether the elements should be prepended to the list
      list - the list to which to add the elements
      elements - the elements to add to the list
    • detectDefaultPropertiesFile

      private String detectDefaultPropertiesFile(Class<?> testClass)
    • getDeclaringClass

      Class<?> getDeclaringClass()
      Get the class that declared @TestPropertySource.
      返回:
      the declaring class; never null
    • getPropertySourceDescriptors

      List<cn.taketoday.core.io.PropertySourceDescriptor> getPropertySourceDescriptors()
      Get the descriptors for resource locations that were declared via @TestPropertySource.

      Note: The returned value may represent a detected default or merged locations that do not match the original value declared via a single @TestPropertySource annotation.

      返回:
      the resource location descriptors; potentially empty
      另请参阅:
    • isInheritLocations

      boolean isInheritLocations()
      Get the inheritLocations flag that was declared via @TestPropertySource.
      返回:
      the inheritLocations flag
      另请参阅:
    • getProperties

      String[] getProperties()
      Get the inlined properties that were declared via @TestPropertySource.

      Note: The returned value may represent merged properties that do not match the original value declared via a single @TestPropertySource annotation.

      返回:
      the inlined properties; potentially empty
      另请参阅:
    • isInheritProperties

      boolean isInheritProperties()
      Get the inheritProperties flag that was declared via @TestPropertySource.
      返回:
      the inheritProperties flag
      另请参阅:
    • isEmpty

      boolean isEmpty()
    • equals

      public boolean equals(@Nullable Object other)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • toString

      public String toString()
      Provide a String representation of the @TestPropertySource attributes and declaring class.
      覆盖:
      toString 在类中 Object
    • declaringClass

      private static Class<?> declaringClass(cn.taketoday.core.annotation.MergedAnnotation<?> mergedAnnotation)
    • hasNoLocations

      private static boolean hasNoLocations(List<cn.taketoday.core.io.PropertySourceDescriptor> descriptors)
      Determine if the supplied list contains no descriptor with locations.