Produced by Araxis Merge on 2/4/2019 11:34:05 AM 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 | MHPRO_v1.x.zip\mhpro-resources-master@a26412b610c.zip\ws\src\test\java\gov\va\mobile\vamf\mhpro\exception | MhproExceptionUtilsTest.java | Tue Nov 14 19:31:17 2017 UTC |
| 2 | MHPRO_v1.x.zip\mhpro-resources-master@a26412b610c.zip\ws\src\test\java\gov\va\mobile\vamf\mhpro\exception | MhproExceptionUtilsTest.java | Fri Feb 1 19:27:42 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 250 |
| 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 | package go v.va.mobil e.vamf.mhp ro.excepti on; | |
| 2 | ||
| 3 | import sta tic org.ha mcrest.Mat cherAssert .assertTha t; | |
| 4 | import sta tic org.ha mcrest.Mat chers.cont ainsString ; | |
| 5 | import sta tic org.ju nit.Assert .assertEqu als; | |
| 6 | import sta tic org.ju nit.Assert .assertNot Null; | |
| 7 | ||
| 8 | import gov .va.mobile .vamf.comm on.excepti on.AppExce ption; | |
| 9 | ||
| 10 | import org .junit.Bef ore; | |
| 11 | import org .junit.Tes t; | |
| 12 | import org .junit.run ner.RunWit h; | |
| 13 | import org .mockito.r unners.Moc kitoJUnitR unner; | |
| 14 | ||
| 15 | /** | |
| 16 | * @author PII | |
| 17 | * | |
| 18 | * Unit te st MhproEx ceptionUti ls | |
| 19 | */ | |
| 20 | @RunWith(M ockitoJUni tRunner.cl ass) | |
| 21 | public cla ss MhproEx ceptionUti lsTest { | |
| 22 | pr ivate Stri ng clazzNa me; | |
| 23 | ||
| 24 | @B efore | |
| 25 | pu blic void setup() { | |
| 26 | claz zName = th is.getClas s().getCan onicalName (); | |
| 27 | } | |
| 28 | ||
| 29 | /* * | |
| 30 | * test call to: | |
| 31 | * | |
| 32 | * MhproExce ptionUtils .getMethod Name() | |
| 33 | * / | |
| 34 | @T est | |
| 35 | pu blic void testGetMet hodName() { | |
| 36 | Stri ng devMsg = MhproExc eptionUtil s.getMetho dName(); | |
| 37 | ||
| 38 | asse rtEquals(d evMsg, "te stGetMetho dName"); | |
| 39 | } | |
| 40 | ||
| 41 | /* * | |
| 42 | * test call to: | |
| 43 | * | |
| 44 | * MhproExce ptionUtils .buildDeve loperMessa ge with ex ception as parameter | |
| 45 | * / | |
| 46 | @T est | |
| 47 | pu blic void testBuildD eveloperMe ssageWithE xception() { | |
| 48 | Stri ng devMsg = MhproExc eptionUtil s.buildDev eloperMess age( | |
| 49 | clazzNam e, | |
| 50 | MhproExc eptionUtil s.getMetho dName(), | |
| 51 | new Exce ption("Tes t buildDev eloperMess age")); | |
| 52 | ||
| 53 | asse rtNotNull( devMsg); | |
| 54 | ||
| 55 | asse rtThat(dev Msg, conta insString( clazzName) ); | |
| 56 | asse rtThat(dev Msg, conta insString( "Exception ") ); | |
| 57 | asse rtThat(dev Msg, conta insString( "Test buil dDeveloper Message") ); | |
| 58 | ||
| 59 | } | |
| 60 | ||
| 61 | /* * | |
| 62 | * test call to: | |
| 63 | * | |
| 64 | * MhproExce ptionUtils .buildDeve loperMessa ge with pa rameters c lass name, method na me, and de veloper's message. | |
| 65 | * / | |
| 66 | @T est | |
| 67 | pu blic void testBuildD eveloperMe ssageWithM essage() { | |
| 68 | Stri ng devMsg = MhproExc eptionUtil s.buildDev eloperMess age( | |
| 69 | clazzNam e, | |
| 70 | MhproExc eptionUtil s.getMetho dName(), | |
| 71 | "Test Ex ception Me ssage"); | |
| 72 | ||
| 73 | asse rtNotNull( devMsg); | |
| 74 | asse rtThat(dev Msg, conta insString( clazzName) ); | |
| 75 | asse rtThat(dev Msg, conta insString( "testBuild DeveloperM essageWith Message") ); | |
| 76 | } | |
| 77 | ||
| 78 | ||
| 79 | /* * | |
| 80 | * test call to: | |
| 81 | * | |
| 82 | * wrapIntoA ppExceptio n( | |
| 83 | * Except ion e, int appErrorC ode, Strin g errorMsg , String d eveloperMe ssage, int responseS tatus) | |
| 84 | * | |
| 85 | * example c all: | |
| 86 | * | |
| 87 | * throw Mhp roExceptio nUtils.wra pIntoAppEx ception( | |
| 88 | * e, GEN ERIC_APP_E RROR_CODE, failureCa useMessage ,failureCa useMessage , HttpStat us.INTERNA L_SERVER_E RROR.value ()); | |
| 89 | * | |
| 90 | * / | |
| 91 | @T est | |
| 92 | pu blic void testWrapIn toAppExcep tion() { | |
| 93 | int appErrorCo de = 1; | |
| 94 | Stri ng excepti on = "NoRe cordsFound Exception" ; | |
| 95 | Stri ng errorMs g = except ion+"-Erro rMessage"; | |
| 96 | Stri ng failure CauseMessa ge = "fail ureCauseMe ssage"; | |
| 97 | int responseSt atus = -1; | |
| 98 | AppE xception a ppExceptio n; | |
| 99 | ||
| 100 | try { | |
| 101 | throw new NoReco rdsFoundEx ception(er rorMsg); | |
| 102 | } ca tch (NoRec ordsFoundE xception e ) { | |
| 103 | appExc eption = M hproExcept ionUtils.w rapIntoApp Exception( | |
| 104 | e, | |
| 105 | appErrorCo de, | |
| 106 | errorMsg, | |
| 107 | failureCau seMessage, | |
| 108 | responseSt atus); | |
| 109 | } | |
| 110 | ||
| 111 | asse rtNotNull( appExcepti on); | |
| 112 | asse rtNotNull( appExcepti on.getDeve loperMessa ge()); | |
| 113 | ||
| 114 | //Sy stem.out.p rintln(app Exception. getDevelop erMessage( )); | |
| 115 | ||
| 116 | asse rtNotNull( appExcepti on.getStac kTrace()); | |
| 117 | asse rtThat(app Exception. getDevelop erMessage( ), contain sString(ex ception)); | |
| 118 | ||
| 119 | asse rtThat(Int eger.toStr ing(appExc eption.get ErrorCode( )), contai nsString(I nteger.toS tring(appE rrorCode)) ); | |
| 120 | asse rtThat(app Exception. getDevelop erMessage( ), contain sString(er rorMsg) ); | |
| 121 | asse rtThat(app Exception. getDevelop erMessage( ), contain sString(fa ilureCause Message) ) ; | |
| 122 | asse rtThat(Int eger.toStr ing(appExc eption.get Status()), containsS tring(Inte ger.toStri ng(respons eStatus)) ); | |
| 123 | ||
| 124 | asse rtNotNull( appExcepti on.getMess age()); | |
| 125 | } | |
| 126 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.