Examples of MediaTypeRequestMatcher


Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher


    @Test
    public void javadocJsonJsonUseEquals() {
        request.addHeader("Accept", MediaType.APPLICATION_JSON_VALUE);
        MediaTypeRequestMatcher matcher = new MediaTypeRequestMatcher(negotiationStrategy, MediaType.APPLICATION_JSON);
        matcher.setUseEquals(true);
        assertThat(matcher.matches(request)).isTrue();
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher

    }

    @Test
    public void javadocAllJsonUseEquals() {
        request.addHeader("Accept", MediaType.ALL_VALUE);
        MediaTypeRequestMatcher matcher = new MediaTypeRequestMatcher(negotiationStrategy, MediaType.APPLICATION_JSON);
        matcher.setUseEquals(true);
        assertThat(matcher.matches(request)).isFalse();
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher


    @Test
    public void javadocApplicationAllJsonUseEquals() {
        request.addHeader("Accept", new MediaType("application","*"));
        MediaTypeRequestMatcher matcher = new MediaTypeRequestMatcher(negotiationStrategy, MediaType.APPLICATION_JSON);
        matcher.setUseEquals(true);
        assertThat(matcher.matches(request)).isFalse();
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher


    @Test
    public void javadocAllJsonUseFalse() {
        request.addHeader("Accept", MediaType.ALL_VALUE);
        MediaTypeRequestMatcher matcher = new MediaTypeRequestMatcher(negotiationStrategy, MediaType.APPLICATION_JSON);
        matcher.setUseEquals(true);
        assertThat(matcher.matches(request)).isFalse();
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher

        request = new MockHttpServletRequest();
    }

    @Test(expected=IllegalArgumentException.class)
    public void constructorNullCNSVarargs() {
        new MediaTypeRequestMatcher(null, MediaType.ALL);
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher

        new MediaTypeRequestMatcher(null, MediaType.ALL);
    }

    @Test(expected=IllegalArgumentException.class)
    public void constructorNullCNSSet() {
        new MediaTypeRequestMatcher(null, Collections.singleton(MediaType.ALL));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher

        new MediaTypeRequestMatcher(null, Collections.singleton(MediaType.ALL));
    }

    @Test(expected=IllegalArgumentException.class)
    public void constructorNoVarargs() {
        new MediaTypeRequestMatcher(negotiationStrategy);
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher

    }

    @Test(expected=IllegalArgumentException.class)
    public void constructorNullMediaTypes() {
        Collection<MediaType> mediaTypes = null;
        new MediaTypeRequestMatcher(negotiationStrategy, mediaTypes);
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher

        new MediaTypeRequestMatcher(negotiationStrategy, mediaTypes);
    }

    @Test(expected=IllegalArgumentException.class)
    public void constructorEmtpyMediaTypes() {
        new MediaTypeRequestMatcher(negotiationStrategy, Collections.<MediaType>emptyList());
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher

    @Test
    public void negotiationStrategyThrowsHMTNAE() throws HttpMediaTypeNotAcceptableException {
        when(negotiationStrategy.resolveMediaTypes(any(NativeWebRequest.class))).thenThrow(new HttpMediaTypeNotAcceptableException("oops"));

        matcher = new MediaTypeRequestMatcher(negotiationStrategy, MediaType.ALL);
        assertThat(matcher.matches(request)).isFalse();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.