Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wd1105040417
retrofit
提交
cd333f70
R
retrofit
项目概览
wd1105040417
/
retrofit
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
retrofit
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
cd333f70
编写于
6月 15, 2018
作者:
J
Jesse Wilson
提交者:
GitHub
6月 15, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2790 from square/jakew/refactorings/2018-06-12
Jakew/refactorings/2018 06 12
上级
de26ba67
a12554ea
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
754 addition
and
687 deletion
+754
-687
retrofit/src/main/java/retrofit2/RequestFactory.java
retrofit/src/main/java/retrofit2/RequestFactory.java
+735
-0
retrofit/src/main/java/retrofit2/ServiceMethod.java
retrofit/src/main/java/retrofit2/ServiceMethod.java
+12
-673
retrofit/src/test/java/retrofit2/RequestFactoryAndroidTest.java
...it/src/test/java/retrofit2/RequestFactoryAndroidTest.java
+2
-2
retrofit/src/test/java/retrofit2/RequestFactoryBuilderTest.java
...it/src/test/java/retrofit2/RequestFactoryBuilderTest.java
+3
-2
retrofit/src/test/java/retrofit2/RequestFactoryTest.java
retrofit/src/test/java/retrofit2/RequestFactoryTest.java
+2
-10
未找到文件。
retrofit/src/main/java/retrofit2/RequestFactory.java
0 → 100644
浏览文件 @
cd333f70
此差异已折叠。
点击以展开。
retrofit/src/main/java/retrofit2/ServiceMethod.java
浏览文件 @
cd333f70
此差异已折叠。
点击以展开。
retrofit/src/test/java/retrofit2/Request
Builder
AndroidTest.java
→
retrofit/src/test/java/retrofit2/Request
Factory
AndroidTest.java
浏览文件 @
cd333f70
...
...
@@ -25,11 +25,11 @@ import retrofit2.http.GET;
import
retrofit2.http.Url
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
retrofit2
.
Request
Builder
Test
.
buildRequest
;
import
static
retrofit2
.
Request
Factory
Test
.
buildRequest
;
@RunWith
(
RobolectricTestRunner
.
class
)
@SuppressWarnings
({
"UnusedParameters"
,
"unused"
})
// Parameters inspected reflectively.
public
final
class
Request
Builder
AndroidTest
{
public
final
class
Request
Factory
AndroidTest
{
@Test
public
void
getWithAndroidUriUrl
()
{
class
Example
{
@GET
...
...
retrofit/src/test/java/retrofit2/
ServiceMethod
Test.java
→
retrofit/src/test/java/retrofit2/
RequestFactoryBuilder
Test.java
浏览文件 @
cd333f70
...
...
@@ -20,7 +20,8 @@ import org.junit.Test;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
public
final
class
ServiceMethodTest
{
// TODO this test is far too white box, migrate to black box.
public
final
class
RequestFactoryBuilderTest
{
@Test
public
void
pathParameterParsing
()
throws
Exception
{
expectParams
(
"/"
);
expectParams
(
"/foo"
);
...
...
@@ -41,7 +42,7 @@ public final class ServiceMethodTest {
}
private
static
void
expectParams
(
String
path
,
String
...
expected
)
{
Set
<
String
>
calculated
=
ServiceMethod
.
parsePathParameters
(
path
);
Set
<
String
>
calculated
=
RequestFactory
.
Builder
.
parsePathParameters
(
path
);
assertThat
(
calculated
).
containsExactly
(
expected
);
}
}
retrofit/src/test/java/retrofit2/Request
Builder
Test.java
→
retrofit/src/test/java/retrofit2/Request
Factory
Test.java
浏览文件 @
cd333f70
...
...
@@ -25,7 +25,6 @@ import java.util.HashMap;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicReference
;
import
okhttp3.HttpUrl
;
import
okhttp3.MediaType
;
import
okhttp3.MultipartBody
;
...
...
@@ -65,7 +64,7 @@ import static org.junit.Assert.assertNull;
import
static
org
.
junit
.
Assert
.
fail
;
@SuppressWarnings
({
"UnusedParameters"
,
"unused"
})
// Parameters inspected reflectively.
public
final
class
Request
Builder
Test
{
public
final
class
Request
Factory
Test
{
private
static
final
MediaType
TEXT_PLAIN
=
MediaType
.
parse
(
"text/plain"
);
@Test
public
void
customMethodNoBody
()
{
...
...
@@ -2689,10 +2688,8 @@ public final class RequestBuilderTest {
}
static
<
T
>
Request
buildRequest
(
Class
<
T
>
cls
,
Retrofit
.
Builder
builder
,
Object
...
args
)
{
final
AtomicReference
<
Request
>
requestRef
=
new
AtomicReference
<>();
okhttp3
.
Call
.
Factory
callFactory
=
new
okhttp3
.
Call
.
Factory
()
{
@Override
public
okhttp3
.
Call
newCall
(
Request
request
)
{
requestRef
.
set
(
request
);
throw
new
UnsupportedOperationException
(
"Not implemented"
);
}
};
...
...
@@ -2700,13 +2697,8 @@ public final class RequestBuilderTest {
Retrofit
retrofit
=
builder
.
callFactory
(
callFactory
).
build
();
Method
method
=
TestingUtils
.
onlyMethod
(
cls
);
//noinspection unchecked
Call
<
T
>
call
=
(
Call
<
T
>)
retrofit
.
loadServiceMethod
(
method
).
invoke
(
args
);
try
{
call
.
execute
();
throw
new
AssertionError
();
}
catch
(
UnsupportedOperationException
ignored
)
{
return
requestRef
.
get
();
return
RequestFactory
.
parseAnnotations
(
retrofit
,
method
).
create
(
args
);
}
catch
(
RuntimeException
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录