From f6e0922f7c6aa5f64c906d74710c79205323baba Mon Sep 17 00:00:00 2001
From: "shengzhaoli.shengz" <shengzhaoli.shengz@alibaba-inc.com>
Date: Sat, 23 Oct 2021 12:25:42 +0800
Subject: [PATCH] Update spring-boot 2.4.2 , update config test

---
 .../PasswordInlineAccessTokenInvokerTest.java | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/test/java/com/monkeyk/sos/service/business/PasswordInlineAccessTokenInvokerTest.java b/src/test/java/com/monkeyk/sos/service/business/PasswordInlineAccessTokenInvokerTest.java
index 984449c..5a059b9 100644
--- a/src/test/java/com/monkeyk/sos/service/business/PasswordInlineAccessTokenInvokerTest.java
+++ b/src/test/java/com/monkeyk/sos/service/business/PasswordInlineAccessTokenInvokerTest.java
@@ -2,12 +2,15 @@ package com.monkeyk.sos.service.business;
 
 import com.monkeyk.sos.service.dto.AccessTokenDto;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.function.Executable;
+import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
 
 import java.util.HashMap;
 import java.util.Map;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 
 /**
@@ -15,11 +18,11 @@ import static org.junit.jupiter.api.Assertions.assertNull;
  *
  * @author Shengzhao Li
  */
- class PasswordInlineAccessTokenInvokerTest extends AbstractInlineAccessTokenInvokerTest {
+class PasswordInlineAccessTokenInvokerTest extends AbstractInlineAccessTokenInvokerTest {
 
 
     @Test
-     void invokeNormal() {
+    void invokeNormal() {
 
         createClientDetails();
 
@@ -46,9 +49,9 @@ import static org.junit.jupiter.api.Assertions.assertNull;
     }
 
 
-//    @Test(expected = InvalidGrantException.class)
+    //    @Test(expected = InvalidGrantException.class)
     @Test
-     void invalidUsername() {
+    void invalidUsername() {
 
         createClientDetails();
 
@@ -62,18 +65,21 @@ import static org.junit.jupiter.api.Assertions.assertNull;
         params.put("password", "password");
 
         PasswordInlineAccessTokenInvoker accessTokenInvoker = new PasswordInlineAccessTokenInvoker();
-        final AccessTokenDto tokenDto = accessTokenInvoker.invoke(params);
+        assertThrows(InvalidGrantException.class, () -> {
+            final AccessTokenDto tokenDto = accessTokenInvoker.invoke(params);
+
+            assertNull(tokenDto);
+        });
 
-        assertNull(tokenDto);
 
 //        System.out.println(accessTokenDto);
 
     }
 
 
-//    @Test(expected = IllegalStateException.class)
+    //    @Test(expected = IllegalStateException.class)
     @Test
-     void invalidScope() {
+    void invalidScope() {
 
         createClientDetails();
         createUser();