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 allSlingClienthttp requests with a customString.
May be used on a per class or per test basis.
(In case the user-agent of theHttpClientis 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.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description)protected voidfinished()protected voidstarting()
-
-
-
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
-
-