Skip to content

Commit

Permalink
etc: Remove Unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
PENEKhun committed Mar 5, 2024
1 parent a7c7acc commit b710b19
Showing 1 changed file with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@

import static com.google.testing.compile.CompilationSubject.assertThat;
import static com.google.testing.compile.Compiler.javac;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import java.io.IOException;
import java.util.stream.Stream;

import javax.annotation.processing.Filer;
import javax.annotation.processing.Messager;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;

import org.junit.jupiter.api.Test;
Expand All @@ -39,7 +30,6 @@

import com.google.testing.compile.Compilation;
import com.google.testing.compile.JavaFileObjects;
import com.squareup.javapoet.JavaFile;

@SuppressWarnings("checkstyle:FinalLocalVariable")
class MethodBanProcessorTest {
Expand All @@ -60,22 +50,6 @@ void methodBanNotSupportUnderJava17() {
assertThat(compilation).hadErrorContaining("MethodBan is only supported in Java 17 or higher.");
}

@Test
void writeToOccurIoException() throws IOException {
// given
final Messager messager = mock(Messager.class);
final JavaFile javaFile = mock(JavaFile.class);
doThrow(IOException.class).when(javaFile).writeTo(any(Filer.class));

// when & then
JavaFileObject src = JavaFileObjects.forResource("before/MethodBanHappy.java");
Compilation compilation = javac()
.withProcessors(new org.easypeelsecurity.core.MethodBanProcessor())
.compile(src);

verify(messager, times(1)).printMessage(Diagnostic.Kind.ERROR, any());
}

@Test
void compileHappy() {
JavaFileObject src = JavaFileObjects.forResource("before/MethodBanHappy.java");
Expand Down

0 comments on commit b710b19

Please sign in to comment.