Create JUnit test(s) for the following code: package com.lewis.ip.settle.common.sponsorconfig; import org.apache.commons.collections.map.MultiKeyMap; import java.util.Objects; public class GermanySponsorConfigCollection { private MultiKeyMap processorSwitchDataMap; public GermanySponsorConfigCollection(){ processorSwitchDataMap = new MultiKeyMap(); } public void addData(String processorId, String switchId, GermanySponsorConfigData germanySponsorConfigData){ if (processorSwitchDataMap.containsKey(processorId, switchId)) { GermanySponsorConfigData sponsorConfigData = (GermanySponsorConfigData) processorSwitchDataMap.get(processorId, switchId); SccSctSponsorConfig sccSctSponsorConfig = sponsorConfigData.getSccSctSponsorConfig(); if (Objects.nonNull(sccSctSponsorConfig)) { germanySponsorConfigData.setSccSctSponsorConfig(sccSctSponsorConfig); } } processorSwitchDataMap.put(processorId,switchId,germanySponsorConfigData); } public Integer getMapSize(){ return processorSwitchDataMap.size(); } public MultiKeyMap getProcessorSwitchDataMap() { return processorSwitchDataMap; } }
Create JUnit test(s) for the following code:
package com.lewis.ip.settle.common.sponsorconfig;
import org.apache.commons.collections.map.MultiKeyMap;
import java.util.Objects;
public class GermanySponsorConfigCollection {
private MultiKeyMap processorSwitchDataMap;
public GermanySponsorConfigCollection(){
processorSwitchDataMap = new MultiKeyMap();
}
public void addData(String processorId, String switchId, GermanySponsorConfigData germanySponsorConfigData){
if (processorSwitchDataMap.containsKey(processorId, switchId)) {
GermanySponsorConfigData sponsorConfigData = (GermanySponsorConfigData) processorSwitchDataMap.get(processorId, switchId);
SccSctSponsorConfig sccSctSponsorConfig = sponsorConfigData.getSccSctSponsorConfig();
if (Objects.nonNull(sccSctSponsorConfig)) {
germanySponsorConfigData.setSccSctSponsorConfig(sccSctSponsorConfig);
}
}
processorSwitchDataMap.put(processorId,switchId,germanySponsorConfigData);
}
public Integer getMapSize(){
return processorSwitchDataMap.size();
}
public MultiKeyMap getProcessorSwitchDataMap() {
return processorSwitchDataMap;
}
}
Step by step
Solved in 2 steps