author profile image

Matt Reid

Solo Entrepreneur | Lead Software Architect

Mockito provides a nice way to capture the arguments passed into your mocks. This works a treat when verifying the contents of an email send via a mocked JavaMailSender ArgumentCaptor messageCapture = ArgumentCaptor.forClass(Multipart.class); Mockito.verify(mockMimeMessage).setContent(messageCapture.capture()); //this is a multipart message so read all parts and verify StringWriter writer = new StringWriter();...

Just a quick one that I forgot to note down. If you want to count rows using a hibernate query, here is the bit of magic that you need. return (Number) session.createCriteria(Bananas.class).setProjection(Projections.rowCount()).uniqueResult();  

getWebView().setWebViewClient(new TwitterOAuthWebViewClient());I have been using the excellent Spring Android for interaction with an api for an app I am developing at work. The spring-android-showcase project has been excellent in helping me breeze through development. I easily implemented Facebook connections using the FacebookWebOAuthActivity One issue I found when implementing the TwitterWebOAuthActivity was that...

I got this tip from a wonderful presentation by Eric Burke of square but it works so well I needed to share it. Android has no standard depressed animation for ImageButton’s so it requires a bit of hacking around to get a similar effect. This can also be used to...