Java Library

Which Maven command is used to install the project into the local repository?

Which Maven command is used to install the project into the local repository? A) mvn install B) mvn deploy C) mvn package D) mvn compile Answer: A) mvn install Explanation: The mvn install command is used to install the built artifact (e.g., JAR or WAR file) into the local Maven repository. This makes the artifact […]

Which Maven command is used to install the project into the local repository? Read More »

Which Maven lifecycle phase compiles the project’s source code?

Which Maven lifecycle phase compiles the project’s source code? A) compile B) package C) test D) install Answer: A) compile Explanation: The compile phase in the Maven build lifecycle is responsible for compiling the project’s source code. This phase takes the source code from the src/main/java directory, compiles it, and places the compiled bytecode in

Which Maven lifecycle phase compiles the project’s source code? Read More »

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 »

Scroll to Top