zhouhao 7 лет назад
Родитель
Сommit
281272302a

+ 12 - 0
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/test/java/org/hswebframework/web/authorization/oauth2/client/simple/provider/HswebResponseConvertSupportTest.java

@@ -1,7 +1,9 @@
 package org.hswebframework.web.authorization.oauth2.client.simple.provider;
 
+import com.alibaba.fastjson.JSON;
 import org.hswebframework.web.BusinessException;
 import org.hswebframework.web.authorization.oauth2.client.exception.OAuth2RequestException;
+import org.hswebframework.web.authorization.simple.SimpleUser;
 import org.hswebframework.web.authorization.simple.builder.SimpleAuthenticationBuilderFactory;
 import org.hswebframework.web.authorization.simple.builder.SimpleDataAccessConfigBuilderFactory;
 import org.hswebframework.web.controller.message.ResponseMessage;
@@ -60,6 +62,16 @@ public class HswebResponseConvertSupportTest {
         str = ResponseMessage.ok("999999999999999999").toString();
         Assert.assertEquals(convertSupport.convert(new MockOAuth2Response(str), BigDecimal.class), new BigDecimal("999999999999999999"));
 
+        SimpleUser user = SimpleUser.builder()
+                .id("test").name("test").type("test").username("test")
+                .build();
+
+        str = ResponseMessage.ok(user).toString();
+        SimpleUser resp = convertSupport.convert(new MockOAuth2Response(str), SimpleUser.class);
+
+        Assert.assertEquals(JSON.toJSON(user), JSON.toJSON(resp));
+
+
     }
 
 }