Files
CipherStreamAPI/src/test/java/com/mattrixwv/cipherstream/controller/CipherStreamControllerIntegrationTestBase.java

53 lines
1.5 KiB
Java

package com.mattrixwv.cipherstream.controller;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import java.io.IOException;
import java.util.UUID;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.springframework.boot.autoconfigure.aop.AopAutoConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
import com.mattrixwv.cipherstream.aspect.CipherStreamLoggingAspect;
import com.mattrixwv.cipherstream.config.FullFilter;
import jakarta.servlet.ServletException;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.node.ObjectNode;
@Tag("integration-test")
@Import({AopAutoConfiguration.class, FullFilter.class, CipherStreamLoggingAspect.class})
public class CipherStreamControllerIntegrationTestBase{
//Filter
@MockitoSpyBean
private FullFilter fullFilter;
//Objects
protected ObjectNode decodedNode;
protected ObjectNode encodedNode;
//Fields
protected ObjectMapper mapper;
protected ObjectNode blankNode;
protected static final String REQUEST_ID = UUID.randomUUID().toString();
protected static final String IP_ADDRESS = "192.168.1.1";
@BeforeEach
public void setupJson(){
mapper = new ObjectMapper();
blankNode = mapper.createObjectNode();
}
@AfterEach
public void checkFilter() throws ServletException, IOException{
verify(fullFilter, times(1)).doFilter(any(), any(), any());
}
}