Switching Between Hibernate’s and Spring’s Transaction

Reading Time: 1 minute Uncomment the below lines to hand the activation down to Spring pom.xml <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd”> <modelVersion>4.0.0</modelVersion> <groupId>com.tugrulaslan</groupId> <artifactId>WebApp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>BlogWebApp Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <project-java.version>1.7</project-java.version> <maven-compiler-plugin.version>3.1</maven-compiler-plugin.version> <junit.version>4.11</junit.version> <mysql-connector.version>5.1.34</mysql-connector.version> <hibernate.version>4.3.8.Final</hibernate.version> <javax-persistance-api.version>1.0.2</javax-persistance-api.version> <spring.version>4.0.6.RELEASE</spring.version> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql-connector.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernate.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version>

How do I test File api in Junit

Reading Time: 1 minute I was looking for a way to test Java file apis, especially I’ve such methods which return Java File. I somehow felt that those methods also have to be tested at least a small test case could be conducted. I did check what File api returns at Oracle Api Docs. The Method you’ll observe below

JUnit test squence dilemma

Reading Time: 2 minutes At work I was writing test cases for methods for a dao class. Suddenly I realized that the test methods do not work the in the sequence that I wrote them, eventually one test case has failed because deletion method is being conducted before the creation method. Then I’ve checked it online and after JUnit 4.11