Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.

This commit is contained in:
Ilkka Seppala
2015-12-25 23:49:28 +02:00
parent 9fbb085985
commit cec9a99410
167 changed files with 1242 additions and 969 deletions

View File

@ -39,9 +39,7 @@ public class FileLoader {
br.close();
return sb.toString();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -26,7 +26,7 @@ public class FileSelectorJFrame extends JFrame implements FileSelectorView, Acti
/**
* The "OK" button for loading the file.
*/
private JButton OK;
private JButton ok;
/**
* The cancel button.
@ -121,10 +121,10 @@ public class FileSelectorJFrame extends JFrame implements FileSelectorView, Acti
/*
* Add the OK button.
*/
this.OK = new JButton("OK");
this.panel.add(OK);
this.OK.setBounds(250, 50, 100, 25);
this.OK.addActionListener(this);
this.ok = new JButton("OK");
this.panel.add(ok);
this.ok.setBounds(250, 50, 100, 25);
this.ok.addActionListener(this);
/*
* Add the cancel button.
@ -140,13 +140,11 @@ public class FileSelectorJFrame extends JFrame implements FileSelectorView, Acti
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == this.OK) {
if (e.getSource() == this.ok) {
this.fileName = this.input.getText();
presenter.fileNameChanged();
presenter.confirmed();
}
else if (e.getSource() == this.cancel) {
} else if (e.getSource() == this.cancel) {
presenter.cancelled();
}
}

View File

@ -51,6 +51,9 @@ public class FileSelectorPresenter {
loader.setFileName(view.getFileName());
}
/**
* Ok button handler
*/
public void confirmed() {
if (loader.getFileName() == null || loader.getFileName().equals("")) {
view.showMessage("Please give the name of the file first!");
@ -60,9 +63,7 @@ public class FileSelectorPresenter {
if (loader.fileExists()) {
String data = loader.loadData();
view.displayData(data);
}
else {
} else {
view.showMessage("The file specified does not exist.");
}
}

View File

@ -1,14 +1,13 @@
package com.iluwatar.model.view.presenter;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import com.iluwatar.model.view.presenter.FileLoader;
import com.iluwatar.model.view.presenter.FileSelectorPresenter;
import com.iluwatar.model.view.presenter.FileSelectorStub;
/**
* This test case is responsible for testing our application by taking advantage of the
* Model-View-Controller architectural pattern.
@ -57,13 +56,13 @@ public class FileSelectorPresenterTest {
*/
@Test
public void updateFileNameToLoader() {
String EXPECTED_FILE = "Stamatis";
stub.setFileName(EXPECTED_FILE);
String expectedFile = "Stamatis";
stub.setFileName(expectedFile);
presenter.start();
presenter.fileNameChanged();
assertEquals(EXPECTED_FILE, loader.getFileName());
assertEquals(expectedFile, loader.getFileName());
}
/**