🎨 Gradle 6 - Format code

This commit is contained in:
Johnathan Gilday 2019-12-20 12:23:13 -05:00
parent dfb9147fc9
commit 3a26ab3460
6 changed files with 46 additions and 51 deletions

View File

@ -2,6 +2,7 @@ package com.baeldung.gradle;
import com.google.common.collect.ImmutableList;
import io.reactivex.Observable;
import java.util.List;
/** Demonstrates a library type that returns an RxJava type. */
@ -14,5 +15,6 @@ public class RxHelloWorld {
return Observable.fromIterable(values);
}
private RxHelloWorld() {}
private RxHelloWorld() {
}
}

View File

@ -1,14 +1,13 @@
package com.baeldung.gradle;
import static com.baeldung.gradle.RxHelloWorld.hello;
import org.junit.jupiter.api.Test;
import static com.baeldung.gradle.RxHelloWorld.hello;
/** Unit test for {@link RxHelloWorld}. */
final class RxHelloWorldUnitTest {
@Test
void it_emits_hello_world_values() {
@Test void it_emits_hello_world_values() {
hello().test().assertValues("hello", "world").assertComplete();
}
}

View File

@ -4,11 +4,9 @@ import com.baeldung.fibonacci.FibonacciSequenceGenerator;
import com.google.auto.service.AutoService;
/** Recursive implementation of the {@link FibonacciSequenceGenerator}. */
@AutoService(FibonacciSequenceGenerator.class)
public final class RecursiveFibonacci implements FibonacciSequenceGenerator {
@AutoService(FibonacciSequenceGenerator.class) public final class RecursiveFibonacci implements FibonacciSequenceGenerator {
@Override
public int generate(int nth) {
@Override public int generate(int nth) {
if (nth < 0) {
throw new IllegalArgumentException("sequence number must be 0 or greater");
}

View File

@ -8,9 +8,7 @@ import com.baeldung.fibonacci.FibonacciSequenceGeneratorFixture;
* the fibonacci-spi project.
*/
final class RecursiveFibonacciUnitTest implements FibonacciSequenceGeneratorFixture {
@Override
public FibonacciSequenceGenerator provide() {
@Override public FibonacciSequenceGenerator provide() {
return new RecursiveFibonacci();
}
}

View File

@ -1,10 +1,10 @@
package com.baeldung.fibonacci;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
/**
* Reusable test fixture for {@link FibonacciSequenceGenerator} implementations. Tests will be
* skipped if no such implementation exists.
@ -14,16 +14,14 @@ public interface FibonacciSequenceGeneratorFixture {
/** @return the implementation of {@link FibonacciSequenceGenerator} to test. Must not be null */
FibonacciSequenceGenerator provide();
@Test
default void when_sequence_index_is_negative_then_throws() {
@Test default void when_sequence_index_is_negative_then_throws() {
final FibonacciSequenceGenerator generator = provide();
assertThrows(IllegalArgumentException.class, () -> generator.generate(-1));
}
@Test
default void when_given_index_then_generates_fibonacci_number() {
@Test default void when_given_index_then_generates_fibonacci_number() {
final FibonacciSequenceGenerator generator = provide();
final int[] sequence = {0, 1, 1, 2, 3, 5, 8};
final int[] sequence = { 0, 1, 1, 2, 3, 5, 8 };
for (int i = 0; i < sequence.length; i++) {
assertEquals(sequence[i], generator.generate(i));
}