選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

LikeFilterTest.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.data.util.filter;
  17. import org.junit.Assert;
  18. import org.junit.Test;
  19. import com.vaadin.data.Item;
  20. import com.vaadin.data.util.ObjectProperty;
  21. import com.vaadin.data.util.PropertysetItem;
  22. public class LikeFilterTest extends AbstractFilterTestBase<Like> {
  23. protected Item item1 = new PropertysetItem();
  24. protected Item item2 = new PropertysetItem();
  25. protected Item item3 = new PropertysetItem();
  26. @Test
  27. public void testLikeWithNulls() {
  28. Like filter = new Like("value", "a");
  29. item1.addItemProperty("value", new ObjectProperty<String>("a"));
  30. item2.addItemProperty("value", new ObjectProperty<String>("b"));
  31. item3.addItemProperty("value", new ObjectProperty<String>(null,
  32. String.class));
  33. Assert.assertTrue(filter.passesFilter(null, item1));
  34. Assert.assertFalse(filter.passesFilter(null, item2));
  35. Assert.assertFalse(filter.passesFilter(null, item3));
  36. }
  37. }