Package org.apache.sling.testing.junit.rules

## Class CustomUserAgentRule

- java.lang.Object
- - org.apache.sling.testing.junit.rules.CustomUserAgentRule

All Implemented Interfaces:
  `org.junit.rules.TestRule`

    public class CustomUserAgentRule
    extends Object
    implements org.junit.rules.TestRule

Junit rule to overwrite or append the user-agent of all `SlingClient` http requests with a custom `String`.
May be used on a per class or per test basis.
(In case the user-agent of the `HttpClient` is tampered with manually changes will not be applied.)

### Constructor Summary

Constructors
`CustomUserAgentRule​(String userAgent)` Overwrite the user-agent with a custom `String`.
`CustomUserAgentRule​(String userAgent, boolean append)` Modify or overwrite the user-agent.

### Method Summary

All Methods Instance Methods Concrete Methods
`org.junit.runners.model.Statement` `apply​(org.junit.runners.model.Statement base, org.junit.runner.Description description)`
`protected void` `finished()`
`protected void` `starting()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### CustomUserAgentRule

    public CustomUserAgentRule​(String userAgent)

Overwrite the user-agent with a custom `String`.

Parameters:
  `userAgent` - the new user-agent

#### CustomUserAgentRule

    public CustomUserAgentRule​(String userAgent,
                               boolean append)

Modify or overwrite the user-agent.

Parameters:
  `userAgent` - the desired user-agent
  `append` - whether it should just be appended to the current one

### Method Detail

#### apply

    public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base,
                                                   org.junit.runner.Description description)

Specified by:
  `apply` in interface `org.junit.rules.TestRule`

#### starting

    protected void starting()

#### finished

    protected void finished()