@Test public void testPreviewModel() throws NoTableSelectedException { PreviewModel model = new PreviewModel(); model.setDatasourceModel(Optional.of(new MockDatasourceModel())); model.addListener(new PreviewModelListener() { @Override public void previewChanged() { assertTrue(model.isPreview(), "preview is inactive"); } }); assertFalse(model.isPreview(), "preview is active"); model.setPreview(true); assertEquals(1, model.getPreviewNumber(), "wrong preview number"); model.gotoLastDataset(); assertEquals(5, model.getPreviewNumber(), "wrong preview number"); assertEquals("5", model.getCurrentRecord().get("Id"), "wrong record"); }
public PreviewModel() { this.model = Optional.empty(); }
PreviewModel implements ConnectionModelListener { public PreviewModel() { this.model = Optional.empty(); } }
PreviewModel implements ConnectionModelListener { public PreviewModel() { this.model = Optional.empty(); } PreviewModel(); }
PreviewModel implements ConnectionModelListener { public PreviewModel() { this.model = Optional.empty(); } PreviewModel(); void addListener(PreviewModelListener listener); boolean isPreview(); int getPreviewNumber(); void setDatasourceModel(Optional<DatasourceModel> datasourceModel); void setPreview(boolean isPreview); void setPreviewNumber(int previewNumber); void gotoLastDataset(); Map<String, String> getCurrentRecord(); @Override void connectionsChanged(); }
PreviewModel implements ConnectionModelListener { public PreviewModel() { this.model = Optional.empty(); } PreviewModel(); void addListener(PreviewModelListener listener); boolean isPreview(); int getPreviewNumber(); void setDatasourceModel(Optional<DatasourceModel> datasourceModel); void setPreview(boolean isPreview); void setPreviewNumber(int previewNumber); void gotoLastDataset(); Map<String, String> getCurrentRecord(); @Override void connectionsChanged();  }