List of usage examples for org.apache.commons.codec EncoderException EncoderException
public EncoderException()
From source file:org.ligoj.app.plugin.prov.aws.auth.AWS4SignerBaseTest.java
/** * Test method for//from w w w .ja v a 2s . c om * {@link org.ligoj.app.plugin.prov.aws.auth.AWS4SignerBase#getCanonicalizedResourcePath(java.lang.String)}. */ @Test public void testGetCanonicalizedResourcePathEncodingException() throws EncoderException { final AWS4SignerBase signer = new AWS4SignerForAuthorizationHeader(); final URLCodec urlCodec = Mockito.mock(URLCodec.class); ReflectionTestUtils.setField(signer, "urlCodec", urlCodec); Mockito.when(urlCodec.encode(ArgumentMatchers.anyString())).thenThrow(new EncoderException()); Assertions.assertEquals("Error during resource path encoding", Assertions.assertThrows(TechnicalException.class, () -> { signer.getCanonicalizedResourcePath("/path"); }).getMessage()); }
From source file:org.ligoj.app.plugin.prov.aws.auth.AWS4SignerBaseTest.java
/** * Test method for//from www . j a v a 2 s.co m * {@link org.ligoj.app.plugin.prov.aws.auth.AWS4SignerBase#getCanonicalizedQueryString(java.util.Map)}. */ @Test public void testGetCanonicalizedQueryStringException() throws EncoderException { final AWS4SignerBase signer = new AWS4SignerForAuthorizationHeader(); final URLCodec urlCodec = Mockito.mock(URLCodec.class); ReflectionTestUtils.setField(signer, "urlCodec", urlCodec); Mockito.when(urlCodec.encode(ArgumentMatchers.anyString())).thenThrow(new EncoderException()); Assertions.assertEquals("Error during parameters encoding", Assertions.assertThrows(TechnicalException.class, () -> { signer.getCanonicalizedQueryString(ImmutableMap.of("q2", "v2", "q1", "v1")); }).getMessage()); }
From source file:org.ligoj.app.plugin.vm.aws.auth.AWS4SignerBaseTest.java
/** * Test method for//from ww w .ja v a2 s . c o m * {@link org.ligoj.app.plugin.prov.aws.auth.AWS4SignerBase#getCanonicalizedResourcePath(java.lang.String)}. */ @Test public void testGetCanonicalizedResourcePathEncodingException() throws Exception { final AWS4SignerBase signer = new AWS4SignerVMForAuthorizationHeader(); final URLCodec urlCodec = Mockito.mock(URLCodec.class); ReflectionTestUtils.setField(signer, "urlCodec", urlCodec); Mockito.when(urlCodec.encode(ArgumentMatchers.anyString())).thenThrow(new EncoderException()); Assertions.assertEquals("Error during resource path encoding", Assertions.assertThrows(TechnicalException.class, () -> { signer.getCanonicalizedResourcePath("/path"); }).getMessage()); }
From source file:org.ligoj.app.plugin.vm.aws.auth.AWS4SignerBaseTest.java
/** * Test method for/*from ww w .j a v a2s . c o m*/ * {@link org.ligoj.app.plugin.prov.aws.auth.AWS4SignerBase#getCanonicalizedQueryString(java.util.Map)}. */ @Test public void testGetCanonicalizedQueryStringException() throws EncoderException { final AWS4SignerBase signer = new AWS4SignerVMForAuthorizationHeader(); final URLCodec urlCodec = Mockito.mock(URLCodec.class); ReflectionTestUtils.setField(signer, "urlCodec", urlCodec); Mockito.when(urlCodec.encode(ArgumentMatchers.anyString())).thenThrow(new EncoderException()); Assertions.assertEquals("Error during parameters encoding", Assertions.assertThrows(TechnicalException.class, () -> { signer.getCanonicalizedQueryString(ImmutableMap.of("q2", "v2", "q1", "v1")); }).getMessage()); }