Tag Archives: Testing

Unit testing async network calls in Swift

Asynchronous unit testing in Swift You have probably written code with a NSURLSessionDataTask that notifies a delegate when the data is received. How do you write a unit test for that? Introduction The Test Summary Resources Introduction Let’s stub out some typical code. Here a an API function that takes perhaps a REST endpoint and […]

Posted in iOS, Swift | Also tagged , | Leave a comment

Spring Test Framework CoC suggestion

Let’s say you’re using JUnit 4 and the Spring Testing classes (the 2.5+ versions) for your unit tests. You can specify parameters as shown in the TransactionConfiguration annotation as shown in this example. But you can also get away with leaving them out in a nod to the uberhip Convention Over Configuration gods as shown […]

Posted in Spring Framework, Testing | Also tagged , | 1 Response

Spring and Transactions

I’ve been taking a legacy codebase, putting testing in place and refactoring. For DB access I retrofitted the persistence classes to be injected via Spring with a DataSource instead of looking them up via JNDI. IN my Spring context I defined a PlatformTransactionManager. 1 2 3 4 5 6 7 8 9 10 <bean id="dataSource" […]

Posted in DB, Spring Framework, Testing | Also tagged | Leave a comment