1 /*
2 * Copyright © 2016 Greg Chabala
3 *
4 * This file is part of brick-control-lab.
5 *
6 * brick-control-lab is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * brick-control-lab is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with brick-control-lab. If not, see http://www.gnu.org/licenses/.
18 */
19 package org.chabala.brick.controllab;
20
21 import org.junit.Before;
22 import org.junit.Test;
23
24 import java.util.List;
25
26 import static org.hamcrest.Matchers.*;
27 import static org.junit.Assert.*;
28
29 /**
30 * Testing {@link JsscSerialPortFactory}.
31 */
32 public class JsscSerialPortFactoryTest {
33
34 private SerialPortFactory serialPortFactory;
35
36 @Before
37 public void setUp() throws Exception {
38 serialPortFactory = new JsscSerialPortFactory();
39 }
40
41 @Test
42 public void getAvailablePorts() throws Exception {
43 List<String> availablePorts = serialPortFactory.getAvailablePorts();
44 assertThat(availablePorts, is(not(nullValue())));
45 }
46
47 @Test
48 public void getSerialPort() throws Exception {
49 SerialPort serialPort = serialPortFactory.getSerialPort("test");
50 assertThat(serialPort, is(not(nullValue())));
51 assertThat(serialPort, is(instanceOf(JsscSerialPort.class)));
52 }
53 }