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 allSlingClient
http requests with a customString
.
May be used on a per class or per test basis.
(In case the user-agent of theHttpClient
is tampered with manually changes will not be applied.)
-
-
Constructor Summary
Constructors Constructor Description CustomUserAgentRule(String userAgent)
Overwrite the user-agent with a customString
.CustomUserAgentRule(String userAgent, boolean append)
Modify or overwrite the user-agent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.junit.runners.model.Statement
apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
protected void
finished()
protected void
starting()
-
-
-
Constructor Detail
-
CustomUserAgentRule
public CustomUserAgentRule(String userAgent)
Overwrite the user-agent with a customString
.- Parameters:
userAgent
- the new user-agent
-
CustomUserAgentRule
public CustomUserAgentRule(String userAgent, boolean append)
Modify or overwrite the user-agent.- Parameters:
userAgent
- the desired user-agentappend
- whether it should just be appended to the current one
-
-