You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/08/22 15:23:14 UTC
[camel] branch CAMEL-13870 updated: Stop using mockito its a pain
....
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/CAMEL-13870 by this push:
new d228f30 Stop using mockito its a pain ....
d228f30 is described below
commit d228f30e87ad411001342f79ccb4303387d3b2e6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 22 17:10:00 2019 +0200
Stop using mockito its a pain ....
---
.../camel/component/atmos/AtmosComponentTest.java | 92 ----------------------
1 file changed, 92 deletions(-)
diff --git a/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosComponentTest.java b/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosComponentTest.java
deleted file mode 100644
index b4eb5bc..0000000
--- a/components/camel-atmos/src/test/java/org/apache/camel/component/atmos/AtmosComponentTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.atmos;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.util.URISupport;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.AdditionalAnswers.returnsFirstArg;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AtmosComponentTest {
-
- private static final String FAKE_REMOTE_PATH = "/remote";
- private static final String FAKE_SECRET = "fake-secret";
- private static final String FAKE_TOKEN = "fake-token";
- private static final String FAKE_URI = "http://fake/uri";
-
- @Mock
- private CamelContext context;
-
- @Test
- public void testComponentOptions() throws Exception {
- when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-
- AtmosComponent component = new AtmosComponent(context);
- component.setFullTokenId(FAKE_TOKEN);
- component.setSecretKey(FAKE_SECRET);
- component.setSslValidation(false);
- component.setUri(FAKE_URI);
-
- Map<String, Object> parameters = new HashMap<>();
- parameters.put("remotePath", FAKE_REMOTE_PATH);
-
- AtmosEndpoint endpoint = component.createEndpoint("atmos://foo?remotePath=/remote", "foo/get", parameters);
- AtmosConfiguration configuration = endpoint.getConfiguration();
-
- assertEquals(FAKE_TOKEN, configuration.getFullTokenId());
- assertEquals(FAKE_SECRET, configuration.getSecretKey());
- assertEquals(false, configuration.isSslValidation());
- assertEquals(FAKE_URI, configuration.getUri());
- }
-
- @Test
- public void testUriParamsOverrideComponentOptions() throws Exception {
- when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-
- AtmosComponent component = new AtmosComponent(context);
- component.setFullTokenId("fakeTokenToBeOverridden");
- component.setSecretKey("fakeSecretToBeOverridden");
- component.setSslValidation(true);
- component.setUri("http://fake/uri/to/be/overridden");
-
- Map<String, Object> parameters = new HashMap<>();
- parameters.put("remotePath", FAKE_REMOTE_PATH);
- parameters.put("fullTokenId", FAKE_TOKEN);
- parameters.put("secretKey", FAKE_SECRET);
- parameters.put("sslValidation", false);
- parameters.put("uri", FAKE_URI);
-
- String uri = URISupport.appendParametersToURI("atmos://foo", parameters);
- AtmosEndpoint endpoint = component.createEndpoint(uri, "foo/get", parameters);
- AtmosConfiguration configuration = endpoint.getConfiguration();
-
- assertEquals(FAKE_TOKEN, configuration.getFullTokenId());
- assertEquals(FAKE_SECRET, configuration.getSecretKey());
- assertEquals(false, configuration.isSslValidation());
- assertEquals(FAKE_URI, configuration.getUri());
- }
-}