Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

JUNITs Code Sample model class

sampath_kumar_g
Level 2
Level 2

package com.combotool.community.core.models;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;

import com.combotool.community.core.vo.GuidelinesVO;

public class GuidelineModelTest {

@InjectMocks
GuidelineModel guidelineModel;

@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}

@test
public void testVariables() throws JSONException {

String banner = "banner";
String title = "title";
String age = "age";
String gender = "gender";
String keywords = "keywords";
String overview = "overview";
String assessment = "assessment";
String revision = "revision";
String bibilography = "bibilography";
String notes = "notes";

List<GuidelinesVO> nineList = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> guidelineList = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> ernowList = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> poisoncntrlList = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> seekcareList = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> clinicnowList = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> clinic24List = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> clinic3daysList = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> homecareList = new ArrayList<GuidelinesVO>();
List<GuidelinesVO> careinfoList = new ArrayList<GuidelinesVO>();

String[] nineItems = {"911statement", "911details", "911selection", "911careinformation", "911standardlang"};
String[] guidelinesItems = {"guidelinestatement", "guidelinedetails", "guidelineselection", "guidelinestandardlang", "guideline-url"};
String[] ernowItems = {"erstatement", "erdetails", "erselection", "ercareinformation", "erstandardlang", "ertelemedicineselectionvalue"};
String[] poisoncntrlItems = {"poisoncntrlstatement", "poisoncntrldetails", "poisoncntrlselection", "poisoncntrlcareinformation", "poisoncntrlstandardlang"};
String[] seekcareItems = {"seekcarestatement", "seekcaredetails", "seekcareselection", "seekcarecareinformation", "seekcarestandardlang", "seekcaretelemedicineselectionvalue"};
String[] clinicnowItems = {"clinicnowstatement", "clinicnowdetails", "clinicnowselection", "clinicnowcareinformation", "clinicnowstandardlang", "clinicnowtelemedicineselectionvalue"};
String[] clinic24Items = {"clinic24statement", "clinic24details", "clinic24selection", "clinic24careinformation", "clinic24standardlang", "clinic24telemedicineselectionvalue"};
String[] clinic3daysItems = {"clinic3daysstatement", "clinic3daysdetails", "clinic3daysselection", "clinic3dayscareinformation", "clinic3daysstandardlang", "clinic3daystelemedicineselectionvalue"};
String[] homecareItems = {"homecarestatement", "homecaredetails", "homecareselection", "homecarecareinformation", "homecarestandardlang"};
String[] careinfoItems = {"careinfostatement", "careinfonum", "careinfostandardlang"};

GuidelinesVO guidelinesVO = new GuidelinesVO();

guidelinesVO.setCareinformation("careinformation");
guidelinesVO.setNumber("number");
guidelinesVO.setSelectionvalue("false");
guidelinesVO.setStandardlanguage("false");
guidelinesVO.setStatement("statement");
guidelinesVO.setStatementdetails("statementdetails");
guidelinesVO.setTelemedicineselectionvalue("telemedicineselectionvalue");
guidelinesVO.setUrl("url");

GuidelinesVO guidelinesVO1 = new GuidelinesVO();

guidelinesVO1.setCareinformation("careinformation");
guidelinesVO1.setNumber("number");
guidelinesVO1.setSelectionvalue("false");
guidelinesVO1.setStandardlanguage("false");
guidelinesVO1.setStatement("statement");
guidelinesVO1.setStatementdetails("statementdetails");
guidelinesVO1.setTelemedicineselectionvalue("telemedicineselectionvalue");
guidelinesVO1.setUrl("url");

nineList.add(guidelinesVO);
nineList.add(guidelinesVO1);
guidelineList.add(guidelinesVO);
guidelineList.add(guidelinesVO1);
ernowList.add(guidelinesVO);
ernowList.add(guidelinesVO1);
poisoncntrlList.add(guidelinesVO);
poisoncntrlList.add(guidelinesVO1);
seekcareList.add(guidelinesVO);
seekcareList.add(guidelinesVO1);
clinicnowList.add(guidelinesVO);
clinicnowList.add(guidelinesVO1);
clinic24List.add(guidelinesVO);
clinic24List.add(guidelinesVO1);
clinic3daysList.add(guidelinesVO);
clinic3daysList.add(guidelinesVO1);
homecareList.add(guidelinesVO);
homecareList.add(guidelinesVO1);
careinfoList.add(guidelinesVO);
careinfoList.add(guidelinesVO1);

guidelineModel.setBanner(banner);
guidelineModel.setTitle(title);
guidelineModel.setAge(age);
guidelineModel.setGender(gender);
guidelineModel.setKeywords(keywords);
guidelineModel.setOverview(overview);
guidelineModel.setAssessment(assessment);
guidelineModel.setRevision(revision);
guidelineModel.setBibilography(bibilography);
guidelineModel.setNotes(notes);

guidelineModel.setNineItems(nineItems);
guidelineModel.setGuidelinesItems(guidelinesItems);
guidelineModel.setErnowItems(ernowItems);
guidelineModel.setPoisoncntrlItems(poisoncntrlItems);
guidelineModel.setSeekcareItems(seekcareItems);
guidelineModel.setClinicnowItems(clinicnowItems);
guidelineModel.setClinic24Items(clinic24Items);
guidelineModel.setClinic3daysItems(clinic3daysItems);
guidelineModel.setHomecareItems(homecareItems);
guidelineModel.setCareinfoItems(careinfoItems);
guidelineModel.setNineList(nineList);
guidelineModel.setGuidelineList(guidelineList);
guidelineModel.setErnowList(ernowList);
guidelineModel.setPoisoncntrlList(poisoncntrlList);
guidelineModel.setSeekcareList(seekcareList);
guidelineModel.setClinicnowList(clinicnowList);
guidelineModel.setClinic24List(clinic24List);
guidelineModel.setClinic3daysList(clinic3daysList);
guidelineModel.setHomecareList(homecareList);
guidelineModel.setCareinfoList(careinfoList);

assertEquals(banner, guidelineModel.getBanner());
assertEquals(title, guidelineModel.getTitle());
assertEquals(age, guidelineModel.getAge());
assertEquals(gender, guidelineModel.getGender());
assertEquals(keywords, guidelineModel.getKeywords());
assertEquals(overview, guidelineModel.getOverview());
assertEquals(assessment, guidelineModel.getAssessment());
assertEquals(revision, guidelineModel.getRevision());
assertEquals(bibilography, guidelineModel.getBibilography());
assertEquals(notes, guidelineModel.getNotes());

assertEquals(nineItems, guidelineModel.getNineItems());
assertEquals(nineList, guidelineModel.getNineList());
assertEquals(guidelinesItems, guidelineModel.getGuidelinesItems());
assertEquals(guidelineList, guidelineModel.getGuidelineList());
assertEquals(ernowItems, guidelineModel.getErnowItems());
assertEquals(ernowList, guidelineModel.getErnowList());
assertEquals(poisoncntrlItems, guidelineModel.getPoisoncntrlItems());
assertEquals(poisoncntrlList, guidelineModel.getPoisoncntrlList());
assertEquals(seekcareItems, guidelineModel.getSeekcareItems());
assertEquals(seekcareList, guidelineModel.getSeekcareList());
assertEquals(clinicnowItems, guidelineModel.getClinicnowItems());
assertEquals(clinicnowList, guidelineModel.getClinicnowList());
assertEquals(clinic24Items, guidelineModel.getClinic24Items());
assertEquals(clinic24List, guidelineModel.getClinic24List());
assertEquals(clinic3daysItems, guidelineModel.getClinic3daysItems());
assertEquals(clinic3daysList, guidelineModel.getClinic3daysList());
assertEquals(homecareItems, guidelineModel.getHomecareItems());
assertEquals(homecareList, guidelineModel.getHomecareList());
assertEquals(careinfoItems, guidelineModel.getCareinfoItems());
assertEquals(careinfoList, guidelineModel.getCareinfoList());

guidelineModel.populate911Dispositions();
guidelineModel.populateAdditionalGuidelinesDispositions();
guidelineModel.populateErNowDispositions();
guidelineModel.populatePoisonControlDispositions();
guidelineModel.populateSeekCareDispositions();
guidelineModel.populateClinicNowDispositions();
guidelineModel.populateClinic24Dispositions();
guidelineModel.populateClinic3DaysDispositions();
guidelineModel.populateCHomeCareDispositions();
guidelineModel.populateCCareInfoDispositions();
}
}

1 Reply