-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3702 from ansman/improve-unit-support
Improve support for Unit as the return type
- Loading branch information
Showing
9 changed files
with
146 additions
and
49 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
retrofit/kotlin-test/src/test/java/retrofit2/KotlinRequestFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package retrofit2; | ||
|
||
import kotlin.Unit; | ||
import okhttp3.Request; | ||
import org.junit.Test; | ||
import retrofit2.http.HEAD; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static retrofit2.TestingUtils.buildRequest; | ||
|
||
public final class KotlinRequestFactoryTest { | ||
@Test | ||
public void headUnit() { | ||
class Example { | ||
@HEAD("/foo/bar/") | ||
Call<Unit> method() { | ||
return null; | ||
} | ||
} | ||
|
||
Request request = buildRequest(Example.class); | ||
assertThat(request.method()).isEqualTo("HEAD"); | ||
assertThat(request.headers().size()).isZero(); | ||
assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/"); | ||
assertThat(request.body()).isNull(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters