package com.springboot.cloud.auth.authentication.service.impl;

import com.google.common.collect.Sets;
import com.springboot.cloud.auth.authentication.entity.Popedom;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.security.access.SecurityConfig;

import java.util.Set;

public class AuthenticationServiceImplTest {

    @Test
    public void testIsMatch_假如存在如上资源信息_当给定包含在资源信息时_那么返回true() {
        AuthenticationServiceImpl authenticationServiceImpl = new AuthenticationServiceImpl();
        Popedom popedom = new Popedom();
        popedom.setApplicationCode("user_manager:view");
        Set<Popedom> popedoms = Sets.newHashSet(popedom);
//        Assert.assertTrue(authenticationServiceImpl.isMatch(new SecurityConfig("user_manager:view"), popedoms));
    }

    @Test
    public void testIsMatch_假如存在如上资源信息_当给不包含在资源信息时_那么返回false() {
        AuthenticationServiceImpl authenticationServiceImpl = new AuthenticationServiceImpl();
        Popedom popedom = new Popedom();
        popedom.setApplicationCode("user_manager:manager");
        Set<Popedom> popedoms = Sets.newHashSet(popedom);
//        Assert.assertFalse(authenticationServiceImpl.isMatch(new SecurityConfig("user_manager:view"), popedoms));
    }

}