Author name: admin

What is Apache Maven?

What is Apache Maven? A) A build automation and project management tool B) A web server C) A version control system D) A database management system Answer: A) A build automation and project management tool Explanation: Apache Maven is a popular build automation and project management tool primarily used for Java projects. It provides a

What is Apache Maven? Read More »

Which method is used to create a partial mock in EasyMock?

Which method is used to create a partial mock in EasyMock? A) createMockBuilder() B) partialMock() C) createPartialMock() D) mockPartial() Answer: A) createMockBuilder() Explanation: The createMockBuilder() method in EasyMock is used to create a partial mock. A partial mock allows you to mock only specific methods of a class while allowing other methods to behave as

Which method is used to create a partial mock in EasyMock? Read More »

How do you mock a method to return different values on consecutive calls in EasyMock?

How do you mock a method to return different values on consecutive calls in EasyMock? A) andReturn().andReturn() B) expectReturn() C) thenReturn().thenReturn() D) withValues() Answer: A) andReturn().andReturn() Explanation: In EasyMock, you can mock a method to return different values on consecutive calls using multiple andReturn() methods chained together. This allows you to specify a sequence of

How do you mock a method to return different values on consecutive calls in EasyMock? Read More »

How do you throw an exception from a mock method in EasyMock?

How do you throw an exception from a mock method in EasyMock? A) andThrow() B) expectThrow() C) throwException() D) withException() Answer: A) andThrow() Explanation: The andThrow() method in EasyMock is used to specify that a mock method should throw an exception when called. This is useful for testing how the system under test handles exceptions

How do you throw an exception from a mock method in EasyMock? Read More »

Which EasyMock method is used to create a strict mock object?

Which EasyMock method is used to create a strict mock object? A) createStrictMock() B) createMock() C) mockStrictly() D) strictMock() Answer: A) createStrictMock() Explanation: The createStrictMock() method in EasyMock is used to create a strict mock object. A strict mock ensures that the methods are called in the exact order in which they were expected. If

Which EasyMock method is used to create a strict mock object? Read More »

Which method is used to verify that all expected interactions with a mock object occurred?

Which method is used to verify that all expected interactions with a mock object occurred? A) verify() B) check() C) confirm() D) validate() Answer: A) verify() Explanation: The verify() method in EasyMock is used to verify that all expected interactions with a mock object occurred. This method checks whether all methods that were expected to

Which method is used to verify that all expected interactions with a mock object occurred? Read More »

How do you set up an expectation in EasyMock?

How do you set up an expectation in EasyMock? A) expect() B) setExpectation() C) expectCall() D) withExpectation() Answer: A) expect() Explanation: The expect() method in EasyMock is used to set up an expectation on a mock object. This method specifies how the mock object should behave when a certain method is called. For example: EasyMock.expect(mockService.someMethod()).andReturn(someValue);

How do you set up an expectation in EasyMock? Read More »

Which method is used to validate the content of a JSON response in RestAssured?

Which method is used to validate the content of a JSON response in RestAssured? A) body() B) content() C) jsonPath() D) assertThat() Answer: A) body() Explanation: The body() method in RestAssured is used to validate the content of a JSON response. It allows you to assert that specific fields in the JSON response contain the

Which method is used to validate the content of a JSON response in RestAssured? Read More »

How do you set a base URI for all requests in RestAssured?

How do you set a base URI for all requests in RestAssured? A) RestAssured.baseURI B) setBaseURI() C) configureBaseURI() D) withBaseURI() Answer: A) RestAssured.baseURI Explanation: The RestAssured.baseURI field is used to set a base URI for all requests in RestAssured. This allows you to avoid repeating the base URI in every request. For example: import static

How do you set a base URI for all requests in RestAssured? Read More »

Which method is used to extract data from the response body in RestAssured?

Which method is used to extract data from the response body in RestAssured? A) extract() B) getBody() C) read() D) bodyContent() Answer: A) extract() Explanation: The extract() method in RestAssured is used to extract data from the response body. It allows you to retrieve specific values or the entire response body for further validation or

Which method is used to extract data from the response body in RestAssured? Read More »

How do you send form data in a POST request using RestAssured?

How do you send form data in a POST request using RestAssured? A) formParam() B) param() C) formData() D) withForm() Answer: A) formParam() Explanation: The formParam() method in RestAssured is used to send form data in an HTTP POST request. This method is useful for submitting data in form-encoded format. For example: import static io.restassured.RestAssured.*;

How do you send form data in a POST request using RestAssured? Read More »

Which method is used to send a DELETE request in RestAssured?

Which method is used to send a DELETE request in RestAssured? A) delete() B) get() C) post() D) put() Answer: A) delete() Explanation: The delete() method in RestAssured is used to send an HTTP DELETE request. This method is used when you want to delete a specified resource. For example: import static io.restassured.RestAssured.*; given(). when().

Which method is used to send a DELETE request in RestAssured? Read More »

How do you add a header to a RestAssured request?

How do you add a header to a RestAssured request? A) header() B) addHeader() C) withHeader() D) setHeader() Answer: A) header() Explanation: The header() method in RestAssured is used to add a header to an HTTP request. Headers provide additional context and metadata for the request. For example: import static io.restassured.RestAssured.*; given(). header("Authorization", "Bearer token").

How do you add a header to a RestAssured request? Read More »

Which method is used to validate the status code of a response in RestAssured?

Which method is used to validate the status code of a response in RestAssured? A) statusCode() B) checkStatus() C) verifyStatus() D) assertStatus() Answer: A) statusCode() Explanation: The statusCode() method in RestAssured is used to validate the status code of an HTTP response. It allows you to assert that the response status code matches the expected

Which method is used to validate the status code of a response in RestAssured? Read More »

Scroll to Top