MockStringResourceLoader (Grails 6.0.0)

Package: org.grails.core.io

## [Java] Class MockStringResourceLoader

- org.grails.core.io.MockStringResourceLoader

-     public class MockStringResourceLoader
      extends MockResourceLoader

  Loads Resources from Strings that are registered as Mock resources.

  Authors:
    Graeme Rocher
  Since:
    0.4

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `private java.util.Map<java.lang.String, org.springframework.core.io.Resource>` | `mockResources` |

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public org.springframework.core.io.Resource` | `getResource(java.lang.String location)`
    `` | `public void` | `registerMockResource(java.lang.String location, org.springframework.core.io.Resource res)` Registers a mock resource with the first argument as the location and the second as the contents of the resource.
    `` | `public void` | `registerMockResource(java.lang.String location, java.lang.String contents)` Registers a mock resource with the first argument as the location and the second as the contents of the resource.
    `` | `public void` | `registerMockResource(java.lang.String location, byte[] contents)` Registers a mock resource with the first argument as the location and the second as the contents of the resource.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class MockResourceLoader` | `getResource, isNotPrefixed`

- - ### Field Detail

    - #### private java.util.Map<java.lang.String, org.springframework.core.io.Resource> mockResources

  - ### Method Detail

    - #### @java.lang.Override public org.springframework.core.io.Resource getResource(java.lang.String location)

    - #### public void registerMockResource(java.lang.String location, org.springframework.core.io.Resource res)

      Registers a mock resource with the first argument as the location and the second as the contents of the resource.

      Parameters:
        `location` - The location
        `res` - The resource itself

    - #### public void registerMockResource(java.lang.String location, java.lang.String contents)

      Registers a mock resource with the first argument as the location and the second as the contents of the resource.

      Parameters:
        `location` - The location
        `contents` - The contents of the resource

    - #### public void registerMockResource(java.lang.String location, byte[] contents)

      Registers a mock resource with the first argument as the location and the second as the contents of the resource.

      Parameters:
        `location` - The location
        `contents` - The contents of the resource