Trying to use mockito with Arquillian but having some problems - mockito

I was tring to use mockito with arquillian.
I used with simple JUnit and it runs fine although i am trying to figure out the deployment for arquillian which is where i think the problem is !!!
Can anyone help me to figure out ?
Thank you.
Here is the link to my junit file and pom file

When you're using external libraries in your tests, you must make sure those libraries have been added to the microdeployment.

Related

Why do we use JUnit with Cucumber rather using TestNg

I can see in many cases that people prefer Junit rather than TestNg when they are integrated with the cucumber framework but I never understand the reason and benefit of using JUnit over TestNG.
If anyone knows the exact reason please help me to understand. Also, most of the tutorial videos are using Junit.

Cucumber+TestNG and Cucumber+JUNIT comparison

Can anyone please help me in understanding what is difference or advantages of using Cucumber+TestNG over Cucumber+Junit ?
TestNG provides more Annotations Like #BeforeSuite .
TestNG it self provides support for Junit.
With Latest upgrade of cucumber(4.0) Cucumber - TestNg provides Parallel Execution at Scenario Level where as Junit provides at Feature level.
TestNG and Junit are just a unit testing frameworks, when you use Cucumber with Junit you can use Junit Annotation/Assertions in step definition file and similarly when you use Cucumber with TestNG you can use TestNG Annotation/Assertions in step definition file.
Actually in both cases you would be writing the Test Steps using selenium and probably will use the classes inside JUnit or TestNG to run the cucumber Feature file.
As per my knowledge the only place I used such file was the when I'm creating the TestRunner.java class.
It's much easier to do with JUnit since you just have to import org.junit.runner.RunWith But if you are using TestNG you'll need to use dataProviders and go on a bit more complex path to create the TestRunner Class
Other than that there won't be any other differences since you will be using cucumber features for testing.
Due to the above mentioned advantage, I recommend to use JUnit + Cucumber + Selenium for your scripting
I tried both but decided for JUNIT 4.12 (JUNIT 5 does not seem to work with cucumber yet). It has all that you need. But i have to test that parallel thing in Test NG i guess. ;)
I use Cucumber in a Spring Boot Project and therefore JUNIT did not cause any problems for me. I can hand over a browser instance over multiple classes here (#Autowired) and this makes my code so much more modularizable.
You may have more annotation-options with Test NG but somehow i have the feeling that more people work with JUnit, so you have more support and a bigger community here.

Spring-boot-devtools not restarted when change groovy-files

In my project I work with spring-boot and groovy. Also I using spring-boot-devtool. This is a good tool that helps me.
But, when I change groovy-files, server not restarted, I have to change other files
Like a IDE I use a IDEA. The project assembled and tested with the command
gradle bootRun
Has anyone experienced this and found a solution?
In my case pattern !?*.groovy was absent in Resource patterns in Compiler settings
Try with <CTRL+F9>
I am using Spring Boot 1.3.0-RELEASE with groovy only.
Maybe this auto-generated demo project may help you to compare what went wrong with your project, using Sring CLI (installed via SDKMAN):
run in command line: spring init --dependencies=devtools,web --type=gradle-project --language=groovy example
Import to IDEA
run gradle bootRun
change source and hit <CTRL+F9>

Spring Integration with Cobertura

I am using spring integration in my application. I have written Junit test cases and initializing spring xml file using spring test framework. I am trying to setup Cobertura but it is not working properly. I am generating report via maven plugin. Just wanted to check if I am using the right tool for code coverage. If not, what else is the good option with spring integration. Thanks.
"Not working properly" will not help anyone understand your problem.
I can't speak to cobertura, but for Spring Integration itself, we use JaCoCo for code coverage from the gradle build. It produces html reports in the build directory and the output file is used by Sonar too.
I use eclemma in eclipse.

Debugging JAXB issues

I am running into an issue with JAXB 2 when marshaling my objects. I have an XmlJavaTypeAdapter which is working perfectly fine in unit tests, but when I try to marshal the same object graph from a web service (using JAX-WS), the XmlJavaTypeAdapter is being ignored completely. What's the easiest way to debug this problem?
I have a simple standalone project checked into my svn repository that demonstrates this issue. Can somebody please take a look to see if I am doing something obviously wrong? The URL for the project is: http://archfirst.googlecode.com/svn/trunk/java/examples/jaxb-jaxws-sample. There is a readme.txt file in the root folder that describes the issue in detail.
Thanks.
Ok, I finally found the problem. My unit test was picking up the JAXB implementation in the Java runtime, whereas my web service was picking up the JAXB implementation from GlassFish. Apparently the implementation bundled with GlassFish (2.2.1.1) cannot handle my use case. I proved it by forcing my unit test to use jaxb-impl-2.2.1.1.jar. Also it seems that the bug has been fixed in the latest JAXB implementation (2.2.3-1), but I am struggling to figure out how to replace GlassFish's implementation with this new version (see my post here).

Resources