Turned on checkstyle
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -31,8 +32,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -114,50 +113,60 @@ public class AzureSpringBootRequestHandlerTests {
|
||||
|
||||
@After
|
||||
public void close() throws IOException {
|
||||
if (handler != null)
|
||||
handler.close();
|
||||
if (this.handler != null) {
|
||||
this.handler.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
protected static class BareConfig {
|
||||
|
||||
@Bean
|
||||
public Function<Flux<Foo>, Flux<Bar>> function() {
|
||||
return foos -> foos.map(foo -> new Bar(foo.getValue().toUpperCase()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
protected static class AutoConfig {
|
||||
|
||||
@Bean
|
||||
public Function<Foo, Bar> uppercase() {
|
||||
return foo -> new Bar(foo.getValue().toUpperCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
protected static class ListConfig {
|
||||
|
||||
@Bean
|
||||
public Function<List<Foo>, List<Bar>> uppercase() {
|
||||
return foos -> foos.stream().map(foo -> new Bar(foo.getValue().toUpperCase()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
protected static class CollectConfig {
|
||||
|
||||
@Bean
|
||||
public Function<List<Foo>, Bar> uppercase() {
|
||||
return foos -> new Bar(foos.stream().map(foo -> foo.getValue().toUpperCase())
|
||||
.collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
protected static class MultiConfig {
|
||||
|
||||
@Bean
|
||||
public Function<Foo, Bar> uppercase() {
|
||||
return foo -> new Bar(foo.getValue().toUpperCase());
|
||||
@@ -167,6 +176,7 @@ public class AzureSpringBootRequestHandlerTests {
|
||||
public Function<Bar, Foo> lowercase() {
|
||||
return bar -> new Foo(bar.getValue().toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -178,25 +188,26 @@ class Foo {
|
||||
Foo() {
|
||||
}
|
||||
|
||||
public String lowercase() {
|
||||
return value.toLowerCase();
|
||||
}
|
||||
|
||||
public Foo(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String lowercase() {
|
||||
return this.value.toLowerCase();
|
||||
}
|
||||
|
||||
public String uppercase() {
|
||||
return value.toUpperCase();
|
||||
return this.value.toUpperCase();
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Bar {
|
||||
@@ -211,11 +222,11 @@ class Bar {
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.util.function.Function;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -31,8 +32,6 @@ import org.springframework.context.support.GenericApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -50,8 +49,9 @@ public class AzureSpringFunctionInitializerTests {
|
||||
|
||||
@After
|
||||
public void close() throws IOException {
|
||||
if (handler != null)
|
||||
handler.close();
|
||||
if (this.handler != null) {
|
||||
this.handler.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -84,18 +84,22 @@ public class AzureSpringFunctionInitializerTests {
|
||||
@SpringBootConfiguration
|
||||
@EnableAutoConfiguration
|
||||
protected static class BareConfig {
|
||||
|
||||
@Bean
|
||||
public Function<Foo, Bar> function() {
|
||||
return foo -> new Bar(foo.getValue().toUpperCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SpringBootConfiguration
|
||||
protected static class FunctionConfig implements Function<Foo, Bar> {
|
||||
|
||||
@Override
|
||||
public Bar apply(Foo foo) {
|
||||
return new Bar(foo.getValue().toUpperCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SpringBootConfiguration
|
||||
@@ -113,5 +117,7 @@ public class AzureSpringFunctionInitializerTests {
|
||||
"uppercase")
|
||||
.type(FunctionType.from(Foo.class).to(Bar.class)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import java.util.logging.Logger;
|
||||
import com.microsoft.azure.functions.ExecutionContext;
|
||||
|
||||
public class TestExecutionContext implements ExecutionContext {
|
||||
|
||||
private String name;
|
||||
|
||||
public TestExecutionContext(String name) {
|
||||
@@ -40,6 +41,7 @@ public class TestExecutionContext implements ExecutionContext {
|
||||
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user