Produced by Araxis Merge on 1/4/2018 4:54:42 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | CHAMPVA_Benefit_Eligibility_v1.0.0.zip\webservice\champvapay-service\src\test\java\gov\va\med\mbcp\champva\rest | ChampVAResourceInitializerTest.java | Thu Dec 21 19:52:28 2017 UTC |
| 2 | CHAMPVA_Benefit_Eligibility_v1.0.0.zip\webservice\champvapay-service\src\test\java\gov\va\med\mbcp\champva\rest | ChampVAResourceInitializerTest.java | Thu Jan 4 21:02:05 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 258 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * The pac kage gov.v a.med.mbcp .champva.r est contai ns the RES Tful Web A pplication & Resourc e classes for | |
| 3 | * retriev al of Code Results f rom the ta rget VistA instance. | |
| 4 | * | |
| 5 | */ | |
| 6 | package go v.va.med.m bcp.champv a.rest; | |
| 7 | ||
| 8 | import sta tic org.ju nit.Assert .assertNot Null; | |
| 9 | import sta tic org.ju nit.Assert .fail; | |
| 10 | import sta tic org.mo ckito.Mock ito.mock; | |
| 11 | import sta tic org.mo ckito.Mock ito.times; | |
| 12 | import sta tic org.mo ckito.Mock ito.verify ; | |
| 13 | import sta tic org.mo ckito.Mock ito.when; | |
| 14 | import sta tic org.po wermock.ap i.mockito. PowerMocki to.verifyN ew; | |
| 15 | import sta tic org.po wermock.ap i.mockito. PowerMocki to.whenNew ; | |
| 16 | ||
| 17 | import org .junit.Tes t; | |
| 18 | import org .junit.run ner.RunWit h; | |
| 19 | import org .powermock .core.clas sloader.an notations. PrepareFor Test; | |
| 20 | import org .powermock .modules.j unit4.Powe rMockRunne r; | |
| 21 | import org .springfra mework.bea ns.BeansEx ception; | |
| 22 | import org .springfra mework.con text.suppo rt.ClassPa thXmlAppli cationCont ext; | |
| 23 | ||
| 24 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
| 25 | ||
| 26 | import gov .va.med.mb cp.champva .dao.commo n.IChampVA PayDAO; | |
| 27 | import gov .va.med.mb cp.champva .dao.impl. ChampVAPay DAO; | |
| 28 | ||
| 29 | /** | |
| 30 | * Test cl ass for Ch ampVAResou rce initia lization. | |
| 31 | * | |
| 32 | * @author PII | |
| 33 | * @versio n 1.0.0 | |
| 34 | */ | |
| 35 | @RunWith(P owerMockRu nner.class ) | |
| 36 | @PrepareFo rTest({ Ch ampVAResou rce.class }) | |
| 37 | public cla ss ChampVA ResourceIn itializerT est { | |
| 38 | ||
| 39 | /** | |
| 40 | * Tes t method f or | |
| 41 | * {@l ink gov.va .med.mbcp. champva.re st.ChampVA Resource#C hampVAReso urce()} . | |
| 42 | */ | |
| 43 | @Test | |
| 44 | public void test ChampVARes ource() { | |
| 45 | tr y { | |
| 46 | ChampVAR esource cr = new Cha mpVAResour ce(); | |
| 47 | assertNo tNull("cr failed to initialize .", cr); | |
| 48 | } catch (Bea nsExceptio n e) { | |
| 49 | fail("fa iled with BeansExcep tion: " + e.getMessa ge()); | |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * Tes t That Ini tializer c alls new | |
| 55 | * Cla ssPathXmlA pplication Context("/ champvaBea ns.xml") | |
| 56 | * | |
| 57 | */ | |
| 58 | @Test | |
| 59 | public void test ThatInitia lizerCalls NewClassPa thXmlAppli cationCont ext() { | |
| 60 | tr y { | |
| 61 | ClassPat hXmlApplic ationConte xt mockedA ppCtxt = m ock(ClassP athXmlAppl icationCon text.class ); | |
| 62 | whenNew( ClassPathX mlApplicat ionContext .class).wi thAnyArgum ents().the nReturn(mo ckedAppCtx t); | |
| 63 | new Cham pVAResourc e(); | |
| 64 | verifyNe w(ClassPat hXmlApplic ationConte xt.class, times(1)). withArgume nts("/cham pvaBeans.x ml"); | |
| 65 | } catch (Bea nsExceptio n e) { | |
| 66 | fail("fa iled with BeansExcep tion: " + e.getMessa ge()); | |
| 67 | } catch (Exc eption e) { | |
| 68 | fail("fa iled with Exception: " + e.get Message()) ; | |
| 69 | } | |
| 70 | } | |
| 71 | ||
| 72 | /** | |
| 73 | * Tes t That Ini tializer C alls appCo ntext.getB ean("champ VAPayDAO") | |
| 74 | * | |
| 75 | */ | |
| 76 | @Test | |
| 77 | public void test ThatInitia lizerCalls AppContext GetBeanFor ChampVAPay DAO() { | |
| 78 | tr y { | |
| 79 | ClassPat hXmlApplic ationConte xt mockedA ppCtxt = m ock(ClassP athXmlAppl icationCon text.class ); | |
| 80 | whenNew( ClassPathX mlApplicat ionContext .class).wi thAnyArgum ents().the nReturn(mo ckedAppCtx t); | |
| 81 | IChampVA PayDAO moc kedChampVA PayDAO = m ock(ChampV APayDAO.cl ass); | |
| 82 | when(moc kedAppCtxt .getBean(" champVAPay DAO")).the nReturn(mo ckedChampV APayDAO); | |
| 83 | new Cham pVAResourc e(); | |
| 84 | verify(m ockedAppCt xt, times( 1)).getBea n("champVA PayDAO"); | |
| 85 | } catch (Bea nsExceptio n e) { | |
| 86 | fail("fa iled with BeansExcep tion: " + e.getMessa ge()); | |
| 87 | } catch (Exc eption e) { | |
| 88 | fail("fa iled with Exception: " + e.get Message()) ; | |
| 89 | } | |
| 90 | } | |
| 91 | ||
| 92 | /** | |
| 93 | * Tes t That Ini tializer C alls appCo ntext.getB ean("objec tMapper") | |
| 94 | * | |
| 95 | */ | |
| 96 | @Test | |
| 97 | public void test ThatInitia lizerCalls AppContext GetBeanFor ObjectMapp er() { | |
| 98 | tr y { | |
| 99 | ClassPat hXmlApplic ationConte xt mockedA ppCtxt = m ock(ClassP athXmlAppl icationCon text.class ); | |
| 100 | whenNew( ClassPathX mlApplicat ionContext .class).wi thAnyArgum ents().the nReturn(mo ckedAppCtx t); | |
| 101 | ObjectMa pper mocke dMapper = mock(Objec tMapper.cl ass); | |
| 102 | when(moc kedAppCtxt .getBean(" objectMapp er")).then Return(moc kedMapper) ; | |
| 103 | new Cham pVAResourc e(); | |
| 104 | verify(m ockedAppCt xt, times( 1)).getBea n("objectM apper"); | |
| 105 | } catch (Bea nsExceptio n e) { | |
| 106 | fail("fa iled with BeansExcep tion: " + e.getMessa ge()); | |
| 107 | } catch (Exc eption e) { | |
| 108 | fail("fa iled with Exception: " + e.get Message()) ; | |
| 109 | } | |
| 110 | } | |
| 111 | ||
| 112 | /** | |
| 113 | * Tes t That Ini tializer C alls appCo ntext.clos e() | |
| 114 | * | |
| 115 | */ | |
| 116 | @Test | |
| 117 | public void test ThatInitia lizerCalls AppContext Close() { | |
| 118 | tr y { | |
| 119 | ClassPat hXmlApplic ationConte xt mockedA ppCtxt = m ock(ClassP athXmlAppl icationCon text.class ); | |
| 120 | whenNew( ClassPathX mlApplicat ionContext .class).wi thAnyArgum ents().the nReturn(mo ckedAppCtx t); | |
| 121 | new Cham pVAResourc e(); | |
| 122 | verify(m ockedAppCt xt, times( 1)).close( ); | |
| 123 | } catch (Bea nsExceptio n e) { | |
| 124 | fail("fa iled with BeansExcep tion: " + e.getMessa ge()); | |
| 125 | } catch (Exc eption e) { | |
| 126 | fail("fa iled with Exception: " + e.get Message()) ; | |
| 127 | } | |
| 128 | } | |
| 129 | ||
| 130 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.