Skip to content

Commit 8e6ac31

Browse files
docs: improve examples
1 parent 1152bfb commit 8e6ac31

File tree

7 files changed

+63
-57
lines changed

7 files changed

+63
-57
lines changed

orb-java-core/src/test/kotlin/com/withorb/api/models/PlanMigrationCancelResponseTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package com.withorb.api.models
44

55
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
66
import com.withorb.api.core.jsonMapper
7-
import java.time.LocalDate
87
import org.assertj.core.api.Assertions.assertThat
98
import org.junit.jupiter.api.Test
109

@@ -15,15 +14,17 @@ internal class PlanMigrationCancelResponseTest {
1514
val planMigrationCancelResponse =
1615
PlanMigrationCancelResponse.builder()
1716
.id("id")
18-
.effectiveTime(LocalDate.parse("2019-12-27"))
17+
.effectiveTime(PlanMigrationCancelResponse.EffectiveTime.UnionMember2.END_OF_TERM)
1918
.planId("plan_id")
2019
.status(PlanMigrationCancelResponse.Status.NOT_STARTED)
2120
.build()
2221

2322
assertThat(planMigrationCancelResponse.id()).isEqualTo("id")
2423
assertThat(planMigrationCancelResponse.effectiveTime())
2524
.contains(
26-
PlanMigrationCancelResponse.EffectiveTime.ofLocalDate(LocalDate.parse("2019-12-27"))
25+
PlanMigrationCancelResponse.EffectiveTime.ofUnionMember2(
26+
PlanMigrationCancelResponse.EffectiveTime.UnionMember2.END_OF_TERM
27+
)
2728
)
2829
assertThat(planMigrationCancelResponse.planId()).isEqualTo("plan_id")
2930
assertThat(planMigrationCancelResponse.status())
@@ -36,7 +37,7 @@ internal class PlanMigrationCancelResponseTest {
3637
val planMigrationCancelResponse =
3738
PlanMigrationCancelResponse.builder()
3839
.id("id")
39-
.effectiveTime(LocalDate.parse("2019-12-27"))
40+
.effectiveTime(PlanMigrationCancelResponse.EffectiveTime.UnionMember2.END_OF_TERM)
4041
.planId("plan_id")
4142
.status(PlanMigrationCancelResponse.Status.NOT_STARTED)
4243
.build()

orb-java-core/src/test/kotlin/com/withorb/api/models/PlanMigrationListPageResponseTest.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package com.withorb.api.models
44

55
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
66
import com.withorb.api.core.jsonMapper
7-
import java.time.LocalDate
87
import org.assertj.core.api.Assertions.assertThat
98
import org.junit.jupiter.api.Test
109

@@ -17,7 +16,9 @@ internal class PlanMigrationListPageResponseTest {
1716
.addData(
1817
PlanMigrationListResponse.builder()
1918
.id("id")
20-
.effectiveTime(LocalDate.parse("2019-12-27"))
19+
.effectiveTime(
20+
PlanMigrationListResponse.EffectiveTime.UnionMember2.END_OF_TERM
21+
)
2122
.planId("plan_id")
2223
.status(PlanMigrationListResponse.Status.NOT_STARTED)
2324
.build()
@@ -31,7 +32,7 @@ internal class PlanMigrationListPageResponseTest {
3132
.containsExactly(
3233
PlanMigrationListResponse.builder()
3334
.id("id")
34-
.effectiveTime(LocalDate.parse("2019-12-27"))
35+
.effectiveTime(PlanMigrationListResponse.EffectiveTime.UnionMember2.END_OF_TERM)
3536
.planId("plan_id")
3637
.status(PlanMigrationListResponse.Status.NOT_STARTED)
3738
.build()
@@ -48,7 +49,9 @@ internal class PlanMigrationListPageResponseTest {
4849
.addData(
4950
PlanMigrationListResponse.builder()
5051
.id("id")
51-
.effectiveTime(LocalDate.parse("2019-12-27"))
52+
.effectiveTime(
53+
PlanMigrationListResponse.EffectiveTime.UnionMember2.END_OF_TERM
54+
)
5255
.planId("plan_id")
5356
.status(PlanMigrationListResponse.Status.NOT_STARTED)
5457
.build()

orb-java-core/src/test/kotlin/com/withorb/api/models/PlanMigrationListResponseTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package com.withorb.api.models
44

55
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
66
import com.withorb.api.core.jsonMapper
7-
import java.time.LocalDate
87
import org.assertj.core.api.Assertions.assertThat
98
import org.junit.jupiter.api.Test
109

@@ -15,15 +14,17 @@ internal class PlanMigrationListResponseTest {
1514
val planMigrationListResponse =
1615
PlanMigrationListResponse.builder()
1716
.id("id")
18-
.effectiveTime(LocalDate.parse("2019-12-27"))
17+
.effectiveTime(PlanMigrationListResponse.EffectiveTime.UnionMember2.END_OF_TERM)
1918
.planId("plan_id")
2019
.status(PlanMigrationListResponse.Status.NOT_STARTED)
2120
.build()
2221

2322
assertThat(planMigrationListResponse.id()).isEqualTo("id")
2423
assertThat(planMigrationListResponse.effectiveTime())
2524
.contains(
26-
PlanMigrationListResponse.EffectiveTime.ofLocalDate(LocalDate.parse("2019-12-27"))
25+
PlanMigrationListResponse.EffectiveTime.ofUnionMember2(
26+
PlanMigrationListResponse.EffectiveTime.UnionMember2.END_OF_TERM
27+
)
2728
)
2829
assertThat(planMigrationListResponse.planId()).isEqualTo("plan_id")
2930
assertThat(planMigrationListResponse.status())
@@ -36,7 +37,7 @@ internal class PlanMigrationListResponseTest {
3637
val planMigrationListResponse =
3738
PlanMigrationListResponse.builder()
3839
.id("id")
39-
.effectiveTime(LocalDate.parse("2019-12-27"))
40+
.effectiveTime(PlanMigrationListResponse.EffectiveTime.UnionMember2.END_OF_TERM)
4041
.planId("plan_id")
4142
.status(PlanMigrationListResponse.Status.NOT_STARTED)
4243
.build()

orb-java-core/src/test/kotlin/com/withorb/api/models/PlanMigrationRetrieveResponseTest.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package com.withorb.api.models
44

55
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
66
import com.withorb.api.core.jsonMapper
7-
import java.time.LocalDate
87
import org.assertj.core.api.Assertions.assertThat
98
import org.junit.jupiter.api.Test
109

@@ -15,16 +14,16 @@ internal class PlanMigrationRetrieveResponseTest {
1514
val planMigrationRetrieveResponse =
1615
PlanMigrationRetrieveResponse.builder()
1716
.id("id")
18-
.effectiveTime(LocalDate.parse("2019-12-27"))
17+
.effectiveTime(PlanMigrationRetrieveResponse.EffectiveTime.UnionMember2.END_OF_TERM)
1918
.planId("plan_id")
2019
.status(PlanMigrationRetrieveResponse.Status.NOT_STARTED)
2120
.build()
2221

2322
assertThat(planMigrationRetrieveResponse.id()).isEqualTo("id")
2423
assertThat(planMigrationRetrieveResponse.effectiveTime())
2524
.contains(
26-
PlanMigrationRetrieveResponse.EffectiveTime.ofLocalDate(
27-
LocalDate.parse("2019-12-27")
25+
PlanMigrationRetrieveResponse.EffectiveTime.ofUnionMember2(
26+
PlanMigrationRetrieveResponse.EffectiveTime.UnionMember2.END_OF_TERM
2827
)
2928
)
3029
assertThat(planMigrationRetrieveResponse.planId()).isEqualTo("plan_id")
@@ -38,7 +37,7 @@ internal class PlanMigrationRetrieveResponseTest {
3837
val planMigrationRetrieveResponse =
3938
PlanMigrationRetrieveResponse.builder()
4039
.id("id")
41-
.effectiveTime(LocalDate.parse("2019-12-27"))
40+
.effectiveTime(PlanMigrationRetrieveResponse.EffectiveTime.UnionMember2.END_OF_TERM)
4241
.planId("plan_id")
4342
.status(PlanMigrationRetrieveResponse.Status.NOT_STARTED)
4443
.build()

orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParamsTest.kt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
1616
.subscriptionId("subscription_id")
1717
.addAdd(
1818
SubscriptionPriceIntervalsParams.Add.builder()
19-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
19+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
2020
.allocationPrice(
2121
NewAllocationPrice.builder()
2222
.amount("10.00")
@@ -43,7 +43,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
4343
)
4444
.canDeferBilling(true)
4545
.addAmountDiscount(0.0)
46-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
46+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
4747
.externalPriceId("external_price_id")
4848
.filter("my_property > 100 AND my_other_property = 'bar'")
4949
.addFixedFeeQuantityTransition(
@@ -116,7 +116,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
116116
)
117117
.addAddAdjustment(
118118
SubscriptionPriceIntervalsParams.AddAdjustment.builder()
119-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
119+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
120120
.adjustment(
121121
NewPercentageDiscount.builder()
122122
.adjustmentType(
@@ -141,7 +141,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
141141
.build()
142142
)
143143
.adjustmentId("h74gfhdjvn7ujokd")
144-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
144+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
145145
.build()
146146
)
147147
.allowInvoiceCreditOrVoid(true)
@@ -151,7 +151,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
151151
.priceIntervalId("sdfs6wdjvn7ujokd")
152152
.billingCycleDay(0L)
153153
.canDeferBilling(true)
154-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
154+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
155155
.filter("my_property > 100 AND my_other_property = 'bar'")
156156
.addFixedFeeQuantityTransition(
157157
SubscriptionPriceIntervalsParams.Edit.FixedFeeQuantityTransition.builder()
@@ -164,15 +164,15 @@ internal class SubscriptionPriceIntervalsParamsTest {
164164
.putAdditionalProperty("foo", JsonValue.from("bar"))
165165
.build()
166166
)
167-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
167+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
168168
.addUsageCustomerId("string")
169169
.build()
170170
)
171171
.addEditAdjustment(
172172
SubscriptionPriceIntervalsParams.EditAdjustment.builder()
173173
.adjustmentIntervalId("sdfs6wdjvn7ujokd")
174-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
175-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
174+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
175+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
176176
.build()
177177
)
178178
.build()
@@ -195,7 +195,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
195195
.subscriptionId("subscription_id")
196196
.addAdd(
197197
SubscriptionPriceIntervalsParams.Add.builder()
198-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
198+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
199199
.allocationPrice(
200200
NewAllocationPrice.builder()
201201
.amount("10.00")
@@ -222,7 +222,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
222222
)
223223
.canDeferBilling(true)
224224
.addAmountDiscount(0.0)
225-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
225+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
226226
.externalPriceId("external_price_id")
227227
.filter("my_property > 100 AND my_other_property = 'bar'")
228228
.addFixedFeeQuantityTransition(
@@ -298,7 +298,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
298298
)
299299
.addAddAdjustment(
300300
SubscriptionPriceIntervalsParams.AddAdjustment.builder()
301-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
301+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
302302
.adjustment(
303303
NewPercentageDiscount.builder()
304304
.adjustmentType(
@@ -323,7 +323,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
323323
.build()
324324
)
325325
.adjustmentId("h74gfhdjvn7ujokd")
326-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
326+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
327327
.build()
328328
)
329329
.allowInvoiceCreditOrVoid(true)
@@ -333,7 +333,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
333333
.priceIntervalId("sdfs6wdjvn7ujokd")
334334
.billingCycleDay(0L)
335335
.canDeferBilling(true)
336-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
336+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
337337
.filter("my_property > 100 AND my_other_property = 'bar'")
338338
.addFixedFeeQuantityTransition(
339339
SubscriptionPriceIntervalsParams.Edit.FixedFeeQuantityTransition
@@ -347,15 +347,15 @@ internal class SubscriptionPriceIntervalsParamsTest {
347347
.putAdditionalProperty("foo", JsonValue.from("bar"))
348348
.build()
349349
)
350-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
350+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
351351
.addUsageCustomerId("string")
352352
.build()
353353
)
354354
.addEditAdjustment(
355355
SubscriptionPriceIntervalsParams.EditAdjustment.builder()
356356
.adjustmentIntervalId("sdfs6wdjvn7ujokd")
357-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
358-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
357+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
358+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
359359
.build()
360360
)
361361
.build()
@@ -365,7 +365,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
365365
assertThat(body.add().getOrNull())
366366
.containsExactly(
367367
SubscriptionPriceIntervalsParams.Add.builder()
368-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
368+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
369369
.allocationPrice(
370370
NewAllocationPrice.builder()
371371
.amount("10.00")
@@ -392,7 +392,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
392392
)
393393
.canDeferBilling(true)
394394
.addAmountDiscount(0.0)
395-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
395+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
396396
.externalPriceId("external_price_id")
397397
.filter("my_property > 100 AND my_other_property = 'bar'")
398398
.addFixedFeeQuantityTransition(
@@ -466,7 +466,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
466466
assertThat(body.addAdjustments().getOrNull())
467467
.containsExactly(
468468
SubscriptionPriceIntervalsParams.AddAdjustment.builder()
469-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
469+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
470470
.adjustment(
471471
NewPercentageDiscount.builder()
472472
.adjustmentType(
@@ -491,7 +491,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
491491
.build()
492492
)
493493
.adjustmentId("h74gfhdjvn7ujokd")
494-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
494+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
495495
.build()
496496
)
497497
assertThat(body.allowInvoiceCreditOrVoid()).contains(true)
@@ -502,7 +502,7 @@ internal class SubscriptionPriceIntervalsParamsTest {
502502
.priceIntervalId("sdfs6wdjvn7ujokd")
503503
.billingCycleDay(0L)
504504
.canDeferBilling(true)
505-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
505+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
506506
.filter("my_property > 100 AND my_other_property = 'bar'")
507507
.addFixedFeeQuantityTransition(
508508
SubscriptionPriceIntervalsParams.Edit.FixedFeeQuantityTransition.builder()
@@ -515,16 +515,16 @@ internal class SubscriptionPriceIntervalsParamsTest {
515515
.putAdditionalProperty("foo", JsonValue.from("bar"))
516516
.build()
517517
)
518-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
518+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
519519
.addUsageCustomerId("string")
520520
.build()
521521
)
522522
assertThat(body.editAdjustments().getOrNull())
523523
.containsExactly(
524524
SubscriptionPriceIntervalsParams.EditAdjustment.builder()
525525
.adjustmentIntervalId("sdfs6wdjvn7ujokd")
526-
.endDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
527-
.startDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
526+
.endDate(BillingCycleRelativeDate.START_OF_TERM)
527+
.startDate(BillingCycleRelativeDate.START_OF_TERM)
528528
.build()
529529
)
530530
}

0 commit comments

Comments
 (0)