Mockito.doThrow() not throwing any exception - java

I am trying to stub a void method of a mocked object to return an exception. This mocked object passed as dependency to the service which I am writing tests for.
Service:
#Component
public class FileHandler {
private static final Logger log = LoggerFactory.getLogger(FileHandler.class);
private final SSHAccess sshAccess;
#Value("${datastore.location}")
private String dataStoreDir;
public FileHandler(SSHAccess sshAccess){
this.sshAccess = sshAccess;
}
public Either<Pair<Exception, FileRecord>, FileRecord> transferFile(FileRecord fileRecord){
try {
var sourceURI = new URI(fileRecord.getSourceURI());
var digest = sshAccess.execute("md5sum " + sourceURI.getPath())
.replaceFirst("([^\\s]+)[\\d\\D]*", "$1");
if (digest.equals(fileRecord.getSourceDigest())) {
log.info(Thread.currentThread().getName() + ": Copying file: " + fileRecord.getId() + " of submission: " + fileRecord.getOwnedBy());
sshAccess.download(sourceURI.getPath(),new File(mkdir(dataStoreDir, digest), digest));
log.info(Thread.currentThread().getName() + ": Copying of file: " + fileRecord.getId() + " of submission: " + fileRecord.getOwnedBy() + " finished.");
return Either.Right(fileRecord);
}else{
log.error("MD5 mismatch for source file {}", sourceURI.getPath());
return Either.Left(Pair.of(new FileHandlerException("MD5 mismatch"), fileRecord));
}
} catch (URISyntaxException
| IOException
e) {
return Either.Left(Pair.of(new FileHandlerException(e), fileRecord));
}
}
private File mkdir(String dataStoreDir, String digest) throws IOException {
File dir = new File(dataStoreDir, digest.substring(0, 3));
if (!dir.exists() && !dir.mkdirs()) {
log.error("Unable to create directory {}", dir);
throw new IOException("Unable to create directory " + dir);
}
return dir;
}
}
Test Class:
#SpringBootTest
#TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class FileHandlerTest {
private FileHandler fileHandler;
#Mock
private SSHAccess sshAccess;
#BeforeAll
public void init(){
fileHandler = Mockito.spy(new FileHandler(sshAccess));
}
#Test
public void transferFileShouldReturnFileHandlerExceptionOnEitherLeftWhenSSHclientThrowsIOException() throws IOException {
FileRecord fileRecord = getFileRecord();
var digest = "6e484ac23110fae10021e";
when(sshAccess.execute(anyString())).thenReturn(digest);
doThrow(IOException.class).when(sshAccess).download(anyString(), any(File.class));
var result = fileHandler.transferFile(fileRecord);
Assertions.assertTrue(result.getLeft().isPresent()
&& result.getLeft().get().getFirst() instanceof FileHandlerException);
}
private FileRecord getFileRecord() {
var fileRecord = new FileRecord();
fileRecord.setId(1L);
fileRecord.setOwnedBy(1000);
fileRecord.setSourceURI("scp:host/test/uri/filename");
fileRecord.setSourceDigest("6e484ac23110fae10021e");
return fileRecord;
}
}
But when I run this test case, doThrow() doesn't throw any exception. Method executed without any exception and test failed. I am not sure what I am doing wrong here. Please help.

Not sure why are you using the #SpringBootTest annotation which will try to raise a similar context with the one when you are running the app. So in this case you could stop instantiating your FileHandler and just spy on it and on your SSHAccess beans or use #MockBean instead of #Mock.
Basically you should have something like this
#SpyBean
private FileHandler fileHandler;
#MockBean
private SSHAccess sshAccess;

You are using Junit 5. For Junit 5 you don't need the method #SpringBootTest, you need to use #ExtendWith(MockitoExtension.class)
#SpringBootTest
#TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class FileHandlerTest {
private FileHandler fileHandler;
#Mock
private SSHAccess sshAccess;
#BeforeAll
public void init(){
fileHandler = Mockito.spy(new FileHandler(sshAccess));
}
.....
.....
.....
}
Also instead of Mockito.spy(new FileHandler(sshAccess)) you can try Mockito.mock(new FileHandler(sshAccess))

