Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.tencent.trpc.codegen.protoc.Protoc;
import com.tencent.trpc.codegen.protoc.ProtocTest;
import com.tencent.trpc.codegen.util.JarUtils;
import org.junit.Assert;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
Expand All @@ -25,6 +24,7 @@
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.jar.JarFile;
import org.junit.jupiter.api.Assertions;

public class CodegenTestHelper {
public static final Path TEST_ROOT = getTestClassesRoot(); // target/test-classes
Expand All @@ -34,13 +34,13 @@ public class CodegenTestHelper {

private static Path getTestClassesRoot() {
URL url = ProtocTest.class.getClassLoader().getResource("TEST-1/hello.proto");
Assert.assertNotNull(url);
Assertions.assertNotNull(url);
return Paths.get(url.getPath()).getParent().getParent();
}

private static Path getImportRoot() {
URL url = Protoc.class.getClassLoader().getResource("imports/trpc.proto");
Assert.assertNotNull(url);
Assertions.assertNotNull(url);
Path importRoot = Paths.get(url.getPath()).getParent();
try {
extractCommonProtoFiles(importRoot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import com.google.protobuf.Descriptors.FileDescriptor;
import com.tencent.trpc.codegen.CodegenTestHelper;
import com.tencent.trpc.codegen.protoc.ProtocTest;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -26,7 +26,7 @@
public class DescriptorProtoCompileTest {
private static final Path rootPath = CodegenTestHelper.TEST_ROOT;

@BeforeClass
@BeforeAll
public static void prepare() {
Path descriptorFile = rootPath.resolve("hello.pb");
if (!Files.exists(descriptorFile)) {
Expand All @@ -39,11 +39,11 @@ public static void prepare() {
public void testParseProtoDescriptorSet() throws IOException {
Path descriptorFile = rootPath.resolve("hello.pb");
FileDescriptorSet set = ProtoParser.parseDescriptorSetFile(descriptorFile);
Assert.assertEquals(5, set.getFileCount());
Assertions.assertEquals(5, set.getFileCount());
FileDescriptorsCompiler compiler = new FileDescriptorsCompiler(set.getFileList());
List<FileDescriptor> fdList = compiler.compile();
Assert.assertEquals(5, fdList.size());
Assertions.assertEquals(5, fdList.size());
ProtoSourceInfo sourceInfo = ProtoParser.parseFileDescriptors(fdList);
Assert.assertEquals(1, sourceInfo.getServices().size());
Assertions.assertEquals(1, sourceInfo.getServices().size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
package com.tencent.trpc.codegen.protoc;

import com.tencent.trpc.codegen.CodegenTestHelper;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -37,7 +37,7 @@ public void testGenerateDescriptorSet() {
.importPaths(Collections.singletonList(importPath))
.output(rootPath.resolve("hello.pb"))
.build());
Assert.assertTrue(result.isSuccess());
Assertions.assertTrue(result.isSuccess());
}

/**
Expand All @@ -52,7 +52,7 @@ public void testGenerateDescriptorSetError() {
.importPaths(Collections.singletonList(importPath))
.output(rootPath.resolve("hello2.pb"))
.build());
Assert.assertFalse(result.isSuccess());
Assertions.assertFalse(result.isSuccess());
}

/**
Expand All @@ -67,7 +67,7 @@ public void testGenerateDescriptorSetFailed() {
.importPaths(Collections.singletonList(importPath))
.output(rootPath.resolve("non-exist.pb"))
.build());
Assert.assertFalse(result.isSuccess());
Assertions.assertFalse(result.isSuccess());
}

/**
Expand All @@ -85,6 +85,6 @@ public void testGenerateStub() throws IOException {
.language(Language.JAVA)
.output(outPath)
.build());
Assert.assertTrue(result.isSuccess());
Assertions.assertTrue(result.isSuccess());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.StringWriter;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
package com.tencent.trpc.codegen.template;

import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class TemplateEngineTest {

Expand All @@ -30,6 +30,6 @@ public void testTemplateEngine() {
+ " <#assign name = rtxName>\n"
+ "</#if>\n"
+ "hello ${name}!", context);
Assert.assertEquals("hello kelgonwu!", text);
Assertions.assertEquals("hello kelgonwu!", text);
}
}
10 changes: 10 additions & 0 deletions trpc-configcenter/trpc-configcenter-nacos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,15 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-properties</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading
Loading