org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\new...> but was:<[C:]\path\to\the\pom\new...>

Spring JIRA | Matej Spiller-Muys | 5 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    would it be better to change FileUtils so it could work regardless of what Path.separator value is? First test is due to that object reference can be less that 8 chars: return tsc.toString().replaceFirst("@[0-9a-f]{8}", ":"); (change '{8}' to '+') ------------------------------------------------------------------------------- Test set: org.springframework.roo.metadata.DefaultMetadataServiceTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.049 sec <<< FAILURE! testToStringOfNewInstance(org.springframework.roo.metadata.DefaultMetadataServiceTest) Time elapsed: 0.02 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<...faultMetadataService[:] validGets = 0, recu...> but was:<...faultMetadataService[@9664a1] validGets = 0, recu...> at org.junit.Assert.assertEquals(Assert.java:125) at org.junit.Assert.assertEquals(Assert.java:147) at org.springframework.roo.metadata.DefaultMetadataServiceTest.testToStringOfNewInstance(DefaultMetadataServiceTest.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ------------------------------------------------------------------------------- Test set: org.springframework.roo.project.maven.PomTest ------------------------------------------------------------------------------- Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.005 sec <<< FAILURE! testDefaultPackaging(org.springframework.roo.project.maven.PomTest) Time elapsed: 0.002 sec <<< ERROR! java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1937) at org.springframework.roo.support.util.FileUtils.backOneDirectory(FileUtils.java:163) at org.springframework.roo.support.util.FileUtils.getFirstDirectory(FileUtils.java:151) at org.springframework.roo.project.Path.getModulePath(Path.java:133) at org.springframework.roo.project.maven.Pom.cachePhysicalPaths(Pom.java:115) at org.springframework.roo.project.maven.Pom.<init>(Pom.java:106) at org.springframework.roo.project.maven.PomTest.getMinimalPom(PomTest.java:76) at org.springframework.roo.project.maven.PomTest.testDefaultPackaging(PomTest.java:37) testGetModulePathsForMinimalJarPom(org.springframework.roo.project.maven.PomTest) Time elapsed: 0 sec <<< ERROR! java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1937) at org.springframework.roo.support.util.FileUtils.backOneDirectory(FileUtils.java:163) at org.springframework.roo.support.util.FileUtils.getFirstDirectory(FileUtils.java:151) at org.springframework.roo.project.Path.getModulePath(Path.java:133) at org.springframework.roo.project.maven.Pom.cachePhysicalPaths(Pom.java:115) at org.springframework.roo.project.maven.Pom.<init>(Pom.java:106) at org.springframework.roo.project.maven.PomTest.getMinimalPom(PomTest.java:76) at org.springframework.roo.project.maven.PomTest.testGetModulePathsForMinimalJarPom(PomTest.java:43) testGetAsDependency(org.springframework.roo.project.maven.PomTest) Time elapsed: 0.001 sec <<< ERROR! java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1937) at org.springframework.roo.support.util.FileUtils.backOneDirectory(FileUtils.java:163) at org.springframework.roo.support.util.FileUtils.getFirstDirectory(FileUtils.java:151) at org.springframework.roo.project.Path.getModulePath(Path.java:133) at org.springframework.roo.project.maven.Pom.cachePhysicalPaths(Pom.java:115) at org.springframework.roo.project.maven.Pom.<init>(Pom.java:106) at org.springframework.roo.project.maven.PomTest.getMinimalPom(PomTest.java:76) at org.springframework.roo.project.maven.PomTest.testGetAsDependency(PomTest.java:61) Tests run: 5, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec <<< FAILURE! testGetIdentifierForRootModuleWithEmptyRelativePath(org.springframework.roo.project.MavenPathResolvingStrategyTest) Time elapsed: 0.004 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\src...> but was:<[C:]\path\to\the\pom\src...> at org.junit.Assert.assertEquals(Assert.java:125) at org.junit.Assert.assertEquals(Assert.java:147) at org.springframework.roo.project.MavenPathResolvingStrategyTest.assertIdentifier(MavenPathResolvingStrategyTest.java:76) at org.springframework.roo.project.MavenPathResolvingStrategyTest.testGetIdentifierForRootModuleWithEmptyRelativePath(MavenPathResolvingStrategyTest.java:82) testGetIdentifierForRootModuleWithNonEmptyRelativePath(org.springframework.roo.project.MavenPathResolvingStrategyTest) Time elapsed: 0.002 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\src...> but was:<[C:]\path\to\the\pom\src...> at org.junit.Assert.assertEquals(Assert.java:125) at org.junit.Assert.assertEquals(Assert.java:147) at org.springframework.roo.project.MavenPathResolvingStrategyTest.assertIdentifier(MavenPathResolvingStrategyTest.java:76) at org.springframework.roo.project.MavenPathResolvingStrategyTest.testGetIdentifierForRootModuleWithNonEmptyRelativePath(MavenPathResolvingStrategyTest.java:89) testGetIdentifierForNewModuleWithEmptyRelativePath(org.springframework.roo.project.MavenPathResolvingStrategyTest) Time elapsed: 0.003 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\new...> but was:<[C:]\path\to\the\pom\new...> at org.junit.Assert.assertEquals(Assert.java:125) at org.junit.Assert.assertEquals(Assert.java:147) at org.springframework.roo.project.MavenPathResolvingStrategyTest.assertIdentifier(MavenPathResolvingStrategyTest.java:76) at org.springframework.roo.project.MavenPathResolvingStrategyTest.testGetIdentifierForNewModuleWithEmptyRelativePath(MavenPathResolvingStrategyTest.java:97) ------------------------------------------------------------------------------- Test set: org.springframework.roo.project.PomManagementServiceImplTest ------------------------------------------------------------------------------- Tests run: 6, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.045 sec <<< FAILURE! testGetPomsOfMultiModuleProjectWhenParentAndChildAreDirty(org.springframework.roo.project.PomManagementServiceImplTest) Time elapsed: 0.01 sec <<< ERROR! java.lang.IllegalArgumentException: InputStream required at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.support.util.XmlUtils.readXml(XmlUtils.java:107) at org.springframework.roo.project.PomManagementServiceImpl.resolveParentPom(PomManagementServiceImpl.java:202) at org.springframework.roo.project.PomManagementServiceImpl.resolvePoms(PomManagementServiceImpl.java:189) at org.springframework.roo.project.PomManagementServiceImpl.resolveChildModulePoms(PomManagementServiceImpl.java:219) at org.springframework.roo.project.PomManagementServiceImpl.resolvePoms(PomManagementServiceImpl.java:192) at org.springframework.roo.project.PomManagementServiceImpl.parseUnparsedPoms(PomManagementServiceImpl.java:164) at org.springframework.roo.project.PomManagementServiceImpl.updatePomCache(PomManagementServiceImpl.java:140) at org.springframework.roo.project.PomManagementServiceImpl.getPoms(PomManagementServiceImpl.java:282) at org.springframework.roo.project.PomManagementServiceImplTest.testGetPomsOfMultiModuleProjectWhenParentAndChildAreDirty(PomManagementServiceImplTest.java:184) testGetPomsOfMultiModuleProjectWhenChildIsDirty(org.springframework.roo.project.PomManagementServiceImplTest) Time elapsed: 0.006 sec <<< ERROR! java.lang.IllegalArgumentException: InputStream required at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.support.util.XmlUtils.readXml(XmlUtils.java:107) at org.springframework.roo.project.PomManagementServiceImpl.resolveParentPom(PomManagementServiceImpl.java:202) at org.springframework.roo.project.PomManagementServiceImpl.resolvePoms(PomManagementServiceImpl.java:189) at org.springframework.roo.project.PomManagementServiceImpl.parseUnparsedPoms(PomManagementServiceImpl.java:164) at org.springframework.roo.project.PomManagementServiceImpl.updatePomCache(PomManagementServiceImpl.java:140) at org.springframework.roo.project.PomManagementServiceImpl.getPoms(PomManagementServiceImpl.java:282) at org.springframework.roo.project.PomManagementServiceImplTest.testGetPomsOfMultiModuleProjectWhenChildIsDirty(PomManagementServiceImplTest.java:214)

    Spring JIRA | 5 years ago | Matej Spiller-Muys
    org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\new...> but was:<[C:]\path\to\the\pom\new...>
  2. 0

    would it be better to change FileUtils so it could work regardless of what Path.separator value is? First test is due to that object reference can be less that 8 chars: return tsc.toString().replaceFirst("@[0-9a-f]{8}", ":"); (change '{8}' to '+') ------------------------------------------------------------------------------- Test set: org.springframework.roo.metadata.DefaultMetadataServiceTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.049 sec <<< FAILURE! testToStringOfNewInstance(org.springframework.roo.metadata.DefaultMetadataServiceTest) Time elapsed: 0.02 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<...faultMetadataService[:] validGets = 0, recu...> but was:<...faultMetadataService[@9664a1] validGets = 0, recu...> at org.junit.Assert.assertEquals(Assert.java:125) at org.junit.Assert.assertEquals(Assert.java:147) at org.springframework.roo.metadata.DefaultMetadataServiceTest.testToStringOfNewInstance(DefaultMetadataServiceTest.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ------------------------------------------------------------------------------- Test set: org.springframework.roo.project.maven.PomTest ------------------------------------------------------------------------------- Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.005 sec <<< FAILURE! testDefaultPackaging(org.springframework.roo.project.maven.PomTest) Time elapsed: 0.002 sec <<< ERROR! java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1937) at org.springframework.roo.support.util.FileUtils.backOneDirectory(FileUtils.java:163) at org.springframework.roo.support.util.FileUtils.getFirstDirectory(FileUtils.java:151) at org.springframework.roo.project.Path.getModulePath(Path.java:133) at org.springframework.roo.project.maven.Pom.cachePhysicalPaths(Pom.java:115) at org.springframework.roo.project.maven.Pom.<init>(Pom.java:106) at org.springframework.roo.project.maven.PomTest.getMinimalPom(PomTest.java:76) at org.springframework.roo.project.maven.PomTest.testDefaultPackaging(PomTest.java:37) testGetModulePathsForMinimalJarPom(org.springframework.roo.project.maven.PomTest) Time elapsed: 0 sec <<< ERROR! java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1937) at org.springframework.roo.support.util.FileUtils.backOneDirectory(FileUtils.java:163) at org.springframework.roo.support.util.FileUtils.getFirstDirectory(FileUtils.java:151) at org.springframework.roo.project.Path.getModulePath(Path.java:133) at org.springframework.roo.project.maven.Pom.cachePhysicalPaths(Pom.java:115) at org.springframework.roo.project.maven.Pom.<init>(Pom.java:106) at org.springframework.roo.project.maven.PomTest.getMinimalPom(PomTest.java:76) at org.springframework.roo.project.maven.PomTest.testGetModulePathsForMinimalJarPom(PomTest.java:43) testGetAsDependency(org.springframework.roo.project.maven.PomTest) Time elapsed: 0.001 sec <<< ERROR! java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1937) at org.springframework.roo.support.util.FileUtils.backOneDirectory(FileUtils.java:163) at org.springframework.roo.support.util.FileUtils.getFirstDirectory(FileUtils.java:151) at org.springframework.roo.project.Path.getModulePath(Path.java:133) at org.springframework.roo.project.maven.Pom.cachePhysicalPaths(Pom.java:115) at org.springframework.roo.project.maven.Pom.<init>(Pom.java:106) at org.springframework.roo.project.maven.PomTest.getMinimalPom(PomTest.java:76) at org.springframework.roo.project.maven.PomTest.testGetAsDependency(PomTest.java:61) Tests run: 5, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec <<< FAILURE! testGetIdentifierForRootModuleWithEmptyRelativePath(org.springframework.roo.project.MavenPathResolvingStrategyTest) Time elapsed: 0.004 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\src...> but was:<[C:]\path\to\the\pom\src...> at org.junit.Assert.assertEquals(Assert.java:125) at org.junit.Assert.assertEquals(Assert.java:147) at org.springframework.roo.project.MavenPathResolvingStrategyTest.assertIdentifier(MavenPathResolvingStrategyTest.java:76) at org.springframework.roo.project.MavenPathResolvingStrategyTest.testGetIdentifierForRootModuleWithEmptyRelativePath(MavenPathResolvingStrategyTest.java:82) testGetIdentifierForRootModuleWithNonEmptyRelativePath(org.springframework.roo.project.MavenPathResolvingStrategyTest) Time elapsed: 0.002 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\src...> but was:<[C:]\path\to\the\pom\src...> at org.junit.Assert.assertEquals(Assert.java:125) at org.junit.Assert.assertEquals(Assert.java:147) at org.springframework.roo.project.MavenPathResolvingStrategyTest.assertIdentifier(MavenPathResolvingStrategyTest.java:76) at org.springframework.roo.project.MavenPathResolvingStrategyTest.testGetIdentifierForRootModuleWithNonEmptyRelativePath(MavenPathResolvingStrategyTest.java:89) testGetIdentifierForNewModuleWithEmptyRelativePath(org.springframework.roo.project.MavenPathResolvingStrategyTest) Time elapsed: 0.003 sec <<< FAILURE! org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\new...> but was:<[C:]\path\to\the\pom\new...> at org.junit.Assert.assertEquals(Assert.java:125) at org.junit.Assert.assertEquals(Assert.java:147) at org.springframework.roo.project.MavenPathResolvingStrategyTest.assertIdentifier(MavenPathResolvingStrategyTest.java:76) at org.springframework.roo.project.MavenPathResolvingStrategyTest.testGetIdentifierForNewModuleWithEmptyRelativePath(MavenPathResolvingStrategyTest.java:97) ------------------------------------------------------------------------------- Test set: org.springframework.roo.project.PomManagementServiceImplTest ------------------------------------------------------------------------------- Tests run: 6, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.045 sec <<< FAILURE! testGetPomsOfMultiModuleProjectWhenParentAndChildAreDirty(org.springframework.roo.project.PomManagementServiceImplTest) Time elapsed: 0.01 sec <<< ERROR! java.lang.IllegalArgumentException: InputStream required at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.support.util.XmlUtils.readXml(XmlUtils.java:107) at org.springframework.roo.project.PomManagementServiceImpl.resolveParentPom(PomManagementServiceImpl.java:202) at org.springframework.roo.project.PomManagementServiceImpl.resolvePoms(PomManagementServiceImpl.java:189) at org.springframework.roo.project.PomManagementServiceImpl.resolveChildModulePoms(PomManagementServiceImpl.java:219) at org.springframework.roo.project.PomManagementServiceImpl.resolvePoms(PomManagementServiceImpl.java:192) at org.springframework.roo.project.PomManagementServiceImpl.parseUnparsedPoms(PomManagementServiceImpl.java:164) at org.springframework.roo.project.PomManagementServiceImpl.updatePomCache(PomManagementServiceImpl.java:140) at org.springframework.roo.project.PomManagementServiceImpl.getPoms(PomManagementServiceImpl.java:282) at org.springframework.roo.project.PomManagementServiceImplTest.testGetPomsOfMultiModuleProjectWhenParentAndChildAreDirty(PomManagementServiceImplTest.java:184) testGetPomsOfMultiModuleProjectWhenChildIsDirty(org.springframework.roo.project.PomManagementServiceImplTest) Time elapsed: 0.006 sec <<< ERROR! java.lang.IllegalArgumentException: InputStream required at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.support.util.XmlUtils.readXml(XmlUtils.java:107) at org.springframework.roo.project.PomManagementServiceImpl.resolveParentPom(PomManagementServiceImpl.java:202) at org.springframework.roo.project.PomManagementServiceImpl.resolvePoms(PomManagementServiceImpl.java:189) at org.springframework.roo.project.PomManagementServiceImpl.parseUnparsedPoms(PomManagementServiceImpl.java:164) at org.springframework.roo.project.PomManagementServiceImpl.updatePomCache(PomManagementServiceImpl.java:140) at org.springframework.roo.project.PomManagementServiceImpl.getPoms(PomManagementServiceImpl.java:282) at org.springframework.roo.project.PomManagementServiceImplTest.testGetPomsOfMultiModuleProjectWhenChildIsDirty(PomManagementServiceImplTest.java:214)

    Spring JIRA | 5 years ago | Matej Spiller-Muys
    org.junit.ComparisonFailure: expected:<[]\path\to\the\pom\new...> but was:<[C:]\path\to\the\pom\new...>
  3. 0

    Apply fix to SturcturedQueryBuilderTest to b2_0

    GitHub | 3 years ago | sammefford
    org.junit.ComparisonFailure: expected:<...vices/search" xmlns:[y="target.org" xmlns:x="roo]t.org" xmlns:xsi="ht...> but was:<...vices/search" xmlns:[x="root.org" xmlns:y="targe]t.org" xmlns:xsi="ht...>
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Default test suit has undeterministic behaviour on win8 + JDK7

    GitHub | 5 years ago | mrlogan
    org.junit.ComparisonFailure: expected:<before [apple after before banana] after afterAll > but was:<before [banana after before apple] after afterAll >
  6. 0

    Multi-byte character support not working on Mac

    GitHub | 4 years ago | jtaylor-sfdc
    org.junit.ComparisonFailure: expected:<\u0192[é]> but was:<\u0192[]>

  1. rsprangemeijer 5 times, last 1 week ago
  2. jf-ast 2 times, last 2 weeks ago
  3. MoYapro 2 times, last 3 months ago
  4. richard77 2 times, last 3 months ago
  5. treefolk 2 times, last 3 months ago
4 more registered users
7 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.junit.ComparisonFailure

    expected:<[]\path\to\the\pom\new...> but was:<[C:]\path\to\the\pom\new...>

    at org.junit.Assert.assertEquals()
  2. JUnit
    Assert.assertEquals
    1. org.junit.Assert.assertEquals(Assert.java:125)
    2. org.junit.Assert.assertEquals(Assert.java:147)
    2 frames
  3. org.springframework.roo
    MavenPathResolvingStrategyTest.testGetIdentifierForNewModuleWithEmptyRelativePath
    1. org.springframework.roo.project.MavenPathResolvingStrategyTest.assertIdentifier(MavenPathResolvingStrategyTest.java:76)
    2. org.springframework.roo.project.MavenPathResolvingStrategyTest.testGetIdentifierForNewModuleWithEmptyRelativePath(MavenPathResolvingStrategyTest.java:97)
    2 frames