Example usage for org.springframework.security.access ConfigAttribute ConfigAttribute

List of usage examples for org.springframework.security.access ConfigAttribute ConfigAttribute

Introduction

In this page you can find the example usage for org.springframework.security.access ConfigAttribute ConfigAttribute.

Prototype

ConfigAttribute

Source Link

Usage

From source file:be.dnsbelgium.rate.spring.security.LeakyBucketVoterTest.java

@Test
@SuppressWarnings("unchecked")
public void testSupportsConfigAttribute() {
    final LeakyBucketVoter voter = new LeakyBucketVoter(mock(LeakyBucketService.class), keyFactory,
            DEFAULT_AMOUNT);// w w  w  . j  a v a 2s . com
    assertEquals(true, voter.supports(new SecurityConfig(LeakyBucketVoter.PREFIX + "ANY_SUFFIX")));
    assertEquals(false, voter.supports(new SecurityConfig("NOT" + LeakyBucketVoter.PREFIX + "ANY_SUFFIX")));
    assertEquals(false, voter.supports(new ConfigAttribute() {
        @Override
        public String getAttribute() {
            return null;
        }
    }));
}