minor formatting work

This commit is contained in:
eugenp
2016-11-30 09:05:38 +02:00
parent 7194d8b84a
commit f354f9e305
10 changed files with 22 additions and 35 deletions

View File

@@ -12,7 +12,7 @@ public class GenericsTest {
// testing the generic method with Integer
@Test
public void givenArrayOfIntegers_thanListOfIntegersReturnedOK() {
Integer[] intArray = {1, 2, 3, 4, 5};
Integer[] intArray = { 1, 2, 3, 4, 5 };
List<Integer> list = Generics.fromArrayToList(intArray);
assertThat(list, hasItems(intArray));
@@ -21,7 +21,7 @@ public class GenericsTest {
// testing the generic method with String
@Test
public void givenArrayOfStrings_thanListOfStringsReturnedOK() {
String[] stringArray = {"hello1", "hello2", "hello3", "hello4", "hello5"};
String[] stringArray = { "hello1", "hello2", "hello3", "hello4", "hello5" };
List<String> list = Generics.fromArrayToList(stringArray);
assertThat(list, hasItems(stringArray));
@@ -32,7 +32,7 @@ public class GenericsTest {
// extend Number it will fail to compile
@Test
public void givenArrayOfIntegersAndNumberUpperBound_thanListOfIntegersReturnedOK() {
Integer[] intArray = {1, 2, 3, 4, 5};
Integer[] intArray = { 1, 2, 3, 4, 5 };
List<Integer> list = Generics.fromArrayToListWithUpperBound(intArray);
assertThat(list, hasItems(intArray));

View File

@@ -4,12 +4,10 @@ import org.junit.Test;
import static org.junit.Assert.*;
public class SHA256HashingTest {
private static String originalValue = "abc123";
private static String hashedValue =
"6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090";
private static String hashedValue = "6ca13d52ca70c883e0f0bb101e425a89e8624de51db2d2392593af6a84118090";
@Test
public void testHashWithJavaMessageDigest() throws Exception {

View File

@@ -119,8 +119,7 @@ public class StringConversionTest {
int afterConvCalendarDay = 03;
Month afterConvCalendarMonth = Month.DECEMBER;
int afterConvCalendarYear = 2007;
LocalDateTime afterConvDate
= new UseLocalDateTime().getLocalDateTimeUsingParseMethod(str);
LocalDateTime afterConvDate = new UseLocalDateTime().getLocalDateTimeUsingParseMethod(str);
assertEquals(afterConvDate.getDayOfMonth(), afterConvCalendarDay);
assertEquals(afterConvDate.getMonth(), afterConvCalendarMonth);

View File

@@ -66,6 +66,7 @@ public class AsyncEchoServer {
AsyncEchoServer server = new AsyncEchoServer();
server.runServer();
}
public static Process start() throws IOException, InterruptedException {
String javaHome = System.getProperty("java.home");
String javaBin = javaHome + File.separator + "bin" + File.separator + "java";

View File

@@ -81,7 +81,6 @@ public class AsyncEchoServer2 {
}
public static void main(String[] args) {
new AsyncEchoServer2();
}

View File

@@ -82,8 +82,7 @@ public class AsyncFileTest {
public void givenPathAndContent_whenWritesToFileWithHandler_thenCorrect() throws IOException {
String fileName = UUID.randomUUID().toString();
Path path = Paths.get(fileName);
AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE,StandardOpenOption.DELETE_ON_CLOSE);
AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.DELETE_ON_CLOSE);
ByteBuffer buffer = ByteBuffer.allocate(1024);
buffer.put("hello world".getBytes());

View File

@@ -20,7 +20,6 @@ public class JavaFileUnitTest {
private static final String TEMP_DIR = "src/test/resources/temp" + UUID.randomUUID().toString();
@BeforeClass
public static void setup() throws IOException {
Files.createDirectory(Paths.get(TEMP_DIR));

View File

@@ -1,14 +1,14 @@
package org.baeldung.java.sorting;
public class Employee implements Comparable {
private String name;
private int age;
private double salary;
public Employee(String name, int age, double salary) {
this.name = name;
this.age = age;
this.name = name;
this.age = age;
this.salary = salary;
}
@@ -35,7 +35,7 @@ public class Employee implements Comparable {
public void setSalary(double salary) {
this.salary = salary;
}
@Override
public boolean equals(Object obj) {
return ((Employee) obj).getName().equals(getName());
@@ -46,13 +46,10 @@ public class Employee implements Comparable {
Employee e = (Employee) o;
return getName().compareTo(e.getName());
}
@Override
public String toString() {
return new StringBuffer()
.append("(").append(getName())
.append(getAge()).append(",")
.append(getSalary()).append(")").toString();
return new StringBuffer().append("(").append(getName()).append(getAge()).append(",").append(getSalary()).append(")").toString();
}
}