I have a class where I want to write a junit test for. This method has no parameters, can this method accordingly?
public class classTobeTested {
@Self
SlingHttpServletRequest request;
static final String keyword = "hello";
public boolean isActive() {
boolean check;
String pathChecker;
pathChecker = (request.getRequestURL()).toString();
check= pathChecker.contains(keyword);
return check;
}
}
This would be the testing class i had in mind
@RunWith(MockitoJUnitRunner.class)
public class testclasstobetested {
@Test
public void TestclassTobeTested() throws Exception{
classTobeTested CTT = new classTobeTested();
assertFalse(CTT.isActive("hello how are you"));
}
}
I know my method does not take a parameter but has strings declared inside the method. How can i use assertFalse correctly to test a non param method.