Related

SpringBootApp NullPointerException with #Autowired repository

This is my Spring Boot Application.
when i run the main method always a null pointer exception is thrown.
I have no idea why the #Autowired JsonReaderService is null. As i define it as component.
It is a sub folder in the project src folder so the Main Method is above the source folder. So spring should scan it correctly??
I have also a test method which works just fine.
#SpringBootApplication
public class DemoApplication {
#Autowired
private JsonReaderService jsonReaderService;
private static JsonReaderService stat_jsonReaderService;
static Logger logger = LoggerFactory.getLogger(DemoApplication.class);
public static void main(String[] args) throws IOException {
String textFileName = scanFileName();
Reader reader = Files.newBufferedReader(Paths.get("src/main/resources/" + textFileName));
// This line is always null pointer exception. The #autowired Annotation don't work with my JsonReaderService????? WHY
List<EventDataJson> jsonReaderServicesList = stat_jsonReaderService.readEventDataFromJson(reader);
stat_jsonReaderService.mappingToDatabase(jsonReaderServicesList);
}
public static String scanFileName() {
logger.info("Scanning keyboard input");
System.out.println("enter a file to scan");
Scanner scanInput = new Scanner(System.in);
String text = scanInput.nextLine();
logger.info("successful keyboard input was : " + text);
return text;
}
#PostConstruct
public void init() {
logger.info("initializing Demo Application");
stat_jsonReaderService = jsonReaderService;
}
}
Here i have the class which uses the repository #Autowired to save some Entity but i get always a nullpointer exception in the line repository.save(...)
#Component
public class JsonReaderService {
static Logger logger = LoggerFactory.getLogger(DemoApplication.class);
#Autowired
EventDataRepository repository;
private Reader reader;
private List<EventDataJson> eventDataList;
#Autowired
public JsonReaderService(){}
public List<EventDataJson> readEventDataFromJson(Reader reader) throws IOException {
try {
logger.info("parsing event data from json started");
Gson gson = new Gson();
EventDataJson[] eventData = gson.fromJson(reader, EventDataJson[].class);
eventDataList = Arrays.asList(eventData);
reader.close();
} catch (IOException e) {
logger.error("Error while reading the json file");
e.printStackTrace();
}
logger.info("parsing json eventData successful finished");
return eventDataList;
}
public Boolean mappingToDatabase(List<EventDataJson> eventDataList) {
logger.info("mapping from json to database eventData started ...");
Set<String> idList = eventDataList.stream().map(EventDataJson::getId).collect(Collectors.toSet());
for (String id : idList
) {
Stream<EventDataJson> filteredEventDataList1 = eventDataList.stream().filter((item) -> item.getId().equals(id));
Stream<EventDataJson> filteredEventDataList0 = eventDataList.stream().filter((item) -> item.getId().equals(id));
EventDataJson startedEvent = filteredEventDataList1.filter((item) -> item.getState().equals("STARTED")).findAny().orElse(null);
EventDataJson finishedEvent = filteredEventDataList0.filter((item) -> item.getState().equals("FINISHED")).findAny().orElse(null);
long duration0 = finishedEvent.getTimestamp() - startedEvent.getTimestamp();
Boolean alert;
if (duration0 > 4) {
alert = true;
} else {
alert = false;
}
try {
this.repository.save(new EventDataDb(id, duration0, startedEvent.getType(), startedEvent.getHost(), alert));
logger.info("mapping to Database Repository action successful");
} catch (Exception e) {
logger.error("Exception in database mapping occurred");
e.printStackTrace();
return false;
}
}
return true;
}
}
Repository with Annotation
#Repository
public interface EventDataRepository extends JpaRepository<EventDataDb, String> {
EventDataDb findAllById(String id);
}
Test case works just fine with #autowired Annotation i Don't know why it don't work in the main method. Is it because it is static?
#Autowired
private EventDataRepository repository;
#Autowired
private JsonReaderService jReader;
#Test
public void whenParseJson_thenTransform_and_save_to_db() throws IOException {
BufferedReader reader = Files.newBufferedReader(Paths.get("src/main/resources/" + "logfile.txt"));
List<EventDataJson> eventDataList1 = jReader.readEventDataFromJson(reader);
if (jReader.mappingToDatabase(eventDataList1)) {
EventDataDb eventDataFromDb = this.repository.findAllById("scsmbstgra");
Assertions.assertTrue(eventDataFromDb.getType().equals("APPLICATION_LOG"));
Assertions.assertTrue(eventDataFromDb.getHost().equals("12345"));
Assertions.assertTrue(eventDataFromDb.getAlert().equals(true));
Assertions.assertTrue(eventDataFromDb.getDuration() == 5);
logger.info("Assert successfully accomplished");
} else
logger.error("Could not persist eventData to DB Error");
}
Stack Trace
`Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.NullPointerException
at com.creditsuisse.demo.DemoApplication.main(DemoApplication.java:33)
... 5 more`
You need to run SpringApplication.run() because this method starts whole Spring Framework. Since you don't have it in your code, the beans are not autowired and JsonReaderService is null. You can do the following in your Application.java. Also, since this involves taking input from the CLI why not use CommandLineRunner as follows:
#SpringBootApplication
public class DemoApplication
implements CommandLineRunner {
#Autowired
private JsonReaderService jsonReaderService;
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
#Override
public void run(String... args) {
String textFileName = scanFileName();
Reader reader = Files.newBufferedReader(Paths.get("src/main/resources/" + textFileName));
List<EventDataJson> jsonReaderServicesList = stat_jsonReaderService.readEventDataFromJson(reader);
jsonReaderService.mappingToDatabase(jsonReaderServicesList);
}
}

