Skip to content

Commit 4d9d6da

Browse files
committed
Reformat source files to 2 space indents
After changing the `.editorconfig` to match [Google/Angular's](https://github.com/angular/angular/blob/master/.editorconfig), this commit reformats all the source files to use this new config. Closes #31
1 parent 7cdd6af commit 4d9d6da

File tree

4 files changed

+62
-60
lines changed

4 files changed

+62
-60
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
language: java
22

33
jdk:
4-
- oraclejdk8
4+
- oraclejdk8
55

66
before_cache:
7-
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
7+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
88

99
cache:
1010
directories:
11-
- $HOME/.gradle/caches/
12-
- $HOME/.gradle/wrapper/
11+
- $HOME/.gradle/caches/
12+
- $HOME/.gradle/wrapper/

build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010
// tasks for building, running, testing, and
1111
// deploying Java applications.
1212
plugins {
13-
id 'java'
14-
id 'application'
13+
id 'java'
14+
id 'application'
1515
}
1616

1717
// In this section you declare where to find the dependencies of your project
1818
repositories {
19-
// Use jcenter for resolving your dependencies.
20-
// You can declare any Maven/Ivy/file repository here.
21-
jcenter()
19+
// Use jcenter for resolving your dependencies.
20+
// You can declare any Maven/Ivy/file repository here.
21+
jcenter()
2222
}
2323

2424
dependencies {
25-
// Use JUnit test framework
26-
testCompile 'junit:junit:4.12'
25+
// Use JUnit test framework
26+
testCompile 'junit:junit:4.12'
2727
}
2828

2929
// Define the main class for the application

src/main/java/Hellos.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@
44
*/
55
public class Hellos {
66

7-
public static final String WELCOME_LINE = "Hello, folks!";
7+
public static final String WELCOME_LINE = "Hello, folks!";
88

9-
public static void main(String[] args) {
10-
String output = generateOutput();
11-
System.out.println(output);
12-
}
9+
public static void main(String[] args) {
10+
String output = generateOutput();
11+
System.out.println(output);
12+
}
1313

14-
public static String generateOutput() {
15-
StringBuilder builder = new StringBuilder();
14+
public static String generateOutput() {
15+
StringBuilder builder = new StringBuilder();
1616

17-
builder.append(WELCOME_LINE + "\n");
18-
builder.append(kkSaysHello());
19-
builder.append(nicSaysHello());
17+
builder.append(WELCOME_LINE + "\n");
18+
builder.append(kkSaysHello());
19+
builder.append(nicSaysHello());
2020

21-
return builder.toString();
22-
}
21+
return builder.toString();
22+
}
2323

24-
private static String nicSaysHello() {
25-
return "Nic says 'Howdy!'\n";
26-
}
24+
private static String nicSaysHello() {
25+
return "Nic says 'Howdy!'\n";
26+
}
2727

28-
private static String kkSaysHello() {
29-
return "KK says 'Hello!'\n";
30-
}
28+
private static String kkSaysHello() {
29+
return "KK says 'Hello!'\n";
30+
}
3131

3232
}

src/test/java/HellosTest.java

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,50 @@
11
import org.junit.Before;
22
import org.junit.Test;
3+
34
import java.util.Arrays;
5+
46
import static org.junit.Assert.*;
57

68

79
public class HellosTest {
810

9-
String[] lines;
11+
String[] lines;
1012

11-
@Before
12-
public void setUp() {
13-
String output = Hellos.generateOutput();
14-
lines = output.split("\n");
15-
}
13+
@Before
14+
public void setUp() {
15+
String output = Hellos.generateOutput();
16+
lines = output.split("\n");
17+
}
1618

17-
@Test
18-
public void testLineStructure() {
19+
@Test
20+
public void testLineStructure() {
1921

20-
assertEquals("Welcome line isn't correct.", Hellos.WELCOME_LINE, lines[0]);
22+
assertEquals("Welcome line isn't correct.", Hellos.WELCOME_LINE, lines[0]);
2123

22-
// This regex supports unicode letters spaces, apostrophes, and hyphens
23-
// Taken from https://stackoverflow.com/questions/15805555/java-regex-to-validate-full-name-allow-only-spaces-and-letters
24-
// The pattern needs to include some name, the "says", and the single quotes... and they must speak with emphasis
25-
// as noted by the required "!"
26-
String linePattern = "[\\p{L} .'-]+ says '+[\\p{L} .'-]+!'";
24+
// This regex supports unicode letters spaces, apostrophes, and hyphens
25+
// Taken from https://stackoverflow.com/questions/15805555/java-regex-to-validate-full-name-allow-only-spaces-and-letters
26+
// The pattern needs to include some name, the "says", and the single quotes... and they must speak with emphasis
27+
// as noted by the required "!"
28+
String linePattern = "[\\p{L} .'-]+ says '+[\\p{L} .'-]+!'";
2729

28-
for (int i=1; i<lines.length; ++i) {
29-
assertTrue("Line <" + lines[i] + "> doesn't match", lines[i].matches(linePattern));
30-
}
30+
for (int i = 1; i < lines.length; ++i) {
31+
assertTrue("Line <" + lines[i] + "> doesn't match", lines[i].matches(linePattern));
3132
}
32-
33-
@Test
34-
public void testAlphabetization() {
35-
// Make another list that will be sorted except for the first line
36-
String output = Hellos.generateOutput();
37-
String[] sortedLines = output.split("\n");
38-
Arrays.sort(sortedLines, 1, sortedLines.length);
39-
40-
// Don't check the first line since we do that elsewhere, but compare the rest to be sure
41-
// the actual list matches the sorted list
42-
for (int i=1; i<lines.length; ++i) {
43-
assertTrue("Line " + i + " doesn't match: lines[" + i + "] is: " + lines[i] +
44-
" and sortedLines[" + i + "] is: " + sortedLines[i], lines[i].equals(sortedLines[i]));
45-
}
33+
}
34+
35+
@Test
36+
public void testAlphabetization() {
37+
// Make another list that will be sorted except for the first line
38+
String output = Hellos.generateOutput();
39+
String[] sortedLines = output.split("\n");
40+
Arrays.sort(sortedLines, 1, sortedLines.length);
41+
42+
// Don't check the first line since we do that elsewhere, but compare the rest to be sure
43+
// the actual list matches the sorted list
44+
for (int i = 1; i < lines.length; ++i) {
45+
assertTrue("Line " + i + " doesn't match: lines[" + i + "] is: " + lines[i] +
46+
" and sortedLines[" + i + "] is: " + sortedLines[i], lines[i].equals(sortedLines[i]));
4647
}
48+
}
4749

4850
}

0 commit comments

Comments
 (0)