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

Apply @SafeVarargs at MockRestRequestMatchers#header [SPR-14278] #18850

Closed
spring-projects-issues opened this issue May 17, 2016 · 0 comments
Closed
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Phillip Wirth opened SPR-14278 and commented

The Warning: Unchecked generics Array Creation for varags parameter in .andExpect(header("X-ClientVersion", equalTo("warnings_occurs_here"))) does not seem to be necessary.

Complete test method code:

	@Test
	public void testSomeMethod() {

		this.mockServer.expect(requestTo("http://somthing"))
				.andExpect(method(HttpMethod.POST))
				.andExpect(header("X-ClientName", "gotcha"))
				.andExpect(header("X-ClientVersion", equalTo("warnings_occurs_here")))
				.andExpect(content().string(isEmptyOrNullString()))
				.andRespond(withSuccess());
		this.someClient.someMethod(666, 888);
		this.mockServer.verify();
	}

I guess when @SafeVarargs would be applied to MockRestRequestMatchers#header everything would be fine.

@SafeVarargs exists since Java 7.

Spring Tests do have a targetCompatiblity to 1.8 so this should work too. (If I interpreted that correctly from settings.gradle.)


Affects: 4.3 RC2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants