Questions tagged [mockrestserviceserver]

22 questions
0
votes
1 answer

How to clear/ignore ehcache's data and test via MockRestServiceServer?

We are running our component test-cases in which we load some data using cache.. Now the problem is when we try other test-cases, we want to reset the cache because it then doesn't test with the other data. How can we achieve this. We are using…
thisisdude
  • 543
  • 1
  • 7
  • 31
0
votes
0 answers

Is it possible to make some of my @SpringBootTest app requests to bypass (spy instead of stub) the autoconfigured MockRestServiceServer?

For a particular scenario where my needs are expected: A java command line app that enables a RestController which forwards the request to a remote domain. Depending on arguments it initializes the server with some local request. So, how can I…
0
votes
1 answer

Using MockRestServiceServer only in subset of tests

I want to test outgoing HTTP calls from my service using MockRestServiceServer. I got it working using following code: @SpringBootTest class CommentFetcherTest { @Autowired RestTemplate restTemplate; @Autowired CommentFetcher…
xwhyz
  • 1,444
  • 4
  • 21
  • 45
0
votes
1 answer

Multiple Tests with MockRestServiceServer

My Tests run through when executing them separatly. When I execute the Test Class, then one of them fails: java.lang.AssertionError: Further request(s) expected leaving 1 unsatisfied expectation(s). 0 request(s)…
Michael Hegner
  • 5,555
  • 9
  • 38
  • 64
0
votes
1 answer

Multiple testfiles and MockRestServiceServer, expecting calls from other testfile

I've build a service with two endpoints, and I want to cover both endpoints with integration tests. To prevent these integrationtests from reaching other services, I'm using the MockRestServiceServer class to mock calls and responses to other HTTP…
Joetjah
  • 6,292
  • 8
  • 55
  • 90
0
votes
1 answer

Is it possible to use MockMvc and mock only the RestTemplate used by my service?

I'm trying to build one integration test using MockMvc and I want to mock only the RestTemplate used by MyService.java. If I uncomment the code on MyIT.java, this test will fail because the RestTemplate used by MockMvc will be mocked as…
0
votes
1 answer

TDD test spring service with remote call

I would test a service method which has a remote call to another server. This remote call is made by restTemplate. This is part of my code ..... @Mock private RestTemplate restTemplate; private MockRestServiceServer server; …
Claudio Pomo
  • 2,392
  • 7
  • 42
  • 71
1
2