Skip to content

Commit a84da1f

Browse files
committed
unit tests for models
1 parent b43dd35 commit a84da1f

20 files changed

+302
-206
lines changed

src/test/java/com/bandwidth/sdk/unit/models/AsyncLookupRequestTest.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,38 @@
1111
*/
1212

1313

14-
package com.bandwidth.sdk.model;
15-
16-
import com.google.gson.TypeAdapter;
17-
import com.google.gson.annotations.JsonAdapter;
18-
import com.google.gson.annotations.SerializedName;
19-
import com.google.gson.stream.JsonReader;
20-
import com.google.gson.stream.JsonWriter;
21-
import java.io.IOException;
22-
import java.util.ArrayList;
14+
package com.bandwidth.sdk.unit.models;
15+
16+
import com.bandwidth.sdk.model.AsyncLookupRequest;
17+
2318
import java.util.Arrays;
2419
import java.util.List;
25-
import org.junit.jupiter.api.Disabled;
2620
import org.junit.jupiter.api.Test;
2721

22+
import static org.hamcrest.MatcherAssert.assertThat;
23+
import static org.hamcrest.CoreMatchers.instanceOf;
24+
2825
/**
2926
* Model tests for AsyncLookupRequest
3027
*/
3128
public class AsyncLookupRequestTest {
32-
private final AsyncLookupRequest model = new AsyncLookupRequest();
29+
private final AsyncLookupRequest model = new AsyncLookupRequest()
30+
.phoneNumbers(Arrays.asList("+1234567890", "+1987654321"));
3331

3432
/**
3533
* Model tests for AsyncLookupRequest
3634
*/
3735
@Test
3836
public void testAsyncLookupRequest() {
39-
// TODO: test AsyncLookupRequest
37+
assertThat(model, instanceOf(AsyncLookupRequest.class));
4038
}
4139

4240
/**
4341
* Test the property 'phoneNumbers'
4442
*/
4543
@Test
4644
public void phoneNumbersTest() {
47-
// TODO: test phoneNumbers
45+
assertThat(model.getPhoneNumbers(), instanceOf(List.class));
4846
}
4947

5048
}

src/test/java/com/bandwidth/sdk/unit/models/CompletedLookupStatusEnumTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
*/
1212

1313

14-
package com.bandwidth.sdk.model;
14+
package com.bandwidth.sdk.unit.models;
15+
16+
import com.bandwidth.sdk.model.CompletedLookupStatusEnum;
1517

16-
import com.google.gson.annotations.SerializedName;
17-
import org.junit.jupiter.api.Disabled;
1818
import org.junit.jupiter.api.Test;
1919

20+
import static org.hamcrest.MatcherAssert.assertThat;
21+
import static org.hamcrest.CoreMatchers.equalTo;
22+
2023
/**
2124
* Model tests for CompletedLookupStatusEnum
2225
*/
@@ -26,7 +29,9 @@ public class CompletedLookupStatusEnumTest {
2629
*/
2730
@Test
2831
public void testCompletedLookupStatusEnum() {
29-
// TODO: test CompletedLookupStatusEnum
32+
assertThat(CompletedLookupStatusEnum.COMPLETE.toString(), equalTo("COMPLETE"));
33+
assertThat(CompletedLookupStatusEnum.PARTIAL_COMPLETE.toString(), equalTo("PARTIAL_COMPLETE"));
34+
assertThat(CompletedLookupStatusEnum.FAILED.toString(), equalTo("FAILED"));
3035
}
3136

3237
}

src/test/java/com/bandwidth/sdk/unit/models/CreateAsyncBulkLookupResponseDataTest.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,47 @@
1111
*/
1212

1313

14-
package com.bandwidth.sdk.model;
14+
package com.bandwidth.sdk.unit.models;
1515

