TestCordapp
Keywords: net.corda.testing.node.TestCordapp class
Date: 2023-09-18

net.corda.testing.node

## Class TestCordapp

- net.corda.testing.node.TestCordapp

-     @DoNotImplement
      public class TestCordapp

  Encapsulates a CorDapp that exists on the current classpath, which can be pulled in for testing. Use `TestCordapp.findCordapp` to locate an existing CorDapp.

  This is a replacement API to DriverParameters.extraCordappPackagesToScan and MockNetwork.cordappPackages as they create custom jars which do not preserve any CorDapp metadata.

  See Also:
    `TestCordapp.findCordapp`

- - ### Field Detail

    - #### Companion

          public static net.corda.testing.node.TestCordapp.Companion Companion

  - ### Constructor Detail

    - #### TestCordapp

          public TestCordapp()

      Encapsulates a CorDapp that exists on the current classpath, which can be pulled in for testing. Use `TestCordapp.findCordapp` to locate an existing CorDapp.

      This is a replacement API to DriverParameters.extraCordappPackagesToScan and MockNetwork.cordappPackages as they create custom jars which do not preserve any CorDapp metadata.

      See Also:
        `TestCordapp.findCordapp`

  - ### Method Detail

    - #### getConfig

          @NotNull
          public java.util.Map<java.lang.String,java.lang.Object> getConfig()

      Returns the config for on this CorDapp, defaults to empty if not specified.

    - #### withConfig

          @NotNull
          public TestCordapp withConfig(@NotNull
                                                 java.util.Map<java.lang.String,? extends java.lang.Object> config)

      Returns a copy of this `class TestCordapp` but with the specified CorDapp config.

      See Also:
        `class TestCordapp`

    - #### findCordapp

          @JvmStatic
           @NotNull
          public static TestCordapp findCordapp(@NotNull
                                                                     java.lang.String scanPackage)

      Scans the current classpath to find the CorDapp that contains the given package. All the CorDapp's metdata present in its MANIFEST are inherited. If more than one location containing the package is found then an exception is thrown. An exception is also thrown if no CorDapp is found.

      Parameters:
        `scanPackage` - The package name used to find the CorDapp. This does not need to be the root package of the CorDapp.