Search in sources :

Example 96 with Security

use of name.abuchen.portfolio.model.Security in project portfolio by buchen.

the class BookmarkTest method testURLCreation.

@Test
public void testURLCreation() {
    Bookmark page = new Bookmark("", "http://{tickerSymbol,isin,wkn,name}");
    Security security = new Security("Daimler", "DE0007100000", "", YahooFinanceQuoteFeed.ID);
    security.setWkn("12345");
    assertThat(page.constructURL(new Client(), security), equalTo("http://DE0007100000"));
    security.setTickerSymbol("DAI.DE");
    assertThat(page.constructURL(new Client(), security), equalTo("http://DAI.DE"));
    page = new Bookmark("", "http://{isin,tickerSymbol,wkn,name}");
    assertThat(page.constructURL(new Client(), security), equalTo("http://DE0007100000"));
}
Also used : Bookmark(name.abuchen.portfolio.model.Bookmark) Security(name.abuchen.portfolio.model.Security) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Example 97 with Security

use of name.abuchen.portfolio.model.Security in project portfolio by buchen.

the class BookmarkTest method testIfUnknownKeysAreFound.

@Test
public void testIfUnknownKeysAreFound() {
    Bookmark page = new Bookmark("", "https://www.flatex.de/suche/{something}");
    Security security = new Security("Daimler", "DE0007100000", "", YahooFinanceQuoteFeed.ID);
    security.setWkn("12345");
    assertThat(page.constructURL(new Client(), security), equalTo("https://www.flatex.de/suche/"));
}
Also used : Bookmark(name.abuchen.portfolio.model.Bookmark) Security(name.abuchen.portfolio.model.Security) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Example 98 with Security

use of name.abuchen.portfolio.model.Security in project portfolio by buchen.

the class BookmarkTest method testMultipleKeyReplacement.

@Test
public void testMultipleKeyReplacement() {
    Bookmark page = new Bookmark("", "https://www.flatex.de/suche/?q={wkn}&isin={isin}");
    Security security = new Security("Daimler", "DE0007100000", "", YahooFinanceQuoteFeed.ID);
    security.setWkn("12345");
    assertThat(page.constructURL(new Client(), security), equalTo("https://www.flatex.de/suche/?q=12345&isin=DE0007100000"));
}
Also used : Bookmark(name.abuchen.portfolio.model.Bookmark) Security(name.abuchen.portfolio.model.Security) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Example 99 with Security

use of name.abuchen.portfolio.model.Security in project portfolio by buchen.

the class BookmarkTest method testTickerSymbolPrefix.

@Test
public void testTickerSymbolPrefix() {
    Bookmark page = new Bookmark("", "https://www.flatex.de/suche/{tickerSymbolPrefix}");
    Security security = new Security("Daimler", "DE0007100000", "DAI.DE", YahooFinanceQuoteFeed.ID);
    assertThat(page.constructURL(new Client(), security), equalTo("https://www.flatex.de/suche/DAI"));
}
Also used : Bookmark(name.abuchen.portfolio.model.Bookmark) Security(name.abuchen.portfolio.model.Security) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Example 100 with Security

use of name.abuchen.portfolio.model.Security in project portfolio by buchen.

the class BookmarkTest method testIfNoReplacmentsAreFound.

@Test
public void testIfNoReplacmentsAreFound() {
    Bookmark page = new Bookmark("", "https://www.flatex.de/suche/XXX");
    Security security = new Security("Daimler", "DE0007100000", "", YahooFinanceQuoteFeed.ID);
    security.setWkn("12345");
    assertThat(page.constructURL(new Client(), security), equalTo("https://www.flatex.de/suche/XXX"));
}
Also used : Bookmark(name.abuchen.portfolio.model.Bookmark) Security(name.abuchen.portfolio.model.Security) Client(name.abuchen.portfolio.model.Client) Test(org.junit.Test)

Aggregations

Security (name.abuchen.portfolio.model.Security)375 Test (org.junit.Test)283 Client (name.abuchen.portfolio.model.Client)265 ArrayList (java.util.ArrayList)252 PortfolioTransaction (name.abuchen.portfolio.model.PortfolioTransaction)211 SecurityItem (name.abuchen.portfolio.datatransfer.Extractor.SecurityItem)208 IOException (java.io.IOException)196 Item (name.abuchen.portfolio.datatransfer.Extractor.Item)195 AccountTransaction (name.abuchen.portfolio.model.AccountTransaction)195 TransactionItem (name.abuchen.portfolio.datatransfer.Extractor.TransactionItem)190 BuySellEntry (name.abuchen.portfolio.model.BuySellEntry)185 BuySellEntryItem (name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem)181 List (java.util.List)180 Unit (name.abuchen.portfolio.model.Transaction.Unit)175 Values (name.abuchen.portfolio.money.Values)173 Money (name.abuchen.portfolio.money.Money)170 LocalDateTime (java.time.LocalDateTime)162 CoreMatchers.is (org.hamcrest.CoreMatchers.is)162 Assert.assertThat (org.junit.Assert.assertThat)162 CurrencyUnit (name.abuchen.portfolio.money.CurrencyUnit)159