This commit is contained in:
Phillip Webb
2015-09-05 10:38:30 -07:00
parent 67402405db
commit 6e29ee4557
125 changed files with 638 additions and 506 deletions

View File

@@ -24,13 +24,13 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static junit.framework.TestCase.assertNotNull;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* Tests for {@link InitializrService}
@@ -104,7 +104,7 @@ public class InitializrServiceTests extends AbstractHttpClientMockTests {
mockSuccessfulMetadataGet(false);
CloseableHttpResponse response = mock(CloseableHttpResponse.class);
mockStatus(response, 500);
when(this.http.execute(isA(HttpGet.class))).thenReturn(response);
given(this.http.execute(isA(HttpGet.class))).willReturn(response);
ProjectGenerationRequest request = new ProjectGenerationRequest();
this.thrown.expect(ReportableException.class);
this.thrown.expectMessage("No content received from server");
@@ -126,7 +126,7 @@ public class InitializrServiceTests extends AbstractHttpClientMockTests {
CloseableHttpResponse response = mock(CloseableHttpResponse.class);
mockHttpEntity(response, "Foo-Bar-Not-JSON".getBytes(), "application/json");
mockStatus(response, 200);
when(this.http.execute(isA(HttpGet.class))).thenReturn(response);
given(this.http.execute(isA(HttpGet.class))).willReturn(response);
ProjectGenerationRequest request = new ProjectGenerationRequest();
this.thrown.expect(ReportableException.class);
this.thrown.expectMessage("Invalid content received from server");
@@ -137,7 +137,7 @@ public class InitializrServiceTests extends AbstractHttpClientMockTests {
public void loadMetadataNoContent() throws IOException {
CloseableHttpResponse response = mock(CloseableHttpResponse.class);
mockStatus(response, 500);
when(this.http.execute(isA(HttpGet.class))).thenReturn(response);
given(this.http.execute(isA(HttpGet.class))).willReturn(response);
ProjectGenerationRequest request = new ProjectGenerationRequest();
this.thrown.expect(ReportableException.class);
this.thrown.expectMessage("No content received from server");

View File

@@ -21,7 +21,7 @@ import java.io.IOException;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.StringContains.containsString;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
/**

View File

@@ -25,7 +25,10 @@ import java.util.Map.Entry;
*
* @author Andy Wilkinson
*/
public class SystemProperties {
public final class SystemProperties {
private SystemProperties() {
}
/**
* Performs the given {@code action} with the given system properties set. System