16+
import com.bandwidth.sdk.model.CreateAsyncBulkLookupResponseData;
1617
import com.bandwidth.sdk.model.InProgressLookupStatusEnum;
17-
import com.google.gson.TypeAdapter;
18-
import com.google.gson.annotations.JsonAdapter;
19-
import com.google.gson.annotations.SerializedName;
20-
import com.google.gson.stream.JsonReader;
21-
import com.google.gson.stream.JsonWriter;
22-
import java.io.IOException;
23-
import java.util.Arrays;
18+
2419
import java.util.UUID;
25-
import org.junit.jupiter.api.Disabled;
2620
import org.junit.jupiter.api.Test;
2721

22+
import static org.hamcrest.MatcherAssert.assertThat;
23+
import static org.hamcrest.CoreMatchers.instanceOf;
24+
2825
/**
2926
* Model tests for CreateAsyncBulkLookupResponseData
3027
*/
3128
public class CreateAsyncBulkLookupResponseDataTest {
32-
private final CreateAsyncBulkLookupResponseData model = new CreateAsyncBulkLookupResponseData();
29+
private final CreateAsyncBulkLookupResponseData model = new CreateAsyncBulkLookupResponseData()
30+
.requestId(UUID.fromString("123e4567-e89b-12d3-a456-426614174000"))
31+
.status(InProgressLookupStatusEnum.IN_PROGRESS);
3332

3433
/**
3534
* Model tests for CreateAsyncBulkLookupResponseData
3635
*/
3736
@Test
3837
public void testCreateAsyncBulkLookupResponseData() {
39-
// TODO: test CreateAsyncBulkLookupResponseData
38+
assertThat(model, instanceOf(CreateAsyncBulkLookupResponseData.class));
4039
}
4140

4241
/**
4342
* Test the property 'requestId'
4443
*/
4544
@Test
4645
public void requestIdTest() {
47-
// TODO: test requestId
46+
assertThat(model.getRequestId(), instanceOf(UUID.class));
4847
}
4948

5049
/**
5150
* Test the property 'status'
5251
*/
5352
@Test
5453
public void statusTest() {
55-
// TODO: test status
54+
assertThat(model.getStatus(), instanceOf(InProgressLookupStatusEnum.class));
5655
}
5756

5857
}

src/test/java/com/bandwidth/sdk/unit/models/CreateAsyncBulkLookupResponseTest.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,59 +11,60 @@
1111
*/
1212

1313

14-
package com.bandwidth.sdk.model;
14+
package com.bandwidth.sdk.unit.models;
1515

16+
import com.bandwidth.sdk.model.CreateAsyncBulkLookupResponse;
1617
import com.bandwidth.sdk.model.CreateAsyncBulkLookupResponseData;
1718
import com.bandwidth.sdk.model.LinkSchema;
1819
import com.bandwidth.sdk.model.LookupErrorSchema;
19-
import com.google.gson.TypeAdapter;
20-
import com.google.gson.annotations.JsonAdapter;
21-
import com.google.gson.annotations.SerializedName;
22-
import com.google.gson.stream.JsonReader;
23-
import com.google.gson.stream.JsonWriter;
24-
import java.io.IOException;
25-
import java.util.ArrayList;
20+
2621
import java.util.Arrays;
2722
import java.util.List;
28-
import org.junit.jupiter.api.Disabled;
23+
2924
import org.junit.jupiter.api.Test;
3025

