Skip to content

Commit

Permalink
Change base package name to com.infinum
Browse files Browse the repository at this point in the history
  • Loading branch information
reisub committed Mar 11, 2021
1 parent 05fb3c9 commit 85d528e
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 46 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.infinum.thrifty;
package com.infinum.thrifty;

import com.microsoft.thrifty.protocol.BinaryProtocol;
import com.microsoft.thrifty.protocol.CompactProtocol;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.infinum.thrifty;
package com.infinum.thrifty;

import com.microsoft.thrifty.Adapter;
import com.microsoft.thrifty.Struct;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.infinum.thrifty;
package com.infinum.thrifty;

import com.microsoft.thrifty.Adapter;
import com.microsoft.thrifty.StructBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.infinum.thrifty;
package com.infinum.thrifty;

import com.microsoft.thrifty.Adapter;
import com.microsoft.thrifty.StructBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ParametersAreNonnullByDefault
package com.infinum.thrifty;

import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package co.infinum.thrifty;
package com.infinum.thrifty;

import co.infinum.thrifty.kotlin.BrokenPhone;
import com.infinum.thrifty.kotlin.BrokenPhone;
import com.infinum.thrifty.java.Phone;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
Expand All @@ -46,16 +47,16 @@
public final class ThriftyConverterFactoryTest {
interface Service {
@GET("/")
Call<co.infinum.thrifty.java.Phone> get();
Call<Phone> get();

@POST("/")
Call<co.infinum.thrifty.java.Phone> post(@Body co.infinum.thrifty.java.Phone impl);
Call<Phone> post(@Body Phone impl);

@GET("/")
Call<co.infinum.thrifty.kotlin.Phone> getKt();
Call<com.infinum.thrifty.kotlin.Phone> getKt();

@POST("/")
Call<co.infinum.thrifty.kotlin.Phone> postKt(@Body co.infinum.thrifty.kotlin.Phone impl);
Call<com.infinum.thrifty.kotlin.Phone> postKt(@Body com.infinum.thrifty.kotlin.Phone impl);

@GET("/")
Call<String> getWrongClass();
Expand Down Expand Up @@ -110,10 +111,10 @@ private void serializeAndDeserialize(ProtocolType type, String phoneNumber, Stri
ByteString bodyByteString = isBodyBase64 ? ByteString.decodeBase64(body) : ByteString.encodeUtf8(body);
server.enqueue(new MockResponse().setBody(new Buffer().write(bodyByteString)));

co.infinum.thrifty.java.Phone phone = new co.infinum.thrifty.java.Phone.Builder().number(phoneNumber).build();
Call<co.infinum.thrifty.java.Phone> call = service.post(phone);
Response<co.infinum.thrifty.java.Phone> response = call.execute();
co.infinum.thrifty.java.Phone bodyPhone = response.body();
Phone phone = new Phone.Builder().number(phoneNumber).build();
Call<Phone> call = service.post(phone);
Response<Phone> response = call.execute();
Phone bodyPhone = response.body();
assertThat(bodyPhone.number).isEqualTo(phoneNumber);

RecordedRequest request = server.takeRequest();
Expand All @@ -128,10 +129,10 @@ private void serializeAndDeserializeKt(ProtocolType type, String phoneNumber, St
ByteString bodyByteString = isBodyBase64 ? ByteString.decodeBase64(body) : ByteString.encodeUtf8(body);
server.enqueue(new MockResponse().setBody(new Buffer().write(bodyByteString)));

co.infinum.thrifty.kotlin.Phone phone = new co.infinum.thrifty.kotlin.Phone.Builder().number(phoneNumber).build();
Call<co.infinum.thrifty.kotlin.Phone> call = service.postKt(phone);
Response<co.infinum.thrifty.kotlin.Phone> response = call.execute();
co.infinum.thrifty.kotlin.Phone bodyPhone = response.body();
com.infinum.thrifty.kotlin.Phone phone = new com.infinum.thrifty.kotlin.Phone.Builder().number(phoneNumber).build();
Call<com.infinum.thrifty.kotlin.Phone> call = service.postKt(phone);
Response<com.infinum.thrifty.kotlin.Phone> response = call.execute();
com.infinum.thrifty.kotlin.Phone bodyPhone = response.body();
assertThat(bodyPhone.number).isEqualTo(phoneNumber);

RecordedRequest request = server.takeRequest();
Expand Down Expand Up @@ -165,11 +166,7 @@ private void serializeWrongClass(ProtocolType type) throws IOException {
assertThat(e).hasMessage(""
+ "Unable to create @Body converter for class java.lang.String (parameter #1)\n"
+ " for method Service.postWrongClass");
assertThat(e.getCause()).hasMessageStartingWith(""
+ "Could not locate RequestBody converter for class java.lang.String.\n"
+ " Tried:\n"
+ " * retrofit2.BuiltInConverters\n"
+ " * co.infinum.thrifty.ThriftyConverterFactory");
assertThat(e.getCause()).hasMessageMatching("(?s).*Tried:.*ThriftyConverterFactory.*");
}
}

Expand Down Expand Up @@ -200,11 +197,7 @@ private void deserializeWrongClass(ProtocolType type, String body, boolean isBod
assertThat(e).hasMessage(""
+ "Unable to create converter for class java.lang.String\n"
+ " for method Service.getWrongClass");
assertThat(e.getCause()).hasMessageStartingWith(""
+ "Could not locate ResponseBody converter for class java.lang.String.\n"
+ " Tried:\n"
+ " * retrofit2.BuiltInConverters\n"
+ " * co.infinum.thrifty.ThriftyConverterFactory");
assertThat(e.getCause()).hasMessageMatching("(?s).*Tried:.*ThriftyConverterFactory.*");
}
}

Expand Down Expand Up @@ -234,11 +227,7 @@ private void serializeWrongType(ProtocolType type) throws IOException {
assertThat(e).hasMessage(""
+ "Unable to create @Body converter for java.util.List<java.lang.String> (parameter #1)\n"
+ " for method Service.postWrongType");
assertThat(e.getCause()).hasMessageStartingWith(""
+ "Could not locate RequestBody converter for java.util.List<java.lang.String>.\n"
+ " Tried:\n"
+ " * retrofit2.BuiltInConverters\n"
+ " * co.infinum.thrifty.ThriftyConverterFactory");
assertThat(e.getCause()).hasMessageMatching("(?s).*Tried:.*ThriftyConverterFactory.*");
}
}

Expand Down Expand Up @@ -269,11 +258,7 @@ private void deserializeWrongType(ProtocolType type, String body, boolean isBody
assertThat(e).hasMessage(""
+ "Unable to create converter for java.util.List<java.lang.String>\n"
+ " for method Service.getWrongType");
assertThat(e.getCause()).hasMessageStartingWith(""
+ "Could not locate ResponseBody converter for java.util.List<java.lang.String>.\n"
+ " Tried:\n"
+ " * retrofit2.BuiltInConverters\n"
+ " * co.infinum.thrifty.ThriftyConverterFactory");
assertThat(e.getCause()).hasMessageMatching("(?s).*Tried:.*ThriftyConverterFactory.*");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Automatically generated by the Thrifty compiler; do not edit!
// Generated on: 2021-03-11T13:23:16.134262292Z
// Source: /home/dino/work/thrifty-retrofit-converter/retrofit-converter-thrifty/src/test/resources/phone.thrift: (3, 1)
package co.infinum.thrifty.java;
package com.infinum.thrifty.java;

import com.microsoft.thrifty.Adapter;
import com.microsoft.thrifty.Struct;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.infinum.thrifty.kotlin
package com.infinum.thrifty.kotlin

import com.microsoft.thrifty.Adapter
import com.microsoft.thrifty.Struct
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.infinum.thrifty.kotlin
package com.infinum.thrifty.kotlin

import com.microsoft.thrifty.Adapter
import com.microsoft.thrifty.Struct
Expand Down
2 changes: 1 addition & 1 deletion retrofit-converter-thrifty/src/test/resources/phone.thrift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace java co.infinum.thrifty.java
namespace java com.infinum.thrifty.java

struct Phone {
1: optional string number
Expand Down

0 comments on commit 85d528e

Please sign in to comment.