How read JSON file in Play framework using Java

I am trying to read JSON file from test/resources package in my play application. I am getting com.couchbase.client.java.error.DocumentDoesNotExistException. I believe my path is not correct, can anyone suggest how to take absolute path?
public class AppControllerTest extends WithApplication {
#Inject
AppDaoServiceImpl appDaoServiceImpl;
private CouchbaseEnvironment env;
private static Cluster cluster = null;
private static Bucket bucket = null;
private String testResources = System.getProperty("java.class.path") + "/test/resources/";
private static final ALogger logger = Logger.of(AppControllerTest.class);
#Rule
public ExpectedException thrown = ExpectedException.none();
#Override
protected Application provideApplication() {
return new GuiceApplicationBuilder().build();
}
#Before
public void init() {
env = DefaultCouchbaseEnvironment.create();
cluster = CouchbaseCluster.create(env, "127.0.0.1:8091");
bucket = cluster.openBucket("CLUSTER", "admin123");
try {
String docId = "ABEBV_common";
File testResource = new File(testResources + "ABEBV_common.json");
FileInputStream is = new FileInputStream(testResource);
JsonNode testData = Json.parse(is);
RawJsonDocument rawJsonDocument = RawJsonDocument.create(docId, testData.asText());
bucket.upsert(rawJsonDocument);
} catch (Exception e) {
}
}
#Test
public void testGenericData() {
Http.RequestBuilder request = new Http.RequestBuilder().method(GET).uri("/app/ms/genericdata/ABEBV")
.header("client_id", "chase");
Result result = route(app, request);
assertEquals(OK, result.status());
assertEquals("application/json", result.contentType().get());
assertTrue(contentAsString(result).contains("141-GYCVZY"));
}
#After
public void deleteDocuments() {
bucket.remove("ABEBV_common");
bucket.close();
cluster.disconnect();
}
}
Yes your path is not correct, System.getProperty("java.class.path") will return all the java class path the jvm is referring to You have to, instead use "user.dir".
private String testResources = System.getProperty("user.dir") + "/test/resources/";

Methods in interface not getting covered in mockito junit