26+
import static org.hamcrest.MatcherAssert.assertThat;
27+
import static org.hamcrest.CoreMatchers.instanceOf;
28+
3129
/**
3230
* Model tests for CreateAsyncBulkLookupResponse
3331
*/
3432
public class CreateAsyncBulkLookupResponseTest {
35-
private final CreateAsyncBulkLookupResponse model = new CreateAsyncBulkLookupResponse();
33+
private final CreateAsyncBulkLookupResponse model = new CreateAsyncBulkLookupResponse()
34+
.links(Arrays.asList(new LinkSchema()))
35+
.data(new CreateAsyncBulkLookupResponseData())
36+
.errors(Arrays.asList(new LookupErrorSchema()));
3637

3738
/**
3839
* Model tests for CreateAsyncBulkLookupResponse
3940
*/
4041
@Test
4142
public void testCreateAsyncBulkLookupResponse() {
42-
// TODO: test CreateAsyncBulkLookupResponse
43+
assertThat(model, instanceOf(CreateAsyncBulkLookupResponse.class));
4344
}
4445

4546
/**
4647
* Test the property 'links'
4748
*/
4849
@Test
4950
public void linksTest() {
50-
// TODO: test links
51+
assertThat(model.getLinks(), instanceOf(List.class));
5152
}
5253

5354
/**
5455
* Test the property 'data'
5556
*/
5657
@Test
5758
public void dataTest() {
58-
// TODO: test data
59+
assertThat(model.getData(), instanceOf(CreateAsyncBulkLookupResponseData.class));
5960
}
6061

6162
/**
6263
* Test the property 'errors'
6364
*/
6465
@Test
6566
public void errorsTest() {
66-
// TODO: test errors
67+
assertThat(model.getErrors(), instanceOf(List.class));
6768
}
6869

6970
}

src/test/java/com/bandwidth/sdk/unit/models/CreateSyncLookupResponseDataTest.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,59 +11,63 @@
1111
*/
1212

1313

14-
package com.bandwidth.sdk.model;
14+
package com.bandwidth.sdk.unit.models;
1515

1616
import com.bandwidth.sdk.model.CompletedLookupStatusEnum;
17+
import com.bandwidth.sdk.model.CreateSyncLookupResponseData;
18+
import com.bandwidth.sdk.model.LineTypeEnum;
1719
import com.bandwidth.sdk.model.LookupResult;
18-
import com.google.gson.TypeAdapter;
19-
import com.google.gson.annotations.JsonAdapter;
20-
import com.google.gson.annotations.SerializedName;
21-
import com.google.gson.stream.JsonReader;
22-
import com.google.gson.stream.JsonWriter;
23-
import java.io.IOException;
24-
import java.util.ArrayList;
20+
2521
import java.util.Arrays;
2622
import java.util.List;
2723
import java.util.UUID;
28-
import org.junit.jupiter.api.Disabled;
24+
2925
import org.junit.jupiter.api.Test;
3026

27+
import static org.hamcrest.MatcherAssert.assertThat;
28+
import static org.hamcrest.CoreMatchers.instanceOf;
29+
3130
/**
3231
* Model tests for CreateSyncLookupResponseData
3332
*/
3433
public class CreateSyncLookupResponseDataTest {
35-
private final CreateSyncLookupResponseData model = new CreateSyncLookupResponseData();
34+
private final CreateSyncLookupResponseData model = new CreateSyncLookupResponseData()
35+
.requestId(UUID.fromString("123e4567-e89b-12d3-a456-426614174000"))
36+
.status(CompletedLookupStatusEnum.COMPLETE)
37+
.results(Arrays.asList(new LookupResult()
38+
.phoneNumber("+1234567890")
39+
.lineType(LineTypeEnum.MOBILE)));
3640

3741
/**
3842
* Model tests for CreateSyncLookupResponseData
3943
*/
4044
@Test
4145
public void testCreateSyncLookupResponseData() {
42-
// TODO: test CreateSyncLookupResponseData
46+
assertThat(model, instanceOf(CreateSyncLookupResponseData.class));
4347
}
4448

4549
/**
4650
* Test the property 'requestId'
4751
*/
4852
@Test
4953
public void requestIdTest() {
50-
// TODO: test requestId
54+
assertThat(model.getRequestId(), instanceOf(UUID.class));
5155
}
5256

5357
/**
5458
* Test the property 'status'
5559
*/
5660
@Test
5761
public void statusTest() {
58-
// TODO: test status
62+
assertThat(model.getStatus(), instanceOf(CompletedLookupStatusEnum.class));
5963
}
6064

6165
/**
6266
* Test the property 'results'
6367
*/
6468
@Test
6569
public void resultsTest() {
66-
// TODO: test results
70+
assertThat(model.getResults(), instanceOf(List.class));
6771
}
6872

6973
}

