package com.pgf.mqspring.component.impl; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.*; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.springframework.test.util.ReflectionTestUtils; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.model.S3Object; import com.pgf.mqspring.component.MqSpringMessageSourceComponent; import com.pgf.mqspring.model.TelegramInfoModel; class TelegramInfoComponentImplTest02 { @Mock AmazonS3 s3Client; @Mock MqSpringMessageSourceComponent messageSource; TelegramInfoComponentImpl target; @BeforeEach void beforeEach() throws IOException { MockitoAnnotations.openMocks(this); S3Object s3Object = new S3Object(); s3Object.setObjectContent(new ByteArrayInputStream(new byte[0])); Mockito.when(s3Client.getObject(anyString(), anyString())).thenReturn(s3Object); target = new TelegramInfoComponentImpl(s3Client, messageSource, "", ""); } @Test void getTelegramInfoMap01() { Map> telegramInfoMap = new HashMap<>(); telegramInfoMap.put("key", null); ReflectionTestUtils.setField(target, "telegramInfoMap", telegramInfoMap); assertEquals(telegramInfoMap, target.getTelegramInfoMap()); } }