I am using mockito-junit to test a piece of my code. As progressing I found out that there was an interface implemented in the main file which I was testing, when the test was running I found that the line where interface method is called get's covered but the real method doesn't get's covered.
This the code for the main file:
public class ExtractCurrencyDataTask {
private static final Logger LOGGER = LoggerFactory.getLogger(ExtractCurrencyDataTask.class);
#Autowired
private ExtractCurrencyService extractCurrencyService;
public void writeCurrencyListToFile(List<Currency> currencyList) {
if (currencyList != null && !currencyList.isEmpty()) {
String dir = "A path";
String fileName = "A filename";
String writeToFile = dir + "/" + fileName + ".writing";
String renameFile = dir + "/" + fileName + ".dat";
BufferedWriter writer = null;
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(writeToFile);
writer = new BufferedWriter(fileWriter);
extractCurrencyService.extractCurrencyList(currencyList, writer);
} catch (Exception e) {
throw new RuntimeException("Error writing Currency codes", e);
} finally {
if (writer != null) {
try {
writer.close();
fileWriter.close();
} catch (IOException e) {
LOGGER.info("Exception occured while closing the file writer", e);
}
moveFile(writeToFile, renameFile);
}
}
}
}
private void moveFile(String writeToFile, String renameFile) {
try {
FileUtils.moveFile(FileUtils.getFile(writeToFile), FileUtils.getFile(renameFile));
} catch (IOException e) {
LOGGER.info("Exception occured while moving file from writing to dat", e);
}
}
Here extractCurrencyService is the interface which I have mentioned.
The interface:
public interface ExtractCurrencyService {
public void extractCurrencyList(List<Currency> currency, Writer writer);
}
This the method definition which is done another file which implements same interface Filename:ExtractCurrencyServiceImpl.java
public class ExtractCurrencyServiceImpl implements ExtractCurrencyService {
private static final String SEP = "|";
private static final String NEWLINE = "\n";
#Override
public void extractCurrencyList(List<Currency> currencyList, Writer writer) {
if (currencyList != null) {
currencyList.forEach(currency -> {
String code = currency.getCode();
String name = currency.getName() == null ? "" : currency.getName();
Long noOfDecimals = currency.getNumberOfDecimals();
RoundingMethodValue roundingMethod = currency.getRoundingMethod();
boolean isDealCurrency = currency.isDealCurrency();
String description = currency.getDescription() == null ? "" : currency.getDescription();
try {
writer.write(createCurrencyDataLine(code,
name,
noOfDecimals,
roundingMethod,
isDealCurrency,
description));
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
}
private String createCurrencyDataLine(String code,
String name,
Long noOfDecimals,
RoundingMethodValue roundingMethod,
boolean isdealCurrency,
String description) {
return code + SEP + name + SEP + noOfDecimals.toString() + SEP + roundingMethod.toString() + SEP
+ isdealCurrency + SEP + description + NEWLINE;
}
public static <T> Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor) {
Map<Object, Boolean> map = new ConcurrentHashMap<>();
return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
}
This is the test file:
#RunWith(MockitoJUnitRunner.class)
public class ExtractCurrencyDataTaskTest {
#Mock
private Currency mockCurrency;
#Mock
private ExtractCurrencyService mockExtractCurrencyService;
#Mock
private BufferedWriter mockBufferWriter;
#Mock
private Bean mockBean;
#InjectMocks
private ExtractCurrencyDataTask extractCurrencyDataTask;
#Test
public void writeCurrencyListToFileTest() {
List<Currency> currencyList = new ArrayList();
when(mockCurrency.getCode()).thenReturn("USD");
when(mockCurrency.getNumberOfDecimals()).thenReturn((long) 2);
when(mockCurrency.getRoundingMethod()).thenReturn(enum value);
when(mockCurrency.isDealCurrency()).thenReturn(true);
when(mockCurrency.getName()).thenReturn("US Dollars");
when(mockCurrency.getDescription()).thenReturn("Currency Description");
currencyList.add(mockCurrency);
extractCurrencyDataTask.writeCurrencyListToFile(currencyList);
}
}
This the configuration for Autowired bean
#Bean
public ExtractCurrencyService extractCurrencyService() {
return new ExtractCurrencyServiceImpl();
}
As you can see the real output of this process is a file will be created in a path mentioned with some data. Here in this test I am mocking the data and passing it to main file. Main file is the created file in respective path but there is no data in the file.
The data writing part is done by the interface method. This is the part where I need help.
Thanks in advance....
You are injecting a mock of ExtractCurrencyService into your tested class. So the test is running with this mock instance instead of ExtractCurrencyServiceImpl. The current behaviour is that your ExtractCurrencyDataTasktested class is calling to extractCurrencyService#extractCurrencyList, but this extractCurrencyService is a mock, not your real implementation, so the call is done but it does nothing.
If you want to unit test ExtractCurrencyDataTask then thats ok, but maybe you should assert the call to extractCurrencyService#extractCurrencyList is done in the way you expect.
If you want to unit test ExtractCurrencyServiceImpl then create a unit test for this class.
If you want to test the interaction between these two classes then create an integration test where ExtractCurrencyDataTask has injected a real instance of ExtractCurrencyServiceImpl, not a mock.

Using Loadtime weaver with third party jar class method interceptor

I am trying to intercept a class in third party jar from my spring boot application.
I am trying to do it as
<context:load-time-weaver aspectj-weaving="on" weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>
<bean id="instrumentationLoadTimeWeaver"
class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
While my Aspect logger class looks like
#Aspect
public class LogInterceptor
{
private static final Logger PERF_LOGGER = LoggerFactory.getLogger("PERFLOG");
private static final Logger LOGGER = LoggerFactory.getLogger(LogInterceptor.class);
private static final int SYSTEM_ERROR_STATUS_CODE = -1;
private static final int SYSTEM_SUCCESS_STATUS_CODE = 0;
#Around(
"execution(* com.alpha.executor.dao..*(..)) || "
+ "execution(* com.alpha.executor.resource..*(..)) || "
+ "execution(* com.alpha.executor.client..*(..)) || "
+ "execution(* com.alpha.executor.service..*(..)) || "
+ "execution(* com.alpha.executor.proxy.*.*(..)) ")
public Object logRecordInPerflog(ProceedingJoinPoint joinPoint) throws Throwable
{
String activityName = joinPoint.getTarget().getClass().getSimpleName();
String operationName = activityName + "." + joinPoint.getSignature().getName();
RequestLog reqLog = new RequestLog(operationName, activityName, joinPoint.getArgs());
PERF_LOGGER.info(reqLog.getLoggerString());
try
{
Object result = joinPoint.proceed();
ResponseLog resLog = new ResponseLog(reqLog, result, SYSTEM_SUCCESS_STATUS_CODE);
PERF_LOGGER.info(resLog.getLoggerString());
return result;
}
catch (Exception ex)
{
logException(reqLog, ex);
throw ex;
}
}
private void logException(RequestLog reqLog, Exception ex)
{
ResponseLog resLog;
if (ex instanceof SvxException)
{
SvxException svxException = (SvxException) ex;
ErrorCode errorCode = svxException.getSvxExceptionDetail().getErrorCode();
ErrorResponse errorResponse = new ErrorResponse(errorCode,svxException.getSvxExceptionDetail().getErrorDescription());
resLog = new ResponseLog(reqLog,null,errorCode.getHttpStatus().value(),errorResponse,errorCode.getErrorType().toString());
}
else
{
LOGGER.error("Error: ", ex);
resLog = new ResponseLog(reqLog, null, SYSTEM_ERROR_STATUS_CODE, ErrorType.SYSTEM_ERROR.toString(), ex.getMessage());
}
PERF_LOGGER.info(resLog.getLoggerString());
}
}
However, the above code gives an error that No custom load time weaver found. I don't want to use spring-instrumentation.jar in VM args.
Also already tried the class-based method with annotation, however, read somewhere that Spring might be loading that class after some classes are loaded hence that might not work.
EDIT:
Added the logger and advice. Here I have manually created a proxy, see the last line, which isn't a good solution I believe.

How to test Rest API and mock url using spring boot and mockbeam

I have a Rest API
The class code is :
#SpringBootTest
#RunWith(SpringRunner.class)
public class FetchCoreVersionsListIT {
#MockBean
private RestTemplateBuilder restTemplateBuilder;
#MockBean
private RestTemplate restTemplate;
private VersionsService versionsService;
#Autowired
private FetchCoreVersionsList fetchCoreVersionsList;
private VersionList versionList;
private ArtifactoryFolderInfoChild version;
#Before
public void setUp() throws Exception {
this.version = new ArtifactoryFolderInfoChild();
this.version.setUri("2.1.0");
this.version.setFolder(true);
when(restTemplateBuilder.build()).thenReturn(restTemplate);
}
#Test
public void testCoreVersionsJsonHandle() throws Exception{
when(restTemplate.getForObject("https://openmrs.jfrog.io/openmrs/api/storage/public/org/openmrs/api/openmrs-api/",
String.class))
.thenReturn(getFileAsString("core-versions.json"));
("2.1.0"));*/
}
This is the core-versions.json . This is nothing else but the data received from this Rest API.
Basically I'm trying to run a test and I have a spring schedule that will parse the json received from that Rest url. Now, while testing the schedule, I want to return the same data but without connecting to the internet and hence want to return the contents of core-versions.json. I get the following error unfortunately :
java.lang.IllegalStateException: File downloaded from could not be parsed
My schedule class is this:
#Component
public class FetchCoreVersionsList {
private final Logger logger = LoggerFactory.getLogger(getClass());
private static final String[] STRINGS_TO_EXCLUDE = {"alpha", "beta", "RC", "SNAPSHOT"};
#Value("${core_version_list.url}")
private String url;
//#Value("${core_version_list.strategy}")
//private FetchCoreVersionsList.Strategy strategy = FetchCoreVersionsList.Strategy.FETCH;
private RestTemplateBuilder restTemplateBuilder;
private ObjectMapper mapper;
private VersionsService versionsService;
#Autowired
public FetchCoreVersionsList(RestTemplateBuilder restTemplateBuilder,
ObjectMapper mapper,
VersionsService versionsService) {
this.restTemplateBuilder = restTemplateBuilder;
this.mapper = mapper;
this.versionsService = versionsService;
}
#Scheduled(
initialDelayString = "${scheduler.fetch_core_versions_list.initial_delay}",
fixedDelayString = "${scheduler.fetch_core_versions_list.period}")
public void fetchCoreVersionsList() throws Exception {
logger.info("Fetching list of OpenMRS-Core versions");
// FetchCoreVersionsList.Strategy strategy = FetchCoreVersionsList.Strategy.FETCH;
String json;
/* if (strategy == Strategy.LOCAL) {
logger.debug("LOCAL strategy");
json = StreamUtils.copyToString(getClass().getClassLoader().getResourceAsStream("openmrs-core-versions.json"),
Charset.defaultCharset());
} else {*/
json = restTemplateBuilder.build().getForObject(url, String.class);
logger.info("FETCH strategy: " + json);
ArtifactoryFolderInfo versionlist;
try { logger.info("FETCH strategy: " + json);
logger.debug("papa strategy: " + url);
versionlist = mapper.readValue(json, ArtifactoryFolderInfo.class);
} catch (Exception ex) {
throw new IllegalStateException("File downloaded from " + url + " could not be parsed", ex);
}
if (logger.isInfoEnabled()) {
logger.info("There are " + versionlist.getChildren().size() + " openmrs-core versions");
}
if (versionlist.size() > 0) {
List<String> versions = new ArrayList<>();
List<ArtifactoryFolderInfoChild> allversions = versionlist.getChildren();
for (ArtifactoryFolderInfoChild candidateVersion : allversions) {
if (candidateVersion.getFolder() && !stringContainsItemFromList(candidateVersion.getUri(), STRINGS_TO_EXCLUDE)) {
versions.add(candidateVersion.getUri().replaceAll("/", ""));
}
}
versionsService.setVersions(versions);
} else {
logger.warn("File downloaded from " + url + " does not list any Core Versions to index. Keeping our current list");
}
}
private static boolean stringContainsItemFromList(String inputStr, String[] items) {
return Arrays.stream(items).parallel().anyMatch(inputStr::contains);
}
public enum Strategy {
FETCH, LOCAL
}
}
Kindly bear with me if this is a silly error as I am completely new to testing.

Categories

Resources