src/test/java/com/bandwidth/sdk/unit/models/CreateSyncLookupResponseTest.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
*/
1212

1313

14-
package com.bandwidth.sdk.model;
14+
package com.bandwidth.sdk.unit.models;
1515

16+
import com.bandwidth.sdk.model.CompletedLookupStatusEnum;
17+
import com.bandwidth.sdk.model.CreateSyncLookupResponse;
1618
import com.bandwidth.sdk.model.CreateSyncLookupResponseData;
1719
import com.bandwidth.sdk.model.LinkSchema;
1820
import com.bandwidth.sdk.model.LookupErrorSchema;
@@ -28,42 +30,56 @@
2830
import org.junit.jupiter.api.Disabled;
2931
import org.junit.jupiter.api.Test;
3032

33+
import static org.hamcrest.MatcherAssert.assertThat;
34+
import static org.hamcrest.CoreMatchers.instanceOf;
35+
3136
/**
3237
* Model tests for CreateSyncLookupResponse
3338
*/
3439
public class CreateSyncLookupResponseTest {
35-
private final CreateSyncLookupResponse model = new CreateSyncLookupResponse();
40+
private final CreateSyncLookupResponse model = new CreateSyncLookupResponse()
41+
.links(Arrays.asList(new LinkSchema()
42+
.href("https://api.bandwidth.com/v1.0/lookups/12345")
43+
.rel("self").method("GET")))
44+
.data(new CreateSyncLookupResponseData()
45+
.requestId(java.util.UUID.fromString("123e4567-e89b-12d3-a456-426614174000"))
46+
.status(CompletedLookupStatusEnum.COMPLETE)
47+
.results(new ArrayList<>()))
48+
.errors(Arrays.asList(new LookupErrorSchema()
49+
.code("InvalidNumber")
50+
.description("The phone number provided is invalid.")
51+
.type("ValidationError")));
3652

3753
/**
3854
* Model tests for CreateSyncLookupResponse
3955
*/
4056
@Test
4157
public void testCreateSyncLookupResponse() {
42-
// TODO: test CreateSyncLookupResponse
58+
assertThat(model, instanceOf(CreateSyncLookupResponse.class));
4359
}
4460

4561
/**
4662
* Test the property 'links'
4763
*/
4864
@Test
4965
public void linksTest() {
50-
// TODO: test links
66+
assertThat(model.getLinks(), instanceOf(List.class));
5167
}
5268

5369
/**
5470
* Test the property 'data'
5571
*/
5672
@Test
5773
public void dataTest() {
58-
// TODO: test data
74+
assertThat(model.getData(), instanceOf(CreateSyncLookupResponseData.class));
5975
}
6076

6177
/**
6278
* Test the property 'errors'
6379
*/
6480
@Test
6581
public void errorsTest() {
66-
// TODO: test errors
82+
assertThat(model.getErrors(), instanceOf(List.class));
6783
}
6884

6985
}

src/test/java/com/bandwidth/sdk/unit/models/DeactivationEventEnumTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
*/
1212

1313

14-
package com.bandwidth.sdk.model;
14+
package com.bandwidth.sdk.unit.models;
1515

16-
import com.google.gson.annotations.SerializedName;
17-
import org.junit.jupiter.api.Disabled;
1816
import org.junit.jupiter.api.Test;
1917

18+
import com.bandwidth.sdk.model.DeactivationEventEnum;
19+
20+
import static org.hamcrest.MatcherAssert.assertThat;
21+
import static org.hamcrest.CoreMatchers.equalTo;
22+
2023
/**
2124
* Model tests for DeactivationEventEnum
2225
*/
@@ -26,7 +29,7 @@ public class DeactivationEventEnumTest {
2629
*/
2730
@Test
2831
public void testDeactivationEventEnum() {
29-
// TODO: test DeactivationEventEnum
32+
assertThat(DeactivationEventEnum.DEACTIVATED.toString(), equalTo("DEACTIVATED"));
3033
}
3134

3235
}

0 commit comments

Comments
 (0)