Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockServer is not found #466

Closed
mehiatt opened this issue Jan 4, 2023 · 1 comment
Closed

MockServer is not found #466

mehiatt opened this issue Jan 4, 2023 · 1 comment

Comments

@mehiatt
Copy link

mehiatt commented Jan 4, 2023

I was trying to mock the unirest request:

@Test
public void POST_AuthUser_201() throws Exception {
        when(Unirest.get(MockServer.GET)).thenReturn(getRequest);
        ...
}

However I can't import MockServer. I have tried serveral maven imports in pom.xml including:

                 <dependency>
			<groupId>com.konghq</groupId>
			<artifactId>unirest-java</artifactId>
			<version>3.14.1</version>
			<classifier>standalone</classifier>
		</dependency>
		<dependency>
			<groupId>com.konghq</groupId>
			<artifactId>unirest-bdd-tests</artifactId>
			<version>3.14.1</version>
			<scope>import</scope>
		</dependency>
		<dependency>
			<groupId>com.konghq</groupId>
			<artifactId>unirest-mocks</artifactId>
			<version>3.11.09</version>
			<scope>test</scope>
		</dependency>

and I can't import MockServer from any of them. Tried two different IDEs as well (Eclipse and IntelliJ).

Based on the examples I have found online and in the docs, one of these imports should be working.

@ryber
Copy link
Collaborator

ryber commented Jan 4, 2023

"MockServer" is not a production class, it's part of Unirest's test suite. If you want to use the Unirest mocking library see https://github.com/Kong/unirest-java/tree/main/unirest-mocks#usage

What documentation did you see that said you should be able to do that? Unirest has no native support for Mockito that would allow that

@ryber ryber closed this as completed Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants