View Javadoc
1   /*
2    * CSVeed (https://github.com/42BV/CSVeed)
3    *
4    * Copyright 2013-2023 CSVeed.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of The Apache Software License,
8    * Version 2.0 which accompanies this distribution, and is available at
9    * https://www.apache.org/licenses/LICENSE-2.0.txt
10   */
11  package org.csveed.bean.conversion;
12  
13  import static org.junit.jupiter.api.Assertions.assertEquals;
14  
15  import org.junit.jupiter.api.Test;
16  
17  /**
18   * The Class EasyAbstractConverterTest.
19   */
20  class EasyAbstractConverterTest {
21  
22      /**
23       * Test easy abstract converter.
24       *
25       * @throws Exception
26       *             the exception
27       */
28      @Test
29      void testEasyAbstractConverter() throws Exception {
30          Converter<Coordinate> converter = new EasyAbstractConverter<Coordinate>(Coordinate.class) {
31              @Override
32              public Coordinate fromString(String text) throws Exception {
33                  return Coordinate.fromString(text);
34              }
35          };
36          Coordinate coords = converter.fromString("11/38");
37          assertEquals((Integer) 11, coords.getX());
38          assertEquals((Integer) 38, coords.getY());
39      }
40  }