HHH-13645 : test cases

This commit is contained in:
Gail Badner 2019-09-27 15:31:49 -07:00 committed by Sanne Grinovero
parent 4b8c81908c
commit 3f7d03bfec
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,30 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.stat.internal;
import org.hibernate.testing.TestForIssue;
import org.junit.Test;
import static org.junit.Assert.assertNull;
@TestForIssue(jiraKey = "HHH-13645")
public class StatsNamedContainerNullComputedValueTest {
@Test
public void testNullComputedValue() {
final StatsNamedContainer statsNamedContainer = new StatsNamedContainer<Integer>();
assertNull(
statsNamedContainer.getOrCompute(
"key",
v -> {
return null;
}
)
);
}
}

View File

@ -0,0 +1,36 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.stats;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.stat.Statistics;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import static org.junit.Assert.assertNull;
/**
* @author Gail Badner
*/
public class StatisticsWithNoQueryCachingTest extends BaseCoreFunctionalTestCase {
@Override
protected void configure(Configuration configuration) {
configuration.setProperty( AvailableSettings.USE_SECOND_LEVEL_CACHE, "true" );
configuration.setProperty( AvailableSettings.USE_QUERY_CACHE, "false" );
}
@Test
@TestForIssue( jiraKey = "HHH-13645")
public void testUncachedRegion() {
final Statistics statistics = sessionFactory().getStatistics();
assertNull( statistics.getCacheRegionStatistics( "hibernate.test.unknown" ) );
}
}