Skip to content

Commit

Permalink
log
Browse files Browse the repository at this point in the history
  • Loading branch information
janolaveide committed Jun 18, 2021
1 parent a9dcf43 commit e7927c2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ private <T> T handle(RuntimeException e, Class<? extends RuntimeException>... tr

private RuntimeException translate(RuntimeException e) {
try {
throw invokeConstructor(translatedException, "F-999999", "Oversatte exception " + e.getClass().getName(), e);
throw invokeConstructor(translatedException, "F-999999",
"Oversatte exception " + e.getClass().getName() + " til " + translatedException.getClass().getName(), e);
} catch (VLException v) {
throw v;
} catch (Exception e1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.when;

import java.net.URI;

import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;

import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
Expand Down Expand Up @@ -46,4 +50,26 @@ public String answer(InvocationOnMock invocation) throws Throwable {
() -> new ExceptionTranslatingInvoker(TekniskException.class).invoke(i, String.class, NullPointerException.class));
}

@Test
void testQ() throws Exception {
URI uri = URI.create("/fpsak/api/behandling/aksjonspunkt-v2?uuid=b3aa9a5f-fc0e-4342-b916-48fc821764ba");
URI base = URI.create("http://fpsak");
var r = split(uri.getQuery());
System.out.println(r);
var t = ClientBuilder.newClient().target(base).path(uri.getRawPath()).queryParam(r.key, r.value);
System.out.println(t.getUri());

}

private static Query split(String query) {
var parts = StringUtils.split(query, '=');
if (parts.length != 2) {
throw new IllegalArgumentException("Uventet query " + query);
}
return new Query(parts[0], parts[1]);
}

private static record Query(String key, String value) {

}
}

0 comments on commit e7927c2

Please sign in to comment.