-
-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefano Lucka
committed
Sep 16, 2022
1 parent
ef2fc84
commit db96233
Showing
3 changed files
with
209 additions
and
3 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
...it5spring/src/test/java/au/com/dius/pact/provider/spring/junit5/PactBrokerLoaderTest.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,76 @@ | ||
package au.com.dius.pact.provider.spring.junit5; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerConsumerVersionSelectors; | ||
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader; | ||
import au.com.dius.pact.provider.junitsupport.loader.SelectorBuilder; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
public class PactBrokerLoaderTest { | ||
|
||
@Test | ||
void test1() { | ||
assertNotNull(PactBrokerLoader.testClassHasSelectorsMethod(Test1.class)); | ||
} | ||
|
||
@Test | ||
void test2() { | ||
assertThrows(IllegalAccessException.class, () -> PactBrokerLoader.testClassHasSelectorsMethod(Test2.class)); | ||
} | ||
|
||
@Test | ||
void test3() { | ||
assertThrows(IllegalAccessException.class, () -> PactBrokerLoader.testClassHasSelectorsMethod(Test3.class)); | ||
} | ||
|
||
@Test | ||
void test4() { | ||
assertThrows(IllegalAccessException.class, () -> PactBrokerLoader.testClassHasSelectorsMethod(Test4.class)); | ||
} | ||
|
||
@Test | ||
void test5() { | ||
assertNotNull(PactBrokerLoader.testClassHasSelectorsMethod(Test5.class)); | ||
} | ||
|
||
class Test1 { | ||
@PactBrokerConsumerVersionSelectors | ||
public static SelectorBuilder cvs() { | ||
return new SelectorBuilder(); | ||
} | ||
} | ||
class Test2 { | ||
@PactBrokerConsumerVersionSelectors | ||
static SelectorBuilder cvs() { | ||
return new SelectorBuilder(); | ||
} | ||
} | ||
|
||
class Test3 { | ||
@PactBrokerConsumerVersionSelectors | ||
private static SelectorBuilder cvs() { | ||
return new SelectorBuilder(); | ||
} | ||
} | ||
|
||
class Test4 extends Test4Super {} | ||
|
||
class Test4Super { | ||
@PactBrokerConsumerVersionSelectors | ||
protected static SelectorBuilder cvs() { | ||
return new SelectorBuilder(); | ||
} | ||
} | ||
|
||
class Test5 extends Test5Super {} | ||
|
||
class Test5Super { | ||
@PactBrokerConsumerVersionSelectors | ||
public static SelectorBuilder cvs() { | ||
return new SelectorBuilder(); | ||
} | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
...5spring/src/test/kotlin/au/com/dius/pact/provider/spring/junit5/PactBrokerLoaderKtTest.kt
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,98 @@ | ||
package au.com.dius.pact.provider.spring.junit5 | ||
|
||
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerConsumerVersionSelectors | ||
import au.com.dius.pact.provider.junitsupport.loader.PactBrokerLoader.Companion.testClassHasSelectorsMethod | ||
import au.com.dius.pact.provider.junitsupport.loader.SelectorBuilder | ||
import org.junit.jupiter.api.Assertions.assertNotNull | ||
import org.junit.jupiter.api.Assertions.assertThrows | ||
import org.junit.jupiter.api.Test | ||
|
||
class PactBrokerLoaderKtTest { | ||
|
||
@Test | ||
fun test1() { | ||
assertNotNull(testClassHasSelectorsMethod(Test1::class.java)) | ||
} | ||
|
||
@Test | ||
fun test2() { | ||
assertThrows(IllegalAccessException::class.java) { | ||
testClassHasSelectorsMethod(Test2::class.java) | ||
} | ||
} | ||
|
||
@Test | ||
fun test3() { | ||
assertThrows(IllegalAccessException::class.java) { | ||
testClassHasSelectorsMethod(Test3::class.java) | ||
} | ||
} | ||
|
||
@Test | ||
fun test4() { | ||
assertThrows(IllegalAccessException::class.java) { | ||
testClassHasSelectorsMethod(Test4::class.java) | ||
} | ||
} | ||
|
||
@Test | ||
fun test5() { | ||
assertNotNull(testClassHasSelectorsMethod(Test5::class.java)) | ||
} | ||
|
||
@Test | ||
fun test6() { | ||
assertNotNull(testClassHasSelectorsMethod(Test6::class.java)) | ||
} | ||
|
||
class Test1 { | ||
@PactBrokerConsumerVersionSelectors | ||
fun cvs(): SelectorBuilder { | ||
return SelectorBuilder() | ||
} | ||
} | ||
|
||
class Test2 { | ||
@PactBrokerConsumerVersionSelectors | ||
private fun cvs(): SelectorBuilder { | ||
return SelectorBuilder() | ||
} | ||
} | ||
|
||
class Test3 { | ||
@PactBrokerConsumerVersionSelectors | ||
private fun cvs(): SelectorBuilder { | ||
return SelectorBuilder() | ||
} | ||
} | ||
|
||
class Test4 : Test4Super() | ||
|
||
abstract class Test4Super { | ||
|
||
@PactBrokerConsumerVersionSelectors | ||
protected fun cvs(): SelectorBuilder { | ||
return SelectorBuilder() | ||
} | ||
} | ||
|
||
class Test5 : Test5Super() | ||
|
||
abstract class Test5Super { | ||
@PactBrokerConsumerVersionSelectors | ||
fun cvs(): SelectorBuilder { | ||
return SelectorBuilder() | ||
} | ||
} | ||
|
||
class Test6 : Test6Super() | ||
|
||
abstract class Test6Super() { | ||
companion object { | ||
@PactBrokerConsumerVersionSelectors | ||
fun cvs(): SelectorBuilder { | ||
return SelectorBuilder() | ||
} | ||
} | ||
} | ||
} |
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