Search in sources :

Example 1 with Bookmark

use of name.abuchen.portfolio.model.Bookmark 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 2 with Bookmark

use of name.abuchen.portfolio.model.Bookmark 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 3 with Bookmark

use of name.abuchen.portfolio.model.Bookmark 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 4 with Bookmark

use of name.abuchen.portfolio.model.Bookmark 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 5 with Bookmark

use of name.abuchen.portfolio.model.Bookmark 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

Bookmark (name.abuchen.portfolio.model.Bookmark)13 Client (name.abuchen.portfolio.model.Client)10 Security (name.abuchen.portfolio.model.Security)10 Test (org.junit.Test)8 Separator (org.eclipse.jface.action.Separator)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 List (java.util.List)2 ClientSettings (name.abuchen.portfolio.model.ClientSettings)2 Messages (name.abuchen.portfolio.ui.Messages)2 DesktopAPI (name.abuchen.portfolio.ui.util.DesktopAPI)2 SimpleAction (name.abuchen.portfolio.ui.util.SimpleAction)2 Action (org.eclipse.jface.action.Action)2 MenuManager (org.eclipse.jface.action.MenuManager)2 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 SWT (org.eclipse.swt.SWT)2 Composite (org.eclipse.swt.widgets.Composite)2 Shell (org.eclipse.swt.widgets.Shell)2