@@ -185,6 +185,54 @@ public void KnownUserFactory_VerifyMd5HashTest_InvalidHash_Test() {
185185 VerifyMd5Hash_Test ("becb0723-fee7-4a82-87d0-622475c7cf36" , 1349168841 , 7810 , "88401038-0306-4831-b7c0-e115da0bdc46" , "d4e47d0b1a732c5dbf3e10d92881ed93" , "mpro" );
186186 }
187187
188+ @ Test ()
189+ public void KnownUserFactory_VerifyMd5HashTest_KnownUserException_Test () {
190+ //Arrange
191+ Date expectedTimeStamp = null ;
192+ String querystringPrefix = "mpro" ;
193+ int unixTimestamp = 1349168841 ;
194+ String expectedQueueId = "becb0723-fee7-4a82-87d0-622475c7cf36" ;
195+ String placeInQueueEncrypted = "88401038-0306-4831-b7c0-e115da0bdc46" ;
196+ String hash = "d4e47d0b1a732c5dbf3e10d92881ed93" ;
197+
198+ try {
199+ if (unixTimestamp > 0 ) {
200+ expectedTimeStamp = Calendar .getInstance ().getTime ();
201+ expectedTimeStamp .setTime (unixTimestamp * 1000 );
202+ }
203+ } catch (Exception e ) {
204+ //Ignore
205+ }
206+ RedirectType expectedRedirectType = RedirectType .Queue ;
207+ String expectedCustomerId = "somecust" ;
208+ String expectedEventId = "someevent" ;
209+ String expectedOriginalUrl = "http://www.ticketanina.com/shop.aspx?x=sdfsdf" ;
210+ String urlWithHash = expectedOriginalUrl
211+ + "&" + querystringPrefix + "q=" + expectedQueueId
212+ + "&" + querystringPrefix + "p=" + placeInQueueEncrypted
213+ + "&" + querystringPrefix + "ts=" + unixTimestamp
214+ + "&" + querystringPrefix + "c=" + expectedCustomerId
215+ + "&" + querystringPrefix + "e=" + expectedEventId
216+ + "&" + querystringPrefix + "h=" + hash ;
217+
218+ MockUrlProvider urlProvider = null ;
219+ try {
220+ urlProvider = new MockUrlProvider (new URI (urlWithHash ), expectedQueueId , placeInQueueEncrypted , String .valueOf (unixTimestamp ), expectedEventId , expectedCustomerId , new URI (expectedOriginalUrl ), expectedRedirectType .toString ());
221+ } catch (Exception ex ) {
222+ //ignore
223+ }
224+
225+ //Act
226+ try
227+ {
228+ IKnownUser knownUser = KnownUserFactory .verifyMd5Hash (SharedSecreteEventKey , urlProvider , querystringPrefix );
229+ } catch (KnownUserException ex ) {
230+ //Assert
231+ assertEquals (expectedOriginalUrl , ex .getOriginalUrl ().toString ());
232+ assertEquals (urlWithHash , ex .getValidationUrl ().toString ());
233+ }
234+ }
235+
188236 @ Test (expected = InvalidKnownUserUrlException .class )
189237 public void KnownUserFactory_VerifyMd5HashTest_NoParameters_Test () {
190238 // "d4e47d0b1a732c5dbf3e10d92881ed92" is valid hash
0 commit comments