2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.persistence.jdbc.internal;
15 import static org.junit.jupiter.api.Assertions.assertThrows;
16 import static org.mockito.Mockito.mock;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.junit.jupiter.api.BeforeEach;
20 import org.junit.jupiter.api.Test;
21 import org.openhab.core.i18n.TimeZoneProvider;
22 import org.openhab.core.items.ItemRegistry;
23 import org.openhab.core.persistence.FilterCriteria;
26 * Tests the {@link JdbcPersistenceService}.
28 * @author Christoph Weitkamp - Initial contribution
31 public class JdbcPersistenceServiceTest {
33 private final JdbcPersistenceService jdbcPersistenceService = new JdbcPersistenceService(mock(ItemRegistry.class),
34 mock(TimeZoneProvider.class)) {
36 protected boolean checkDBAccessability() {
40 private @NonNullByDefault({}) FilterCriteria filter;
44 filter = new FilterCriteria();
48 void removeThrowsIllegalArgumentExceptionIfItemNameOfFilterIsNull() {
49 assertThrows(IllegalArgumentException.class, () -> jdbcPersistenceService.remove(filter));