Merge branch '2.0.x'

This commit is contained in:
Phillip Webb
2018-05-04 16:31:46 -07:00
127 changed files with 419 additions and 210 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -30,4 +30,5 @@ public class TestMethodConfiguration {
public Object method() {
return null;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -29,4 +29,5 @@ import java.io.OutputStream;
@TestConditionalOnClass(name = "java.io.InputStream", value = OutputStream.class)
@TestAutoConfigureOrder(123)
public class TestOrderedClassConfiguration {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -151,8 +151,8 @@ public class ConfigurationMetadata {
}
candidates.removeIf((itemMetadata) -> !itemMetadata.hasSameType(metadata));
if (candidates.size() > 1 && metadata.getType() != null) {
candidates.removeIf((itemMetadata) ->
!metadata.getType().equals(itemMetadata.getType()));
candidates.removeIf(
(itemMetadata) -> !metadata.getType().equals(itemMetadata.getType()));
}
if (candidates.size() == 1) {
return candidates.get(0);

View File

@@ -742,8 +742,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
"java.lang.String", null, null, null, null, null);
writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withGroup("simple")
.fromSource(SimpleProperties.class));
assertThat(metadata)
.has(Metadata.withGroup("simple").fromSource(SimpleProperties.class));
assertThat(metadata).has(Metadata.withProperty("simple", String.class));
}

View File

@@ -57,8 +57,10 @@ public interface RandomAccessData {
* @param length the number of bytes to be read
* @return the data
* @throws IOException if the data cannot be read
* @throws IndexOutOfBoundsException if offset is beyond the end of the file or subsection
* @throws EOFException if offset plus length is greater than the length of the file or subsection
* @throws IndexOutOfBoundsException if offset is beyond the end of the file or
* subsection
* @throws EOFException if offset plus length is greater than the length of the file
* or subsection
*/
byte[] read(long offset, long length) throws IOException;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.

View File

@@ -110,20 +110,23 @@ public class RandomAccessDataFileTests {
}
@Test
public void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException() throws Exception {
public void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException()
throws Exception {
this.thrown.expect(IndexOutOfBoundsException.class);
RandomAccessData subsection = this.file.getSubsection(0, 10);
subsection.read(11, 0);
}
@Test
public void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException() throws Exception {
public void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException()
throws Exception {
this.thrown.expect(EOFException.class);
this.file.read(256, 1);
}
@Test
public void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException() throws Exception {
public void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException()
throws Exception {
this.thrown.expect(EOFException.class);
RandomAccessData subsection = this.file.getSubsection(0, 10);
subsection.read(10, 1);

View File

@@ -199,4 +199,5 @@ public class AsciiBytesTests {
private void matchesSameAsString(String input) {
assertThat(new AsciiBytes(input).matches(input, NO_SUFFIX)).isTrue();
}
}