Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve the code in java Sovle the error in nameLookup class ( picture of error provided ) public class NameLookup implements Lookup { private String

Solve the code in java
Sovle the error in nameLookup class (picture of error provided)
public class NameLookup implements Lookup {
private String prefix;
public NameLookup(String name){
this.prefix = name;
}
public boolean matches(Product product){
if (prefix == null && product.getName()== null){
return true; // Both prefix and product name are null, consider them equal
}
if (prefix != null && prefix.equals(product.getName())){
return true; // Prefix is not null, and product name matches prefix
}
return false; // Otherwise, consider them not equal
}
}
Failed: Hint: two names with null values are considered equal ==> expected: org.opentest4j.AssertionFailedError: Hint: two names with null values are considere:
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:40)
at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:193)
at InstructorTest$NameLookupTest.testNoMatch1
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

6.8 Find a z o such that P(-z

Answered: 1 week ago

Question

Explain all drawbacks of application procedure.

Answered: 1 week ago

Question

6 How can an organisation increase its flexibility?

Answered: 1 week ago

Question

1.6 Identify ways that country culture influences global business.

Answered: 1 week ago