-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d67efa
commit 9934baf
Showing
2 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
hibernate-core/src/test/java/org/hibernate/query/criteria/internal/HHH13884Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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.query.criteria.internal; | ||
|
||
import javax.persistence.criteria.Expression; | ||
import javax.persistence.criteria.Order; | ||
|
||
import org.hibernate.testing.TestForIssue; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertNotSame; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.mockito.Mockito.mock; | ||
|
||
/** | ||
* @author seregamorph | ||
*/ | ||
@TestForIssue(jiraKey = "HHH-13884") | ||
public class HHH13884Test { | ||
|
||
@Test | ||
public void testDefaultReversedOrderImpl() { | ||
Expression<?> expression = mock( Expression.class ); | ||
|
||
OrderImpl order = new OrderImpl( expression ); | ||
|
||
assertEquals( expression, order.getExpression() ); | ||
assertTrue( "Order should be ascending by default", order.isAscending() ); | ||
|
||
Order reversed = order.reverse(); | ||
|
||
assertEquals( expression, reversed.getExpression() ); | ||
assertFalse( "Reversed Order should be descending", reversed.isAscending() ); | ||
|
||
assertNotSame( "Order.reverse() should create new instance by the contract", order, reversed ); | ||
} | ||
} |