View DBHelper.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
package jms.load; | |
import oracle.jdbc.pool.OracleDataSource; | |
import oracle.ucp.jdbc.PoolDataSource; | |
import oracle.ucp.jdbc.PoolDataSourceFactory; | |
import org.apache.activemq.ActiveMQConnectionFactory; | |
import org.apache.activemq.pool.PooledConnectionFactory; | |
import javax.jms.QueueConnectionFactory; | |
import javax.sql.DataSource; |
View Kotlin.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
class CollateralArrangement(val trackingNumber: Int) | |
class Facility(val collateralArrangement: List<CollateralArrangement>) | |
class CollateralArrangementTuple(val collateralArrangement: CollateralArrangement, val facility: Facility) | |
val facilities = listOf(Facility(collateralArrangement = listOf(CollateralArrangement(1), CollateralArrangement(2), CollateralArrangement(3)))) | |
// with Kotlin, results in: Map<Int, CollateralArrangementTuple> | |
val map = facilities.flatMap { facility -> facility.collateralArrangement.map { Pair(it.trackingNumber, CollateralArrangementTuple(it, facility)) } }.toMap() |
View GraphQLJavaToolsDataLoader.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
class ParentType(val id: Long) | |
class ChildType | |
class ChildTypeBatchApi { | |
fun load(keys: List<Long>): List<ChildType> = mutableListOf() | |
} | |
val childTypeBatchApi = ChildTypeBatchApi() | |
// Example BatchLoader | |
var batchLoader: BatchLoader<Long, ChildType> = BatchLoader { keys -> |
View AddressBookTest.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
@RunWith(JMockit.class) | |
public class AddressBookTest { | |
@Injectable | |
private AddressBookRepository addressBookRepository; | |
@Tested | |
private AddressBook addressBook; | |
@Test | |
public void retrieveAddressByIdTest() { |
View AddressBookTest.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
@RunWith(JMockit::class) | |
class AddressBookTest { | |
@Injectable | |
private lateinit var addressBookRepository: AddressBookRepository | |
@Tested | |
private lateinit var addressBook: AddressBook | |
@Test | |
fun retrieveAddressByIdTest() { |
View AddressBook.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
class AddressBook { | |
private AddressBookRepository repository; | |
public AddressBook(AddressBookRepository repository) { | |
this.repository = repository; | |
} | |
public Address getAddressById(int i) { | |
return repository.findById(i); | |
} |
View JMockitExpectations.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
object : Expectations() { | |
init { | |
// Instruct mocks | |
} | |
} |
View gist:7b2e06340350cbed06ce13e4c9543e76
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
expectations { | |
// Instruct mocks | |
} |
View JMockitExtentions.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
inline fun expectations(crossinline block: KExpectations.() -> Unit) { | |
object : KExpectations() { | |
init { | |
block() | |
} | |
} | |
} | |
inline fun verifications(crossinline block: KVerifications.() -> Unit) { | |
object : KVerifications() { |
View AddressBookTestRevamped.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
@RunWith(JMockit::class) | |
class AddressBookTestKt { | |
@Injectable | |
private lateinit var addressBookRepository: AddressBookRepository | |
@Tested | |
private lateinit var addressBook: AddressBook | |
@Test | |
fun retrieveAddressByIdTest() { |
OlderNewer