Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wd1105040417
retrofit
提交
a1897aeb
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,发现更多精彩内容 >>
提交
a1897aeb
编写于
3月 25, 2020
作者:
J
Jake Wharton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Small fixes from error-prone
上级
49aa9fe9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
14 deletion
+40
-14
retrofit/src/main/java/retrofit2/OkHttpCall.java
retrofit/src/main/java/retrofit2/OkHttpCall.java
+1
-1
retrofit/src/test/java/retrofit2/CallTest.java
retrofit/src/test/java/retrofit2/CallTest.java
+12
-12
retrofit/src/test/java/retrofit2/NonFatalError.java
retrofit/src/test/java/retrofit2/NonFatalError.java
+22
-0
retrofit/src/test/java/retrofit2/RequestFactoryTest.java
retrofit/src/test/java/retrofit2/RequestFactoryTest.java
+3
-0
retrofit/src/test/java/retrofit2/RetrofitTest.java
retrofit/src/test/java/retrofit2/RetrofitTest.java
+2
-1
未找到文件。
retrofit/src/main/java/retrofit2/OkHttpCall.java
浏览文件 @
a1897aeb
...
...
@@ -234,7 +234,7 @@ final class OkHttpCall<T> implements Call<T> {
}
}
public
void
cancel
()
{
@Override
public
void
cancel
()
{
canceled
=
true
;
okhttp3
.
Call
call
;
...
...
retrofit/src/test/java/retrofit2/CallTest.java
浏览文件 @
a1897aeb
...
...
@@ -787,7 +787,7 @@ public final class CallTest {
Object
a
=
new
Object
()
{
@Override
public
String
toString
()
{
writeCount
.
incrementAndGet
();
throw
new
Error
(
"Broken!"
);
throw
new
NonFatal
Error
(
"Broken!"
);
}
};
Call
<
String
>
call
=
service
.
postRequestBody
(
a
);
...
...
@@ -795,7 +795,7 @@ public final class CallTest {
try
{
call
.
request
();
fail
();
}
catch
(
Error
e
)
{
}
catch
(
NonFatal
Error
e
)
{
assertThat
(
e
).
hasMessage
(
"Broken!"
);
}
assertThat
(
writeCount
.
get
()).
isEqualTo
(
1
);
...
...
@@ -803,7 +803,7 @@ public final class CallTest {
try
{
call
.
execute
();
fail
();
}
catch
(
Error
e
)
{
}
catch
(
NonFatal
Error
e
)
{
assertThat
(
e
).
hasMessage
(
"Broken!"
);
}
assertThat
(
writeCount
.
get
()).
isEqualTo
(
1
);
...
...
@@ -882,7 +882,7 @@ public final class CallTest {
Object
a
=
new
Object
()
{
@Override
public
String
toString
()
{
writeCount
.
incrementAndGet
();
throw
new
Error
(
"Broken!"
);
throw
new
NonFatal
Error
(
"Broken!"
);
}
};
Call
<
String
>
call
=
service
.
postRequestBody
(
a
);
...
...
@@ -890,7 +890,7 @@ public final class CallTest {
try
{
call
.
execute
();
fail
();
}
catch
(
Error
e
)
{
}
catch
(
NonFatal
Error
e
)
{
assertThat
(
e
).
hasMessage
(
"Broken!"
);
}
assertThat
(
writeCount
.
get
()).
isEqualTo
(
1
);
...
...
@@ -898,7 +898,7 @@ public final class CallTest {
try
{
call
.
request
();
fail
();
}
catch
(
Error
e
)
{
}
catch
(
NonFatal
Error
e
)
{
assertThat
(
e
).
hasMessage
(
"Broken!"
);
}
assertThat
(
writeCount
.
get
()).
isEqualTo
(
1
);
...
...
@@ -993,7 +993,7 @@ public final class CallTest {
Object
a
=
new
Object
()
{
@Override
public
String
toString
()
{
writeCount
.
incrementAndGet
();
throw
new
Error
(
"Broken!"
);
throw
new
NonFatal
Error
(
"Broken!"
);
}
};
Call
<
String
>
call
=
service
.
postRequestBody
(
a
);
...
...
@@ -1001,7 +1001,7 @@ public final class CallTest {
try
{
call
.
request
();
fail
();
}
catch
(
Error
e
)
{
}
catch
(
NonFatal
Error
e
)
{
assertThat
(
e
).
hasMessage
(
"Broken!"
);
}
assertThat
(
writeCount
.
get
()).
isEqualTo
(
1
);
...
...
@@ -1012,7 +1012,7 @@ public final class CallTest {
}
@Override
public
void
onFailure
(
Call
<
String
>
call
,
Throwable
t
)
{
assertThat
(
t
).
isExactlyInstanceOf
(
Error
.
class
).
hasMessage
(
"Broken!"
);
assertThat
(
t
).
isExactlyInstanceOf
(
NonFatal
Error
.
class
).
hasMessage
(
"Broken!"
);
assertThat
(
writeCount
.
get
()).
isEqualTo
(
1
);
latch
.
countDown
();
}
...
...
@@ -1110,7 +1110,7 @@ public final class CallTest {
Object
a
=
new
Object
()
{
@Override
public
String
toString
()
{
writeCount
.
incrementAndGet
();
throw
new
Error
(
"Broken!"
);
throw
new
NonFatal
Error
(
"Broken!"
);
}
};
Call
<
String
>
call
=
service
.
postRequestBody
(
a
);
...
...
@@ -1121,7 +1121,7 @@ public final class CallTest {
}
@Override
public
void
onFailure
(
Call
<
String
>
call
,
Throwable
t
)
{
assertThat
(
t
).
isExactlyInstanceOf
(
Error
.
class
).
hasMessage
(
"Broken!"
);
assertThat
(
t
).
isExactlyInstanceOf
(
NonFatal
Error
.
class
).
hasMessage
(
"Broken!"
);
assertThat
(
writeCount
.
get
()).
isEqualTo
(
1
);
latch
.
countDown
();
}
...
...
@@ -1131,7 +1131,7 @@ public final class CallTest {
try
{
call
.
request
();
fail
();
}
catch
(
Error
e
)
{
}
catch
(
NonFatal
Error
e
)
{
assertThat
(
e
).
hasMessage
(
"Broken!"
);
}
assertThat
(
writeCount
.
get
()).
isEqualTo
(
1
);
...
...
retrofit/src/test/java/retrofit2/NonFatalError.java
0 → 100644
浏览文件 @
a1897aeb
/*
* Copyright (C) 2020 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
retrofit2
;
final
class
NonFatalError
extends
Error
{
NonFatalError
(
String
message
)
{
super
(
message
);
}
}
retrofit/src/test/java/retrofit2/RequestFactoryTest.java
浏览文件 @
a1897aeb
...
...
@@ -32,6 +32,7 @@ import okhttp3.Request;
import
okhttp3.RequestBody
;
import
okhttp3.ResponseBody
;
import
okio.Buffer
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
retrofit2.helpers.NullObjectConverterFactory
;
import
retrofit2.helpers.ToStringConverterFactory
;
...
...
@@ -793,6 +794,7 @@ public final class RequestFactoryTest {
assertThat
(
request
.
body
()).
isNull
();
}
@Ignore
(
"This test is valid but isn't validated by RequestFactory so it needs moved"
)
@Test
public
void
headWithoutVoidThrows
()
{
class
Example
{
@HEAD
(
"/foo/bar/"
)
//
...
...
@@ -802,6 +804,7 @@ public final class RequestFactoryTest {
}
try
{
buildRequest
(
Example
.
class
);
fail
();
}
catch
(
IllegalArgumentException
e
)
{
assertThat
(
e
).
hasMessage
(
"HEAD method must use Void as response type.\n for method Example.method"
);
...
...
retrofit/src/test/java/retrofit2/RetrofitTest.java
浏览文件 @
a1897aeb
...
...
@@ -121,7 +121,8 @@ public final class RetrofitTest {
@GET
(
"/"
)
Call
<
String
>
method
(
@Query
(
"i"
)
AtomicInteger
value
);
}
@SuppressWarnings
(
"EqualsBetweenInconvertibleTypes"
)
// We are explicitly testing this behavior.
// We are explicitly testing this behavior.
@SuppressWarnings
({
"EqualsBetweenInconvertibleTypes"
,
"EqualsIncompatibleType"
})
@Test
public
void
objectMethodsStillWork
()
{
Retrofit
retrofit
=
new
Retrofit
.
Builder
()
.
baseUrl
(
server
.
url
(
"/"
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录