You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.7 KiB
41 lines
1.7 KiB
package com.fanruan.api.query; |
|
|
|
import com.fanruan.api.Prepare; |
|
import com.fr.stable.query.restriction.RestrictionType; |
|
import com.fr.stable.query.restriction.impl.LteRestriction; |
|
import org.junit.Test; |
|
|
|
import java.util.HashSet; |
|
import java.util.Set; |
|
|
|
import static org.junit.Assert.assertEquals; |
|
|
|
/** |
|
* @author richie |
|
* @version 10.0 |
|
* Created by richie on 2019/9/26 |
|
*/ |
|
public class RestrictionKitTest extends Prepare { |
|
|
|
@Test |
|
public void testRestriction() { |
|
assertEquals(RestrictionKit.eq("a", 1).getType(), RestrictionType.EQ); |
|
assertEquals(RestrictionKit.neq("a", 1).getType(), RestrictionType.NEQ); |
|
assertEquals(RestrictionKit.gt("a", 1).getType(), RestrictionType.GT); |
|
assertEquals(RestrictionKit.gte("a", 1).getType(), RestrictionType.GTE); |
|
assertEquals(RestrictionKit.lt("a", 1).getType(), RestrictionType.LT); |
|
assertEquals(RestrictionKit.lte("a", 1).getType(), RestrictionType.LTE); |
|
assertEquals(RestrictionKit.startWith("a", 1).getType(), RestrictionType.STARTWITH); |
|
assertEquals(RestrictionKit.endWith("a", 1).getType(), RestrictionType.ENDWITH); |
|
assertEquals(RestrictionKit.like("a", 1).getType(), RestrictionType.LIKE); |
|
assertEquals(RestrictionKit.or(new LteRestriction()).getType(), RestrictionType.OR); |
|
assertEquals(RestrictionKit.and(new LteRestriction()).getType(), RestrictionType.AND); |
|
Set<String> testSet = new HashSet<String>(); |
|
testSet.add("a"); |
|
testSet.add("b"); |
|
assertEquals(RestrictionKit.in("a", testSet).getType(), RestrictionType.IN); |
|
assertEquals(RestrictionKit.notIn("a", testSet).getType(), RestrictionType.NIN); |
|
|
|
} |
|
|
|
} |