samedi 8 août 2020

JUnit Assertion error with identical strings

I'm trying to make a test-case to check for the Dropwizard Metric Meter name: Here's the code:

@Test
public void getMeterName(){
  String metricsPrefix = "com.company.team";
  String tagSupplied = "tenant.db.table";
  String expectedMeterName = "com.company.team.tenant.db.table";

  assertSame(expectedMeterName,MetricRegistry.name(metricsPrefix,tagSupplied));
}

This is the error I'm getting:

java.lang.AssertionError: expected same:<com.company.team.tenant.db.table> was not:<com.company.team.tenant.db.table>
Expected :com.company.team.tenant.db.table
Actual   :com.company.team.tenant.db.table

What am I missing here?

Aucun commentaire:

Enregistrer un commentaire