addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Re: [ljc] Spring to compliment EJB 3.x

From: Ged B.
Sent on: Tuesday, June 4, 2013, 1:44 PM
That may be oversimplifying things.

With CDI the code being written becomes must more declarative in nature.  The Java without augmentation is nothing but an empty shell.  All of the behaviour is injected.

After injection their is still a code unit, but it no longer follows the traditional Java unit definition.

Hmmm.  I need to put more thought into this.


On 4 June[masked]:56, Neil Bartlett <[address removed]> wrote:
+1

If your "unit tests" need to run in a container (any kind of container, including the Spring framework) then they ain't unit tests.


On Mon, Jun 3, 2013 at 9:32 AM, Kevin Wright <[address removed]> wrote:
Is it truly unit testing that you're after?

Spring's own guidelines state that you should never have any spring-specific constructs in your own code, that it sits on the outside and injects references.

You can (and should) create your own instances in unit testing and manually inject the minimal number of dependencies to get the thing tested.  Constructor-injection is good here, as it allows you to create immutable objects, which scale better and are far easier to test.  Having too many such dependencies to inject is a code smell, and you have a bigger problem on your hands.

What you're asking sounds a lot more like integration testing to me





On 31 May[masked]:10, Jon Hatfield <[address removed]> wrote:
Hi all,

The debate between spring and EJB continues but I would like to combine them. I like spring bean testing because it is simple and does not require mocking or elaborate config like arquillian. However, for an enterprise system I prefer to use a 'complete' app server like jboss because to me it is cleaner than bolting on jms, transaction managers etc. onto tomcat so that spring can be enterprise.

I have got 2 questions here:

1. Does anyone know how to use spring (or similar) for full junit coverage whilst using EJB and jboss on the back end? Perhaps a separate instance of jboss, just for junit, that has to be running when you run the tests?

2. Has anyone tried other combinations of spring with EJB together? My last company used spring MVC with EJB back end, for example.

Another strength of spring is its simple CDI, but ee 6 looks to have caught up (and you can write annotations yourself to do CDI). However I think there is a gap regarding testing in java ee, so I basically want to leverage testing from spring, but I am also interested in other ways to combine the strengths of both frameworks.

Regards,
Jon

Sent from my HTC





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jon Hatfield ([address removed]) from LJC - London Java Community.
To learn more about Jon Hatfield, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]



--
Kevin Wright
mail: [address removed]
gtalk / msn : [address removed]
vibe / skype: kev.lee.wright
steam: kev_lee_wright

"My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Kevin Wright ([address removed]) from LJC - London Java Community.
To learn more about Kevin Wright, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Neil Bartlett ([address removed]) from LJC - London Java Community.
To learn more about Neil Bartlett, visit his/her member profile

People in this
group are also in: