Search in sources :

Example 1 with ISINField

use of name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField in project portfolio by buchen.

the class ISINFieldTest method testPartialMatch.

@Test
public void testPartialMatch() throws ParseException {
    ISINField field = new ISINField(Messages.CSVColumn_ISIN);
    Format format = field.createFormat(Arrays.asList(new Security("SAP", "DE0007164600", "SAP.DE", QuoteFeed.MANUAL)));
    assertThat(format.parseObject("Zins/Dividende ISIN DE0007164600 SAP SE O."), is("DE0007164600"));
    assertThat(format.parseObject("ISIN DE0007164600"), is("DE0007164600"));
}
Also used : Format(java.text.Format) ISINField(name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField) Security(name.abuchen.portfolio.model.Security) Test(org.junit.Test)

Example 2 with ISINField

use of name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField in project portfolio by buchen.

the class ISINFieldTest method testValidAndNotExistingISIN.

@Test(expected = ParseException.class)
public void testValidAndNotExistingISIN() throws ParseException {
    ISINField field = new ISINField(Messages.CSVColumn_ISIN);
    Format format = field.createFormat(new ArrayList<>());
    format.parseObject("DE0007164600");
}
Also used : Format(java.text.Format) ISINField(name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField) Test(org.junit.Test)

Example 3 with ISINField

use of name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField in project portfolio by buchen.

the class ISINFieldTest method testValidAndExistingISIN.

@Test
public void testValidAndExistingISIN() throws ParseException {
    ISINField field = new ISINField(Messages.CSVColumn_ISIN);
    Format format = field.createFormat(Arrays.asList(new Security("BASF", "DE000BASF111", "BAS.DE", QuoteFeed.MANUAL)));
    assertThat(format.parseObject("DE000BASF111"), is("DE000BASF111"));
}
Also used : Format(java.text.Format) ISINField(name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField) Security(name.abuchen.portfolio.model.Security) Test(org.junit.Test)

Example 4 with ISINField

use of name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField in project portfolio by buchen.

the class ISINFieldTest method testNotValidISIN.

@Test(expected = ParseException.class)
public void testNotValidISIN() throws ParseException {
    ISINField field = new ISINField(Messages.CSVColumn_ISIN);
    Format format = field.createFormat(new ArrayList<>());
    format.parseObject("not valid");
}
Also used : Format(java.text.Format) ISINField(name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField) Test(org.junit.Test)

Aggregations

Format (java.text.Format)4 ISINField (name.abuchen.portfolio.datatransfer.csv.CSVImporter.ISINField)4 Test (org.junit.Test)4 Security (name.abuchen.portfolio.model.Security)2