Skip to content
Snippets Groups Projects
Commit 071e5952 authored by Aalekh Jain's avatar Aalekh Jain
Browse files

Using Autowired instead of Inject in `LegalTagPublisherImpl.java`. Updated UT...

Using Autowired instead of Inject in `LegalTagPublisherImpl.java`. Updated UT for not using constructor made explicitly for unit testing purpose
parent 0a997999
No related branches found
No related tags found
1 merge request!61Improve code coverage
Pipeline #9807 failed
......@@ -23,28 +23,22 @@ import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.model.legal.StatusChangedTags;
import org.opengroup.osdu.legal.provider.interfaces.ILegalTagPublisher;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
@NoArgsConstructor
@Component
public class LegalTagPublisherImpl implements ILegalTagPublisher {
@Inject
@Autowired
private TopicClient topicClient;
@Inject
@Autowired
private JaxRsDpsLog logger;
// Constructor made for unit testing
public LegalTagPublisherImpl (TopicClient topicClient, JaxRsDpsLog logger) {
this.topicClient = topicClient;
this.logger = logger;
}
@Override
public void publish(String projectId, DpsHeaders headers, StatusChangedTags tags) throws Exception {
Gson gson = new Gson();
......
......@@ -63,7 +63,6 @@ public class LegalTagPublisherImplTest {
doReturn(DATA_PARTITION_WITH_FALLBACK_ACCOUNT_ID).when(headers).getPartitionIdWithFallbackToAccountId();
doReturn(CORRELATION_ID).when(headers).getCorrelationId();
doReturn(USER_EMAIL).when(headers).getUserEmail();
sut = new LegalTagPublisherImpl(topicClient, logger);
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment