diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-12-15 23:28:52 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-12-16 00:24:47 +0400 |
commit | 8384ad87cde7d957485062d28913bf688f908bc8 (patch) | |
tree | 30c9dba46b6ff87d8297dcbd60054a3a3e030b6a /sonar-core/src/test | |
parent | 5bde32c2ca82a35e3a862db9361728b41fca843a (diff) | |
download | sonarqube-8384ad87cde7d957485062d28913bf688f908bc8.tar.gz sonarqube-8384ad87cde7d957485062d28913bf688f908bc8.zip |
Fix violation, add test
Diffstat (limited to 'sonar-core/src/test')
-rw-r--r-- | sonar-core/src/test/java/org/sonar/jpa/session/JpaDatabaseSessionTest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sonar-core/src/test/java/org/sonar/jpa/session/JpaDatabaseSessionTest.java b/sonar-core/src/test/java/org/sonar/jpa/session/JpaDatabaseSessionTest.java index d1314ea4316..697fe1ec035 100644 --- a/sonar-core/src/test/java/org/sonar/jpa/session/JpaDatabaseSessionTest.java +++ b/sonar-core/src/test/java/org/sonar/jpa/session/JpaDatabaseSessionTest.java @@ -27,8 +27,11 @@ import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test; +import com.google.common.collect.Maps; + import java.util.Arrays; import java.util.Collections; +import java.util.Map; import javax.persistence.NonUniqueResultException; import javax.persistence.Query; @@ -65,4 +68,14 @@ public class JpaDatabaseSessionTest { assertThat(session.getSingleResult(query, "default"), is("default")); } + @Test + public void shouldBuildCriteriasHQL() { + StringBuilder hql = new StringBuilder(); + Map<String, Object> mappedCriterias = Maps.newHashMap(); + mappedCriterias.put("foo", "value"); + mappedCriterias.put("bar", null); + session.buildCriteriasHQL(hql, mappedCriterias); + assertThat(hql.toString(), is("o.foo=:foo AND o.bar IS NULL")); + } + } |