how can I control the browser agent in my wicket unit test

Oscar Scholten

I have some server side Wicket code using Apache Wicket that needs to follow a different flow for IE8, it looks roughly like this:

ClientProperties clientProperties = WebSession.get().getClientInfo().getProperties();
if (clientProperties.isBrowserInternetExplorer() && clientProperties.getBrowserVersionMajor() == 8) {
    // do this
} else {
    // do that
}

I want to test this code in combination with some other Wicket components, and test the combined output. I'm using the WicketTester helper class, and when I debug my code, it seems that the Wicket test framework gets reported as Firefox 9.

Now, the question is: can I easily control which browser agent is used in my test? As you can imagine, I'd rather not start mocking these classes.

martin-g

You can do:

tester.getRequest().setHeader("User-Agent", "...");
tester.startPage(...);
...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I tell that my program is under unit test environment

From Dev

how can I write unit test to my meteor methods?

From Dev

How can I unit test for a stack overflow in my factorial function?

From Dev

How can I unit test my project, when most of it access a database with a poor schema that I cannot change?

From Dev

How can I unit test Alex code?

From Dev

How can I unit test Alex code?

From Dev

How can I unit test that my Android Service launched a particular Activity?

From Dev

How can I reference unit test classes of a maven dependency in my java project?

From Dev

How do I unit test and integration test my SSIS packages?

From Dev

How can I specify a different URL and/or Browser to run my C# WebDriver test against at runtime?

From Dev

How can I enable WebGL in my browser?

From Dev

How can I get GPG Agent to cache my password?

From Dev

How can I get GPG Agent to cache my password?

From Dev

How do i Unit Test my RelayCommand using Moq?

From Dev

How can I encapsulate modules I want to unit test in Meteor?

From Dev

How can i disable a html control in the web-browser

From Dev

How to structure my unit test?

From Dev

How do i deploy my wicket project?

From Dev

Jasmine Unit Testing: How can I spy on Function.prototype.call() in a function parameter that is passed to my method under test?

From Dev

How can I test my LWRP with ChefSpec?

From Dev

How can I test my classifier for overfitting?

From Dev

Unit test with redux-mock-store - How can I make this unit test pass?

From Dev

How can I unit test a method that uses a Scanner and an InputStream?

From Java

How can I unit test non-exported functions?

From Dev

How can I add a unit test for a new class stub?

From Dev

How can I unit test Eclipse Command Handlers?

From Dev

How can I unit test a promise chain with Karma?

From Dev

How can I unit test a complex promise chain?

From Dev

How can I use FakeItEasy with HttpClient, in a unit test?

Related Related

  1. 1

    How can I tell that my program is under unit test environment

  2. 2

    how can I write unit test to my meteor methods?

  3. 3

    How can I unit test for a stack overflow in my factorial function?

  4. 4

    How can I unit test my project, when most of it access a database with a poor schema that I cannot change?

  5. 5

    How can I unit test Alex code?

  6. 6

    How can I unit test Alex code?

  7. 7

    How can I unit test that my Android Service launched a particular Activity?

  8. 8

    How can I reference unit test classes of a maven dependency in my java project?

  9. 9

    How do I unit test and integration test my SSIS packages?

  10. 10

    How can I specify a different URL and/or Browser to run my C# WebDriver test against at runtime?

  11. 11

    How can I enable WebGL in my browser?

  12. 12

    How can I get GPG Agent to cache my password?

  13. 13

    How can I get GPG Agent to cache my password?

  14. 14

    How do i Unit Test my RelayCommand using Moq?

  15. 15

    How can I encapsulate modules I want to unit test in Meteor?

  16. 16

    How can i disable a html control in the web-browser

  17. 17

    How to structure my unit test?

  18. 18

    How do i deploy my wicket project?

  19. 19

    Jasmine Unit Testing: How can I spy on Function.prototype.call() in a function parameter that is passed to my method under test?

  20. 20

    How can I test my LWRP with ChefSpec?

  21. 21

    How can I test my classifier for overfitting?

  22. 22

    Unit test with redux-mock-store - How can I make this unit test pass?

  23. 23

    How can I unit test a method that uses a Scanner and an InputStream?

  24. 24

    How can I unit test non-exported functions?

  25. 25

    How can I add a unit test for a new class stub?

  26. 26

    How can I unit test Eclipse Command Handlers?

  27. 27

    How can I unit test a promise chain with Karma?

  28. 28

    How can I unit test a complex promise chain?

  29. 29

    How can I use FakeItEasy with HttpClient, in a unit test?

HotTag

Archive