Compare commits
No commits in common. 'deliverable_11' and 'deliverable_10' have entirely different histories.
deliverabl
...
deliverabl
@ -0,0 +1,24 @@
|
|||||||
|
package observer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
public abstract class Subject {
|
||||||
|
protected ArrayList<Wobserver> obsList = new ArrayList<Wobserver>();
|
||||||
|
|
||||||
|
public void addObs(Wobserver obs) {
|
||||||
|
obsList.add(obs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delObs(Wobserver obs) {
|
||||||
|
//Collections.singleton from https://howtodoinjava.com/java/collections/arraylist/arraylist-removeall/
|
||||||
|
obsList.removeAll(Collections.singleton(obs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMsg() {
|
||||||
|
for (Wobserver obs : obsList) {
|
||||||
|
obs.update(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package observer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import data.WatchList;
|
||||||
|
|
||||||
|
public interface Wobserver {
|
||||||
|
public void update(Subject obsed);
|
||||||
|
}
|
||||||
@ -1,83 +1,18 @@
|
|||||||
package ui;
|
package ui;
|
||||||
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.*;
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.GroupLayout;
|
|
||||||
import java.awt.Container;
|
|
||||||
import java.awt.LayoutManager;
|
|
||||||
import ui.guicomp.*;
|
|
||||||
import data.WatchList;
|
|
||||||
import data.ListOfWatchList;
|
|
||||||
import static data.Const.PROGRAM_NAME;
|
|
||||||
import javax.swing.GroupLayout.Alignment;
|
|
||||||
|
|
||||||
// based on http://zetcode.com/tutorials/javaswingtutorial/firstprograms/
|
public class Gui {
|
||||||
public class Gui extends JFrame implements Iface {
|
//public Gui() {
|
||||||
private JButton addButton;
|
// JLabel label = new JLabel("Hello World");
|
||||||
private JButton delButton;
|
|
||||||
private JButton upButton;
|
|
||||||
private WatchTablePane wtable;
|
|
||||||
private WatchList wlist;
|
|
||||||
private Runnable init = new Runnable() {
|
|
||||||
//Effect: Init gui all components
|
|
||||||
//Modifies: this
|
|
||||||
public void run() {
|
|
||||||
addComponents();
|
|
||||||
createLayout();
|
|
||||||
setTitle(PROGRAM_NAME);
|
|
||||||
setSize(300, 200);
|
|
||||||
setLocationRelativeTo(null);
|
|
||||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addComponents() {
|
|
||||||
addButton = new AddButt(wlist);
|
|
||||||
delButton = new DelButt(wlist);
|
|
||||||
upButton = new UpButt(wlist);
|
|
||||||
wtable = new WatchTablePane(wlist);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createLayout() {
|
|
||||||
Container pane = getContentPane();
|
|
||||||
GroupLayout lman = new GroupLayout(pane);
|
|
||||||
pane.setLayout(lman);
|
|
||||||
lman.setAutoCreateContainerGaps(true);
|
|
||||||
lman.setHorizontalGroup(lman.createParallelGroup(GroupLayout.Alignment.CENTER)
|
|
||||||
.addComponent(wtable.getPane())
|
|
||||||
.addGroup(lman.createSequentialGroup()
|
|
||||||
.addComponent(addButton)
|
|
||||||
.addComponent(delButton)
|
|
||||||
.addComponent(upButton)
|
|
||||||
));
|
|
||||||
lman.setVerticalGroup(lman.createSequentialGroup()
|
|
||||||
.addComponent(wtable.getPane())
|
|
||||||
.addGroup(lman.createParallelGroup(GroupLayout.Alignment.CENTER)
|
|
||||||
.addComponent(addButton)
|
|
||||||
.addComponent(delButton)
|
|
||||||
.addComponent(upButton)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public Gui() {
|
// JFrame.setDefaultLookAndFeelDecorated(true);
|
||||||
wlist = ListOfWatchList.getList().getWatchList(0);
|
// JFrame f = new JFrame("Hello World");
|
||||||
SwingUtilities.invokeLater(init);
|
// f.setSize(300,150);
|
||||||
setVisible(true);
|
// f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
}
|
|
||||||
|
|
||||||
//Effect: nothing
|
// f.add(label);
|
||||||
//not enough time to do something useful for this
|
|
||||||
@Override
|
|
||||||
public void redraw() {
|
|
||||||
//Nothing for now
|
|
||||||
}
|
|
||||||
|
|
||||||
//Effect: nothing
|
// f.setVisible(true);
|
||||||
//not enough time to do something useful for this
|
//}
|
||||||
@Override
|
|
||||||
public void destory() {
|
|
||||||
//Nothing for now
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,17 @@
|
|||||||
package ui;
|
package ui;
|
||||||
|
|
||||||
|
import ui.Options;
|
||||||
import ui.Tui;
|
import ui.Tui;
|
||||||
|
|
||||||
public class IfaceFactory {
|
public class IfaceFactory {
|
||||||
// Produce Iface given the config
|
// Produce Iface given the config
|
||||||
public static Iface getIface() {
|
public static Iface getIface() {
|
||||||
//uses Tui for now
|
//uses Tui for now
|
||||||
//return new Tui();
|
return new Tui();
|
||||||
//Test Gui
|
|
||||||
return new Gui();
|
|
||||||
}
|
}
|
||||||
|
//public static Iface getIface(Options iOpts) {
|
||||||
|
// //XXX iOpts not ready
|
||||||
|
// //uses Tui for now
|
||||||
|
// return new Tui(iOpts);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,150 @@
|
|||||||
|
package ui;
|
||||||
|
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
import java.util.prefs.BackingStoreException;
|
||||||
|
import java.util.prefs.InvalidPreferencesFormatException;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import data.Const;
|
||||||
|
|
||||||
|
public class Options {
|
||||||
|
private Preferences store;
|
||||||
|
private boolean wasEmpty;
|
||||||
|
private boolean noSave;
|
||||||
|
private static final String DEF_OPTS_PATH = "";
|
||||||
|
private static final String DEF_BACKUP = ".jwatch-backup.xml";
|
||||||
|
private static final String RES_DEF = "defPref.xml";
|
||||||
|
|
||||||
|
public Options() {
|
||||||
|
store = Preferences.userRoot();
|
||||||
|
try {
|
||||||
|
wasEmpty = store.nodeExists(Const.PROGRAM_NAME);
|
||||||
|
store = store.node(Const.PROGRAM_NAME);
|
||||||
|
if (wasEmpty) {
|
||||||
|
//load default opts from resource
|
||||||
|
//XXX
|
||||||
|
//importDefPreferences();
|
||||||
|
}
|
||||||
|
} catch (BackingStoreException e) {
|
||||||
|
System.out.println("Critical Error: preference backing cannot be initialized");
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Options(String pathname) {
|
||||||
|
store = Preferences.userRoot().node(pathname);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Options getSection(String section) {
|
||||||
|
//String path = Const.PROGRAM_NAME + "/" + section;
|
||||||
|
//Options result = new Options(path);
|
||||||
|
//return result;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void importPreferences(String xmlpath) {
|
||||||
|
try {
|
||||||
|
File tarFile = new File(xmlpath);
|
||||||
|
FileInputStream tarStream = new FileInputStream(tarFile);
|
||||||
|
store.importPreferences(tarStream);
|
||||||
|
tarStream.close();
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
System.out.println("File not found: " + xmlpath);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("IO Error when reading: " + xmlpath);
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvalidPreferencesFormatException e) {
|
||||||
|
System.out.println("Import format error, possible file corruption");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void importDefPreferences() {
|
||||||
|
try {
|
||||||
|
InputStream istream = getClass().getResourceAsStream(RES_DEF);
|
||||||
|
store.importPreferences(istream);
|
||||||
|
istream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("IO Error while reading def pref: "
|
||||||
|
+ RES_DEF);
|
||||||
|
} catch (InvalidPreferencesFormatException e) {
|
||||||
|
System.out.println("Def resPref format error, possible program corruption");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void exportPreferences(String xmlpath) {
|
||||||
|
try {
|
||||||
|
File tarFile = new File(xmlpath);
|
||||||
|
if (tarFile.isFile()) {
|
||||||
|
tarFile.delete();
|
||||||
|
} else {
|
||||||
|
tarFile.createNewFile();
|
||||||
|
}
|
||||||
|
FileOutputStream tarStream = new FileOutputStream(tarFile);
|
||||||
|
store.exportSubtree(tarStream);
|
||||||
|
tarStream.flush();
|
||||||
|
tarStream.close();
|
||||||
|
System.out.println("Exported preference to: " + xmlpath);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("IO Error when writing: " + xmlpath);
|
||||||
|
} catch (BackingStoreException e) {
|
||||||
|
System.out.println("Error retriving pref from store");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
// Clear config if requested or config was empty
|
||||||
|
// and is not saving
|
||||||
|
if (wasEmpty && noSave) {
|
||||||
|
try {
|
||||||
|
this.store.clear();
|
||||||
|
} catch (BackingStoreException e) {
|
||||||
|
System.out.println("Error clearing pref store");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else if (noSave) {
|
||||||
|
restorePrevious();
|
||||||
|
}
|
||||||
|
delBackup();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void backupPref() {
|
||||||
|
exportPreferences(DEF_BACKUP);
|
||||||
|
System.out.println("User Pref Backup created");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delBackup() {
|
||||||
|
try {
|
||||||
|
File tarFile = new File(DEF_BACKUP);
|
||||||
|
tarFile.delete();
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Error deleting backup user pref");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restorePrevious() {
|
||||||
|
importPreferences(DEF_BACKUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default all false bool pref to be safe
|
||||||
|
// Default should be imported by constructor regardless
|
||||||
|
public boolean getBool(String key) {
|
||||||
|
return this.store.getBoolean(key, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default all empty string pref to be safe
|
||||||
|
// Default should be imported by constructor regardless
|
||||||
|
public String getString(String key) {
|
||||||
|
return this.store.get(key, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void parseArgs(String[] args) {
|
||||||
|
//XXX
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,37 +0,0 @@
|
|||||||
package ui.guicomp;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import data.WatchList;
|
|
||||||
|
|
||||||
public class AddButt extends JButton {
|
|
||||||
private WatchList wlist;
|
|
||||||
|
|
||||||
public AddButt(WatchList wlist) {
|
|
||||||
super("Add Stock...");
|
|
||||||
//https://coderanch.com/t/580497/java/JButton-clicked-action
|
|
||||||
if (getActionListeners().length < 1) {
|
|
||||||
addActionListener(new AddButtList());
|
|
||||||
}
|
|
||||||
this.wlist = wlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AddButtList implements ActionListener {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
//https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html#input
|
|
||||||
//https://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html
|
|
||||||
String userin = (String)JOptionPane.showInputDialog("Enter the identifier:");
|
|
||||||
if ((userin != null) && (userin.length() > 0)) {
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
wlist.addStock(userin);
|
|
||||||
wlist.updateList();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
package ui.guicomp;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import data.WatchList;
|
|
||||||
import data.exceptions.StockNotExistsException;
|
|
||||||
|
|
||||||
public class DelButt extends JButton {
|
|
||||||
private WatchList wlist;
|
|
||||||
|
|
||||||
public DelButt(WatchList wlist) {
|
|
||||||
super("Remove Stock...");
|
|
||||||
if (getActionListeners().length < 1) {
|
|
||||||
addActionListener(new DelButtList());
|
|
||||||
}
|
|
||||||
this.wlist = wlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DelButtList implements ActionListener {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
//https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html#input
|
|
||||||
//https://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html
|
|
||||||
String[] names = wlist.getNames();
|
|
||||||
String userin = (String)JOptionPane.showInputDialog(
|
|
||||||
null, "Choose a stock to delete:", "Delete Stock",
|
|
||||||
JOptionPane.PLAIN_MESSAGE, null, names, null);
|
|
||||||
if ((userin != null) && (userin.length() > 0)) {
|
|
||||||
//https://stackoverflow.com/questions/12771500/best-way-of-creating-and-using-an-anonymous-runnable-class
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
wlist.delStock(userin);
|
|
||||||
} catch (StockNotExistsException e) {
|
|
||||||
//impossible
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
package ui.guicomp;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import data.WatchList;
|
|
||||||
|
|
||||||
public class UpButt extends JButton {
|
|
||||||
private WatchList wlist;
|
|
||||||
|
|
||||||
public UpButt(WatchList wlist) {
|
|
||||||
super("Update");
|
|
||||||
if (getActionListeners().length < 1) {
|
|
||||||
addActionListener(new UpButtList());
|
|
||||||
}
|
|
||||||
this.wlist = wlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class UpButtList implements ActionListener {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
wlist.updateList();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
package ui.guicomp;
|
|
||||||
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
|
||||||
import javax.swing.table.TableModel;
|
|
||||||
import javax.swing.event.*;
|
|
||||||
import data.WatchList;
|
|
||||||
import data.WatchList.Wevent;
|
|
||||||
import data.StockEntry;
|
|
||||||
import java.util.Observer;
|
|
||||||
import java.util.Observable;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
|
|
||||||
// Ref: https://docs.oracle.com/javase/tutorial/uiswing/components/table.html
|
|
||||||
// Ref2: https://docs.oracle.com/javase/8/docs/api/javax/swing/table/AbstractTableModel.html
|
|
||||||
public class WatchTableModel extends AbstractTableModel implements Observer {
|
|
||||||
private final String[] colnames = {"Identifier", "Price", "% change", "Status"};
|
|
||||||
private final Object[] example = {"asdf", 0.0, "asdf", "asdf"};
|
|
||||||
private WatchList watch;
|
|
||||||
|
|
||||||
public WatchTableModel(WatchList wlist) {
|
|
||||||
watch = wlist;
|
|
||||||
watch.addObserver(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getColumnCount() {
|
|
||||||
return colnames.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRowCount() {
|
|
||||||
return watch.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColumnName(int num) {
|
|
||||||
return colnames[num];
|
|
||||||
}
|
|
||||||
|
|
||||||
//Effect: return generated table data for whatever asked
|
|
||||||
public Object getValueAt(int stock, int field) {
|
|
||||||
StockEntry entry = watch.getStock(stock);
|
|
||||||
switch (field) {
|
|
||||||
case 0: //Name
|
|
||||||
return entry.getID();
|
|
||||||
case 1: //Price
|
|
||||||
return entry.getPrice();
|
|
||||||
case 2: //% change
|
|
||||||
return entry.getChange() + " %";
|
|
||||||
case 3:
|
|
||||||
return entry.isUpdating() ? "Updating" : "Ok";
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class getColumnClass(int col) {
|
|
||||||
return example[col].getClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Effect: updates table for different events, ran by event dispatch thread as recommanded
|
|
||||||
//Modifies: Table displayed
|
|
||||||
@Override
|
|
||||||
public void update(Observable obsed, Object event) {
|
|
||||||
Wevent weve = (Wevent) event;
|
|
||||||
switch (weve.getType()) {
|
|
||||||
case UPDATE:
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
|
||||||
fireTableDataChanged(); });
|
|
||||||
break;
|
|
||||||
case ADD:
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
|
||||||
fireTableRowsInserted(weve.getData(), weve.getData()); });
|
|
||||||
break;
|
|
||||||
case DEL:
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
|
||||||
fireTableRowsDeleted(weve.getData(), weve.getData()); });
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
package ui.guicomp;
|
|
||||||
|
|
||||||
import javax.swing.JTable;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.table.TableModel;
|
|
||||||
import data.WatchList;
|
|
||||||
|
|
||||||
//https://docs.oracle.com/javase/7/docs/api/javax/swing/JTable.html
|
|
||||||
public class WatchTablePane {
|
|
||||||
private JTable table;
|
|
||||||
private TableModel tmodel;
|
|
||||||
private JScrollPane spane;
|
|
||||||
|
|
||||||
public WatchTablePane(WatchList wlist) {
|
|
||||||
tmodel = new WatchTableModel(wlist);
|
|
||||||
table = new JTable(tmodel);
|
|
||||||
spane = new JScrollPane(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JScrollPane getPane() {
|
|
||||||
return spane;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
package data;
|
|
||||||
|
|
||||||
import data.ListOfWatchList;
|
|
||||||
import data.WatchList;
|
|
||||||
import data.exceptions.*;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
public class ListOfWatchListTest {
|
|
||||||
private WatchList watchlist;
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
public void runBefore() {
|
|
||||||
watchlist = new WatchList();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Effect: check if only one instance is returned
|
|
||||||
@Test
|
|
||||||
public void singletonCheck() {
|
|
||||||
assertTrue(ListOfWatchList.getList() == ListOfWatchList.getList());
|
|
||||||
}
|
|
||||||
|
|
||||||
//Effect: check double adding and deleting watchlists
|
|
||||||
@Test
|
|
||||||
public void addDelWatchList() {
|
|
||||||
ListOfWatchList lowl = ListOfWatchList.getList();
|
|
||||||
lowl.addWatchList(watchlist);
|
|
||||||
assertEquals(watchlist, lowl.getWatchList(0));
|
|
||||||
lowl.addWatchList(watchlist);
|
|
||||||
assertEquals(watchlist, lowl.getWatchList(0));
|
|
||||||
try {
|
|
||||||
lowl.getWatchList(1);
|
|
||||||
} catch (IndexOutOfBoundsException e) {
|
|
||||||
// expected fail
|
|
||||||
}
|
|
||||||
lowl.delWatchList(watchlist);
|
|
||||||
try {
|
|
||||||
lowl.getWatchList(0);
|
|
||||||
} catch (IndexOutOfBoundsException e) {
|
|
||||||
// expected fail
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in new issue