Skip to content

Commit

Permalink
chore: reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
berezovskyi committed Oct 21, 2024
1 parent ccd7ef8 commit b8d956c
Showing 1 changed file with 17 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,26 @@
*/
package org.eclipse.lyo.client;

import static java.time.Duration.ofSeconds;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertTimeout;

import java.io.IOException;
import java.net.URISyntaxException;

import javax.xml.namespace.QName;

import jakarta.ws.rs.client.Invocation.Builder;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status.Family;
import org.apache.http.HttpHeaders;
import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTimeout;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import javax.xml.namespace.QName;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Map;

import javax.xml.namespace.QName;

import org.apache.http.HttpHeaders;
import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import jakarta.ws.rs.client.Invocation.Builder;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status.Family;
import static java.time.Duration.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;

public class OslcClientTest {
/**
Expand All @@ -61,9 +46,7 @@ public void postInvalidOlscResource() throws IOException, URISyntaxException {
final OslcClient client = new OslcClient();
final ServiceProvider request = new ServiceProvider();
request.getExtendedProperties().put(new QName("http://example.com/ns#", "test"), "test");
Response response = client.createResource(
"http://open-services.net/.well-known/resource-that-should-not-exist-whose-status-code-should-not-be-200",
request, OSLCConstants.CT_RDF);
Response response = client.createResource("http://open-services.net/.well-known/resource-that-should-not-exist-whose-status-code-should-not-be-200", request, OSLCConstants.CT_RDF);
assertThat(response.getStatusInfo().getFamily() != Family.SUCCESSFUL);
// assertThrows(ClientErrorException.class, () -> {
//
Expand Down Expand Up @@ -94,13 +77,11 @@ public void testGetResource() {

clearInvocations(client);
client.getResource("test.url", "application/rdf+xml");
verify(client).doRequest("GET", "test.url", null, null, null, "application/rdf+xml", "application/rdf+xml",
null);
verify(client).doRequest("GET", "test.url", null, null, null, "application/rdf+xml", "application/rdf+xml", null);

clearInvocations(client);
client.getResource("test.url", Map.of("a", "b"), "application/rdf+xml", "oslc.context");
verify(client).doRequest("GET", "test.url", null, "oslc.context", null, "application/rdf+xml",
"application/rdf+xml", Map.of("a", "b"));
verify(client).doRequest("GET", "test.url", null, "oslc.context", null, "application/rdf+xml", "application/rdf+xml", Map.of("a", "b"));
}

@Test
Expand All @@ -113,8 +94,7 @@ public void testPutResource() {

clearInvocations(client);
client.updateResource("test.url", "artifact", "application/json", "*/*", "ifmatch", "configContext");
verify(client).doRequest("PUT", "test.url", "artifact", "configContext", "ifmatch", "application/json", "*/*",
null);
verify(client).doRequest("PUT", "test.url", "artifact", "configContext", "ifmatch", "application/json", "*/*", null);


clearInvocations(client);
Expand Down

0 comments on commit b8d956c

Please sign in to comment.