Skip to content

unable to build dubbo-common ( unit test fail in AdaptiveClassCodeGeneratorTest ) #5877

@AlbumenJ

Description

@AlbumenJ
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.5
  • Operating System version: Windows 10 1903
  • Java version: 1.8.0_221

Steps to reproduce this issue

  1. in root folder execute "mvn clean test"

Expected Result

pass unit test

Actual Result

org.opentest4j.AssertionFailedError: expected: but was:
at org.apache.dubbo.common.extension.AdaptiveClassCodeGeneratorTest.testGenerate(AdaptiveClassCodeGeneratorTest.java:45)

Any try

the souce of is AdaptiveClassCodeGeneratorTest

public class AdaptiveClassCodeGeneratorTest {

    @Test
    public void testGenerate() throws IOException {
        AdaptiveClassCodeGenerator generator = new AdaptiveClassCodeGenerator(HasAdaptiveExt.class, "adaptive");
        String value = generator.generate();
        URL url = getClass().getResource("/org/apache/dubbo/common/extension/adaptive/HasAdaptiveExt$Adaptive");
        try (InputStream inputStream = url.openStream()) {
            String content = IOUtils.read(new InputStreamReader(inputStream, "UTF-8"));
            assertTrue(content.contains(value));
        }
    }
}

When I add the following code to it, the unit pass.

            value = value.replace("\r","");
            value = value.replace("\n","");
            content = content.replace("\r","");
            content = content.replace("\n","");

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedEverything needs help from contributors

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions