14 |
15 | interface AnythingElse {
16 | interface SomethingInside
17 | }
18 |
19 | typealias Arg = (Any) -> Unit
20 |
21 | @Mock(Inherited::class)
22 | interface Inherited: Platform
23 |
24 | interface Platform {
25 | fun Something.equals(): Int
26 | fun Something.doSomething(): Int
27 | fun SomethingElse.doSomethingElse(): List
28 | fun Platform<*>.mutabor(): Int
29 | suspend fun T.doNothing(): Unit where T : Something, T : Comparable
30 | suspend fun T.doNothing(): Unit where T : Any
31 | fun T.doSomethingElse(): L
32 | fun T.doNothingElse(a: R): Unit where T : Something, T : Comparable
33 | fun AnythingElse.SomethingInside.doInside(): Int
34 |
35 | fun iDo()
36 | fun mutabor(x: Platform<*>)
37 | fun doNothingElse(a: Any): Any
38 | fun doSomethingElse(x: SomethingElse)
39 | }
40 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/mixedannotation/Sample.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.mixedannotation
8 |
9 | import tech.antibytes.kmock.Mock
10 | import tech.antibytes.kmock.MockShared
11 | import tech.antibytes.kmock.MockCommon
12 |
13 | @MockCommon(Common::class)
14 | @MockShared(
15 | "sharedTest",
16 | Shared::class
17 | )
18 | @Mock(Platform::class)
19 | interface Platform {
20 | fun doSomething()
21 | }
22 |
23 | interface Shared {
24 | fun doSomething()
25 | }
26 |
27 | interface Common {
28 | fun doSomething()
29 | }
30 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/overloaded/Collision.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.overloaded
8 |
9 | import tech.antibytes.kmock.Mock
10 |
11 | @Mock(Collision::class)
12 | interface Collision {
13 | val foo: Any
14 | var hashCode: Int
15 | fun foo(fuzz: Int, ozz: dynamic): Any
16 | fun foo(fuzz: Any, ozz: Int): Any
17 | fun foo(fuzz: Any, ozz: String): Any
18 | fun foo(fuzz: String, ozz: Any): Any
19 | fun foo(fuzz: String, ozz: Abc): Any
20 | fun foo(fuzz: String, ozz: Scope.Abc): Any
21 | fun foo(fuzz: (Any) -> Unit): Any
22 | fun foo(fuzz: T)
23 | fun foo(fuzz: T)
24 | fun foo(fuzz: T)
25 | fun foo(vararg fuzz: Any): Any
26 | }
27 |
28 | data class Abc(
29 | val value: String
30 | )
31 |
32 | interface Scope {
33 | data class Abc(
34 | val value: String
35 | )
36 | }
37 |
38 | interface LPG
39 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/overloaded/Common.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.overloaded
8 |
9 | import tech.antibytes.kmock.MockCommon
10 |
11 | @MockCommon(Common::class)
12 | interface Common {
13 | val foo: Any
14 | var hashCode: Int
15 | fun foo(fuzz: Int, ozz: dynamic): Any
16 | fun foo(fuzz: Any, ozz: Int): Any
17 | fun foo(fuzz: Any, ozz: String): Any
18 | fun foo(fuzz: String, ozz: Any): Any
19 | fun foo(fuzz: String, ozz: Abc): Any
20 | fun foo(fuzz: (Any) -> Unit): Any
21 | fun foo(fuzz: T)
22 | fun foo(fuzz: T)
23 | fun foo(fuzz: T)
24 | fun foo(vararg fuzz: Any): Any
25 | }
26 |
27 | data class Abc(
28 | val value: String
29 | )
30 |
31 | interface LPG
32 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/overloaded/Platform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.overloaded
8 |
9 | import tech.antibytes.kmock.Mock
10 |
11 | @Mock(Platform::class)
12 | interface Platform> {
13 | val foo: Any
14 | var hashCode: Int
15 | fun foo(fuzz: Int, ozz: Any): Any
16 | fun foo(fuzz: Any?, ozz: Int): Any
17 | fun foo(fuzz: Any, ozz: String): Any
18 | fun foo(fuzz: String, ozz: Any): Any
19 | fun foo(fuzz: String, ozz: Abc): Any
20 | fun foo(fuzz: (Any) -> Unit): Any
21 | fun foo(fuzz: T)
22 | fun > foo(fuzz: T)
23 | fun foo(fuzz: T)
24 | fun foo(fuzz: T?): Any where T : CharSequence?, T : Comparable
25 | fun foo(vararg fuzz: Any): Any
26 | fun foo(arg: Q)
27 | fun foo(arg0: T, arg1: String)
28 | fun foo(arg0: T, arg1: Q) where Q : CharSequence, Q : Comparable?
29 | }
30 |
31 | data class Abc(
32 | val value: String
33 | )
34 |
35 | interface LPG
36 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/overloaded/Shared.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.overloaded
8 |
9 | import tech.antibytes.kmock.MockShared
10 |
11 | @MockShared(
12 | "sharedTest",
13 | Shared::class
14 | )
15 | interface Shared {
16 | val foo: Any
17 | var hashCode: Int
18 | fun foo(fuzz: Int, ozz: Any): Any
19 | fun foo(fuzz: Any, ozz: Int): Any
20 | fun foo(fuzz: Any, ozz: String): Any
21 | fun foo(fuzz: String, ozz: Any): Any
22 | fun foo(fuzz: String, ozz: Abc): Any
23 | fun foo(fuzz: (Any) -> Unit): Any
24 | fun foo(fuzz: T)
25 | fun foo(fuzz: T)
26 | fun foo(fuzz: T)
27 | fun foo(fuzz: T)
28 | fun foo(fuzz: Array)
29 | }
30 |
31 | data class Abc(
32 | val value: String
33 | )
34 |
35 | interface LPG
36 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/property/Common.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.property
8 |
9 | import mock.template.async.Common
10 | import tech.antibytes.kmock.MockCommon
11 |
12 | @MockCommon(Common::class)
13 | interface Common {
14 | val foo: String
15 | val bar: Int
16 | get() = foo.length
17 |
18 | var buzz: Any
19 | }
20 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/property/Platform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.property
8 |
9 | import mock.template.async.Platform
10 | import tech.antibytes.kmock.Mock
11 |
12 | @Mock(Platform::class)
13 | interface Platform {
14 | val foo: String
15 | val bar: Int
16 | get() = foo.length
17 |
18 | var buzz: Any
19 | val boo: Enum<*>
20 | }
21 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/property/Shared.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.property
8 |
9 | import mock.template.async.Shared
10 | import tech.antibytes.kmock.MockShared
11 |
12 | @MockShared("sharedTest", Shared::class)
13 | interface Shared {
14 | val foo: String
15 | val bar: Int
16 | get() = foo.length
17 |
18 | val enum: Enum<*>
19 | var buzz: Any
20 | }
21 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/propertyreceiver/Common.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.propertyreceiver
8 |
9 | import tech.antibytes.kmock.MockCommon
10 |
11 | interface Something
12 |
13 | interface SomethingElse
14 |
15 | interface AnythingElse {
16 | interface SomethingInside
17 | }
18 |
19 | @MockCommon(Common::class)
20 | interface Common {
21 | var Something.thing: Int
22 | val SomethingElse.things: List
23 | var Common<*>.extension: Int
24 | var T.nothing: T where T : Something, T : Comparable
25 | var L.otherThing: String
26 | var T.nothing: L
27 | val myThing: String
28 | val AnythingElse.SomethingInside.inside: Int
29 |
30 | fun getOtherThing()
31 | }
32 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/propertyreceiver/Platform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.propertyreceiver
8 |
9 | import tech.antibytes.kmock.Mock
10 |
11 | interface Something
12 |
13 | interface SomethingElse
14 |
15 | interface AnythingElse {
16 | interface SomethingInside
17 | }
18 |
19 | @Mock(Platform::class)
20 | interface Platform {
21 | var Something.thing: Int
22 | val SomethingElse.things: List
23 | var Platform<*>.extension: Int
24 | var T.nothing: T where T : Something, T : Comparable
25 | var L.otherThing: String
26 | var T.nothing: L
27 | var T.othing: L?
28 | val myThing: String
29 | val AnythingElse.SomethingInside.inside: Int
30 |
31 | fun getOtherThing()
32 | }
33 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/propertyreceiver/Relaxed.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.propertyreceiver
8 |
9 | import tech.antibytes.kmock.Mock
10 | import tech.antibytes.kmock.Relaxer
11 |
12 | interface Something
13 |
14 | interface SomethingElse
15 |
16 | interface AnythingElse {
17 | interface SomethingInside
18 | }
19 |
20 | @Relaxer
21 | internal inline fun relaxed(id: String): T {
22 | return id as T
23 | }
24 |
25 | @Mock(Relaxed::class)
26 | interface Relaxed {
27 | var Something.thing: Int
28 | val SomethingElse.things: List
29 | var Relaxed<*>.extension: Int
30 | var T.nothing: T where T : Something, T : Comparable
31 | var L.otherThing: String
32 | var L.nextThing: L
33 | var T.nothing: L
34 | var T.otherThing: T
35 | val myThing: String
36 | val AnythingElse.SomethingInside.inside: Int
37 |
38 | fun getOtherThing()
39 | }
40 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/propertyreceiver/Spied.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.propertyreceiver
8 |
9 | import tech.antibytes.kmock.Mock
10 |
11 | interface Something
12 |
13 | interface SomethingElse
14 |
15 | interface AnythingElse {
16 | interface SomethingInside
17 | }
18 |
19 | @Mock(Spied::class)
20 | interface Spied {
21 | var Something.thing: Int
22 | val SomethingElse.things: List
23 | var Spied<*>.extension: Int
24 | var T.nothing: T where T : Something, T : Comparable
25 | var L.otherThing: String
26 | var T.nothing: L
27 | val myThing: String
28 | val AnythingElse.SomethingInside.inside: Int
29 |
30 | fun getOtherThing()
31 | }
32 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/propertyreceiver/SuperType.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.propertyreceiver
8 |
9 | import tech.antibytes.kmock.Mock
10 |
11 | interface Something
12 |
13 | interface SomethingElse
14 |
15 | interface AnythingElse {
16 | interface SomethingInside
17 | }
18 |
19 | @Mock(Inherited::class)
20 | interface Inherited : Platform
21 |
22 | interface Platform {
23 | var Something.thing: Int
24 | val SomethingElse.things: List
25 | var Platform<*>.extension: Int
26 | var T.nothing: T where T : Something, T : Comparable
27 | var L.otherThing: String
28 | var T.nothing: L
29 | val myThing: String
30 | val AnythingElse.SomethingInside.inside: Int
31 |
32 | fun getOtherThing()
33 | }
34 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/relaxed/Common.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.relaxed
8 |
9 | import tech.antibytes.kmock.MockCommon
10 | import tech.antibytes.kmock.Relaxer
11 |
12 | @Relaxer
13 | internal inline fun relaxed(id: String): T {
14 | return id as T
15 | }
16 |
17 | @MockCommon(Common::class)
18 | interface Common where L : Any, L : Comparable, K : Any {
19 | var template: L
20 | val buzz: String
21 |
22 | fun foo(payload: Any): String
23 | fun foo(): T
24 | fun foo(payload: String): L
25 | fun fooBar(payload: T)
26 | fun fooBar(): T where T : K?
27 | fun oo(vararg payload: Any): String
28 | suspend fun bar(payload: Any): String
29 | suspend fun ar(vararg payload: Any): String
30 | fun buzz()
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/relaxed/Platform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.relaxed
8 |
9 | import tech.antibytes.kmock.Mock
10 | import tech.antibytes.kmock.Relaxer
11 |
12 | @Relaxer
13 | internal inline fun relaxed(id: String): T {
14 | return id as T
15 | }
16 |
17 | @Mock(Platform::class)
18 | interface Platform {
19 | val buzz: String
20 |
21 | fun foo(payload: Any): String
22 | fun oo(vararg payload: Any): String
23 | suspend fun bar(payload: Any): String
24 | suspend fun ar(vararg payload: Any): String
25 | fun buzz()
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/relaxed/Shared.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.relaxed
8 |
9 | import tech.antibytes.kmock.MockShared
10 | import tech.antibytes.kmock.Relaxer
11 |
12 | @Relaxer
13 | internal inline fun relaxed(id: String): T {
14 | return id as T
15 | }
16 |
17 | @MockShared(
18 | "sharedTest",
19 | Shared::class
20 | )
21 | interface Shared {
22 | val buzz: String
23 | val uzz: T
24 |
25 | fun foo(payload: Any): String
26 | suspend fun bar(payload: Any): String
27 | fun buzz()
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/renamed/Common.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.renamed
8 |
9 | import tech.antibytes.kmock.MockCommon
10 |
11 | @MockCommon(Common::class)
12 | interface Common where L : Any, L : Comparable, K : Any {
13 | var template: L
14 | val ozz: Int
15 |
16 | fun bar(arg0: Int): Any
17 | suspend fun buzz(arg0: String): L
18 | }
19 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/renamed/Platform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.renamed
8 |
9 | import tech.antibytes.kmock.Mock
10 |
11 | @Mock(Platform::class)
12 | interface Platform where L : Any, L : Comparable, K : Any {
13 | var template: L
14 | val ozz: Int
15 |
16 | fun bar(arg0: Int): Any
17 | suspend fun buzz(arg0: String): L
18 | }
19 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/renamed/Shared.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.renamed
8 |
9 | import tech.antibytes.kmock.MockShared
10 |
11 | @MockShared(
12 | "sharedTest",
13 | Shared::class
14 | )
15 | interface Shared where L : Any, L : Comparable, K : Any {
16 | var template: L
17 | val ozz: Int
18 |
19 | fun bar(arg0: Int): Any
20 | suspend fun buzz(arg0: String): L
21 | }
22 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/spy/Common.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.spy
8 |
9 | import tech.antibytes.kmock.MockCommon
10 |
11 | @MockCommon(Common::class)
12 | interface Common where L : Any, L : Comparable, K : Any {
13 | var template: L
14 | val ozz: Int
15 |
16 | fun foo(payload: T)
17 | fun oo(vararg payload: T)
18 | fun bar(arg0: Int): Any
19 | fun ar(vararg arg0: Int): Any
20 | suspend fun buzz(arg0: String): L
21 | suspend fun uzz(vararg arg0: String): L
22 | fun izz(): T where T : CharSequence, T : Comparable>>
23 | }
24 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/spy/Platform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.spy
8 |
9 | import tech.antibytes.kmock.Mock
10 |
11 | @Mock(Platform::class)
12 | interface Platform where L : Any, L : Comparable, K : Any {
13 | var template: L
14 | val ozz: Int
15 |
16 | fun foo(payload: T)
17 | fun foo(vararg payload: T)
18 | fun bar(arg0: Int): Any
19 | fun bar(vararg arg0: Int): Any
20 | suspend fun buzz(arg0: String): L
21 | suspend fun buzz(vararg arg0: String): L
22 | fun izz(): T where T : CharSequence, T : Comparable>>
23 | }
24 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/spy/Relaxed.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.spy
8 |
9 | import tech.antibytes.kmock.Mock
10 | import tech.antibytes.kmock.Relaxer
11 |
12 | @Relaxer
13 | internal inline fun relaxed(id: String): T {
14 | return Any() as T
15 | }
16 |
17 | @Mock(Relaxed::class)
18 | interface Relaxed where L : Any, L : Comparable, K : Any {
19 | var template: L
20 | val ozz: Int
21 |
22 | fun foo(payload: T)
23 | fun bar(arg0: Int): Any
24 | suspend fun buzz(arg0: String): L
25 | fun izz(): T where T : CharSequence, T : Comparable>>
26 | }
27 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/spy/Shared.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.spy
8 |
9 | import tech.antibytes.kmock.MockShared
10 |
11 | @MockShared(
12 | "sharedTest",
13 | Shared::class
14 | )
15 | interface Shared where L : Any, L : Comparable, K : Any {
16 | var template: L
17 | val ozz: Int
18 |
19 | fun foo(payload: T)
20 | fun bar(arg0: Int): Any
21 | suspend fun buzz(arg0: String): L
22 | }
23 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/sync/Common.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.sync
8 |
9 | import mock.template.async.Common
10 | import tech.antibytes.kmock.MockCommon
11 |
12 | @MockCommon(Common::class)
13 | interface Common {
14 | fun foo(fuzz: Int, ozz: Any): Any
15 |
16 | fun bar(buzz: Int, bozz: Any): Any = bozz
17 |
18 | fun ozz(vararg buzz: Int): Any
19 |
20 | fun izz(vararg buzz: Any): Any
21 | }
22 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/sync/Platform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.sync
8 |
9 | import mock.template.async.Platform
10 | import tech.antibytes.kmock.Mock
11 |
12 | @Mock(Platform::class)
13 | interface Platform {
14 | fun foo(fuzz: Int, ozz: Any): dynamic
15 |
16 | fun bar(buzz: Int, bozz: Any): Any = bozz
17 |
18 | fun ozz(vararg buzz: Int): Any
19 |
20 | fun izz(vararg buzz: Any): Any
21 | }
22 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/sync/Shared.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.sync
8 |
9 | import mock.template.async.Shared
10 | import tech.antibytes.kmock.MockShared
11 |
12 | @MockShared("shared", Shared::class)
13 | interface Shared {
14 | fun foo(fuzz: Int, ozz: Any): Any
15 |
16 | fun bar(buzz: Int, bozz: Any): Any = bozz
17 |
18 | fun nol(buzz: Enum<*>): Any = buzz
19 | }
20 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/typealiaz/Common.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.typealiaz
8 |
9 | import tech.antibytes.kmock.MockCommon
10 |
11 | typealias Alias0 = (Any) -> Unit
12 | typealias Alias1 = (Any) -> Any
13 |
14 | @MockCommon(Common::class)
15 | interface Common {
16 | fun doSomething(
17 | arg0: Any,
18 | arg1: Alias0,
19 | arg2: Alias1
20 | ): Any
21 | }
22 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/typealiaz/Receiver.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.typealiaz
8 |
9 | import tech.antibytes.kmock.Mock
10 |
11 | interface GenericReceiver
12 |
13 | typealias Alias11 = (Any) -> Unit
14 | typealias Alias2 = (Any) -> Any
15 | typealias Alias3 = GenericReceiver
16 |
17 | @Mock(Receiver::class)
18 | interface Receiver {
19 | val List>.any: Int
20 | var > T.member: T
21 |
22 | fun Alias11.doSomething(
23 | arg0: Alias3,
24 | arg1: Alias2,
25 | arg2: Alias11
26 | ): Any
27 |
28 | fun > Alias3.doAnythingElse(
29 | arg1: Alias11,
30 | arg2: Alias2
31 | )
32 |
33 | fun doAnythingElse(arg1: Alias3>)
34 |
35 | fun , X : Comparable> T.doOtherThing(arg1: Alias3, arg0: X)
36 |
37 | fun L.doSomethingElse(
38 | arg1: T,
39 | arg2: L
40 | )
41 |
42 | fun , K> T.doSomethingElse(arg1: T)
43 |
44 | fun run(arg: L): Alias11
45 | }
46 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/mock/template/typealiaz/Shared.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved.
3 | *
4 | * Use of this source code is governed by Apache v2.0
5 | */
6 |
7 | package mock.template.typealiaz
8 |
9 | import tech.antibytes.kmock.MockShared
10 |
11 | typealias Alias00 = (Any) -> Unit
12 | typealias Alias01 = (Any) -> Any
13 |
14 | @MockShared("sharedTest", Shared::class)
15 | interface Shared {
16 | fun doSomething(
17 | arg0: Any,
18 | arg1: Alias00,
19 | arg2: Alias01
20 | ): Any
21 | }
22 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/multi/expected/common/RegularActualFactory.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION")
2 |
3 | package multi
4 |
5 | import kotlin.Boolean
6 | import kotlin.Suppress
7 | import tech.antibytes.kmock.KMockContract
8 |
9 | private inline fun getMockInstance(
10 | spyOn: SpyOn?,
11 | collector: KMockContract.Collector,
12 | relaxed: Boolean,
13 | relaxUnitFun: Boolean,
14 | freeze: Boolean,
15 | ): Mock = when (Mock::class) {
16 | multi.CommonMultiMock::class -> multi.CommonMultiMock>(collector =
17 | collector, relaxUnitFun = relaxUnitFun, freeze = freeze) as Mock
18 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.")
19 | }
20 |
21 | internal actual inline fun kmock(
22 | collector: KMockContract.Collector,
23 | relaxed: Boolean,
24 | relaxUnitFun: Boolean,
25 | freeze: Boolean,
26 | ): Mock = getMockInstance(
27 | spyOn = null,
28 | collector = collector,
29 | relaxed = relaxed,
30 | relaxUnitFun = relaxUnitFun,
31 | freeze = freeze,
32 | )
33 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/multi/expected/common/RegularExpectFactory.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION")
2 |
3 | package multi
4 |
5 | import kotlin.Boolean
6 | import kotlin.Suppress
7 | import tech.antibytes.kmock.KMockContract
8 | import tech.antibytes.kmock.proxy.NoopCollector
9 |
10 | internal expect inline fun kmock(
11 | collector: KMockContract.Collector = NoopCollector,
12 | relaxed: Boolean = false,
13 | relaxUnitFun: Boolean = false,
14 | freeze: Boolean = false,
15 | ): Mock
16 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/multi/expected/common/RegularInterface.kt:
--------------------------------------------------------------------------------
1 | package multi
2 |
3 | import multi.template.common.CommonContractRegular
4 | import multi.template.common.Regular1
5 | import multi.template.common.nested.Regular3
6 | import tech.antibytes.kmock.MockCommon
7 |
8 | @MockCommon(CommonMulti::class)
9 | private interface CommonMulti : Regular1, CommonContractRegular.Regular2, Regular3
10 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/multi/expected/common/SpiedRegularExpectFactory.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION")
2 |
3 | package multi
4 |
5 | import kotlin.Boolean
6 | import kotlin.Suppress
7 | import kotlin.reflect.KClass
8 | import multi.template.common.CommonContractRegular
9 | import multi.template.common.Regular1
10 | import multi.template.common.nested.Regular3
11 | import tech.antibytes.kmock.KMockContract
12 | import tech.antibytes.kmock.proxy.NoopCollector
13 |
14 | internal expect inline fun kmock(
15 | collector: KMockContract.Collector = NoopCollector,
16 | relaxed: Boolean = false,
17 | relaxUnitFun: Boolean = false,
18 | freeze: Boolean = false,
19 | ): Mock
20 |
21 | internal expect inline fun kspy(
22 | spyOn: SpyOn,
23 | collector: KMockContract.Collector = NoopCollector,
24 | freeze: Boolean = false,
25 | templateType0: KClass,
26 | templateType1: KClass,
27 | templateType2: KClass,
28 | ): Mock where SpyOn : Regular1, SpyOn : CommonContractRegular.Regular2, SpyOn : Regular3
29 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/multi/expected/commonGeneric/GenericInterface.kt:
--------------------------------------------------------------------------------
1 | package multi
2 |
3 | import kotlin.Any
4 | import kotlin.Comparable
5 | import multi.template.commonGeneric.Generic1
6 | import multi.template.commonGeneric.GenericCommonContract
7 | import multi.template.commonGeneric.nested.Generic2
8 | import tech.antibytes.kmock.MockCommon
9 |
10 | @MockCommon(CommonGenericMulti::class)
11 | private interface CommonGenericMulti :
13 | Generic1,
14 | Generic2,
15 | GenericCommonContract.Generic3 where
16 | KMockTypeParameter1 : Any, KMockTypeParameter1 : Comparable,
17 | KMockTypeParameter3 : Any, KMockTypeParameter3 : Comparable
18 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/multi/expected/commonGeneric/SpiedGenericInterface.kt:
--------------------------------------------------------------------------------
1 | package multi
2 |
3 | import kotlin.Any
4 | import kotlin.Comparable
5 | import multi.template.commonGeneric.Generic1
6 | import multi.template.commonGeneric.GenericCommonContract
7 | import multi.template.commonGeneric.nested.Generic2
8 | import tech.antibytes.kmock.MockCommon
9 |
10 | @MockCommon(CommonGenericMulti::class)
11 | private interface CommonGenericMulti :
13 | Generic1,
14 | Generic2,
15 | GenericCommonContract.Generic3 where
16 | KMockTypeParameter1 : Any, KMockTypeParameter1 : Comparable,
17 | KMockTypeParameter3 : Any, KMockTypeParameter3 : Comparable
18 |
--------------------------------------------------------------------------------
/kmock-processor/src/test/resources/multi/expected/custom/RegularActualFactory.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION")
2 |
3 | package multi
4 |
5 | import kotlin.Boolean
6 | import kotlin.Suppress
7 | import tech.antibytes.kmock.KMockContract
8 |
9 | private inline fun getMockInstance(
10 | spyOn: SpyOn?,
11 | collector: KMockContract.Collector,
12 | relaxed: Boolean,
13 | relaxUnitFun: Boolean,
14 | freeze: Boolean,
15 | ): Mock = when (Mock::class) {
16 | multi.SharedMultiMock::class -> multi.SharedMultiMock>(collector =
17 | collector, relaxUnitFun = relaxUnitFun, freeze = freeze) as Mock
18 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.")
19 | }
20 |
21 | internal actual inline fun