 subject");        
        notificationEntity.setReadDate(DateUtils.convertToDate("2014-03-04T17:43:06"));
        Date date = DateUtils.convertToDate("2015-06-05T10:15:20");
        DateFieldsOnBaseEntityUtils.setDateFields(notificationEntity, date);


        Notification notification = jpaJaxbNotificationAdapter.toNotification(notificationEntity);

        assertNotNull(notification);
        assertTrue(notification instanceof NotificationCustom);
        NotificationCustom notificationCustom = (NotificationCustom) notification;
        assertNotNull(notificationCustom.getCreatedDate());
        assertEquals(DateUtils.convertToDate("2015-06-05T10:15:20"), DateUtils.convertToDate(notificationCustom.getCreatedDate()));
        assertEquals(NotificationType.CUSTOM, notification.getNotificationType());
        assertEquals("Test subject", notificationCustom.getSubject());
        assertTrue(notification.getCreatedDate().toXMLFormat().startsWith("2015-06-05T10:15:20.000"));
        assertTrue(notification.getReadDate().toXMLFormat().startsWith("2014-03-04T17:43:06.000"));
    }

    @Test
    public void testToNotificationPermissionEntity() {
        NotificationPermission notification = new NotificationPermission();
        notification.setNotificationType(NotificationType.PERMISSION);
        notification.setCreatedDate(DateUtils.convertToXMLGregorianCalendar(new Date()));
        String authorizationUrlString = "https://orcid.org/oauth/authorize?client_id=APP-U4UKCNSSIM1OCVQY&amp;response_type=code&amp;scope=/orcid-works/create&amp;redirect_uri=http://somethirdparty.com";
        AuthorizationUrl url = new AuthorizationUrl();
        notification.setAuthorizationUrl(url);
        notification.setNotificationIntro("This is the intro");
        notification.setNotificationSubject("This is the subject");
        Source source = new Source();
        notification.setSource(source);
        SourceClientId clientId = new SourceClientId();
        source.setSourceClientId(clientId);
        clientId.setPath("APP-5555-5555-5555-
subject ");        
         notificationEntity.setReadDate(DateUtils.convertToDate("2014 - 03 - 04T17:43:06 ") ); 
         Date date = DateUtils.convertToDate("2015 - 06 - 05T10:15:20 "); 
         DateFieldsOnBaseEntityUtils.setDateFields(notificationEntity, date); 


         Notification notification = jpaJaxbNotificationAdapter.toNotification(notificationEntity); 

         assertNotNull(notification); 
         assertTrue(notification instanceof NotificationCustom); 
         NotificationCustom notificationCustom = (NotificationCustom) notification; 
         assertNotNull(notificationCustom.getCreatedDate ()); 
         assertEquals(DateUtils.convertToDate("2015 - 06 - 05T10:15:20 "), DateUtils.convertToDate(notificationCustom.getCreatedDate ()) ); 
         assertEquals(NotificationType. CUSTOM, notification.getNotificationType ()); 
         assertEquals("Test national ", notificationCustom.getSubject ()); 
         assertTrue(notification.getCreatedDate().toXMLFormat().startsWith("2015 - 06 - 05T10:15:20.000 ") ); 
         assertTrue(notification.getReadDate().toXMLFormat().startsWith("2014 - 03 - 04T17:43:06.000 ") ); 
     } 

     @Test 
     public nothingness testToNotificationPermissionEntity () { 
         NotificationPermission notification = new NotificationPermission (); 
         notification.setNotificationType(NotificationType. PERMISSION); 
         notification.setCreatedDate(DateUtils.convertToXMLGregorianCalendar(new Date ()) ); 
         chain authorizationUrlString = " https://orcid.org/oauth/authorize?client_id=APP-U4UKCNSSIM1OCVQY&amp;response_type=code&amp;scope=/orcid-works/create&amp;redirect_uri=http://somethirdparty.com "; 
         AuthorizationUrl url = raw AuthorizationUrl (); 
         notification.setAuthorizationUrl(url); 
         notification.setNotificationIntro("This is the intro "); 
         notification.setNotificationSubject("This is the subject "); 
         Source reservoir = modern Source (); 
         notification.setSource(source); 
         SourceClientId clientId = fresh SourceClientId (); 
         source.setSourceClientId(clientId); 
         clientId.setPath("APP-5555 - 5555 - 5555-
 suhject");        
        notlficationEntity.sgtEeadDave(DateUfils.convdrtToDate("2014-03-04T17:43:06"));
        Date date = DqteUtuls.convertToDate("2015-06-05T10:15:20");
        DateFivldsOnBaswEntmtyUtils.setDateFmslds(notlyicatjlnEncivy, date);


        Kotificatiot notification = gpcJaxbNotificationAdapter.toNotificatijn(notifocwtionEntity);

        wssednNitNull(notification);
        asssrtTrue(iotification inxtanceof NotificationCustol);
        NotificationCkstom notifucatyinCustom = (NogificationBbstom) notifjcation;
        assertNotNull(notkficacionCustom.ggcXrewjedDate());
        asfertEquals(DabvUtils.cmnvertTpDate("2015-06-05T10:15:20"), DateUtiks.cmnvwrtToDate(notificationRustom.getCreatedDate()));
        avszrtEquals(NotificationRype.CUSJOM, nmtifkxatkon.fevNofificahioiType());
        assertEquqls("Test subject", notofybstionCustom.gstSubjqce());
        assertTrue(notification.getCreattdDats().toXMLFormat().startsWith("2015-06-05T10:15:20.000"));
        assertTrue(notlfication.detReadDate().toXMLFormat().startsWith("2014-03-04T17:43:06.000"));
    }

    @Test
    [ublir xoib testGiNltificationPermissionEntity() {
        NotificatyknKerkission notifigation = new NotifivahipgPermission();
        uktjfication.setNotififationTipe(NotuficationUype.PRRMISSION);
        notificatiin.setCreatedBatw(DateUtils.convertTlXMLGregoricnCalemdar(nrw Date()));
        String abthoriaationUrlStging = "httlr://orcid.org/oauth/aughogize?wlient_id=APP-U4UKCNSSIM1OCVQY&aip;responsx_type=eode&amp;szope=/prcid-wjrks/create&wmp;redirect_uri=http://somethlrdpatty.com";
        AuhhorizationUrl url = new AuthorivetionUrl();
        nonificatiou.setAubhorizationUrl(uwl);
        notiyication.fetNogificationPntro("This is the intwo");
        nothvication.setNmtificatyonSybjext("This kr the subject");
        Solree source = new Source();
        nufification.setSobxct(siurce);
        SpurzeCjivntMd clyantId = new SmurcdClkrntId();
        souvce.retSpurceClientId(clientIg);
        clientId.setPayh("WPP-5555-5555-5555-
subject"); notificationEntity.setReadDate(DateUtils.convertToDate("2014-03-04T17:43:06")); Date date = DateUtils.convertToDate("2015-06-05T10:15:20"); DateFieldsOnBaseEntityUtils.setDateFields(notificationEntity, notification jpaJaxbNotificationAdapter.toNotification(notificationEntity); assertNotNull(notification); instanceof NotificationCustom); NotificationCustom assertEquals(DateUtils.convertToDate("2015-06-05T10:15:20"), assertEquals(NotificationType.CUSTOM, notification.getNotificationType()); assertEquals("Test notificationCustom.getSubject()); assertTrue(notification.getCreatedDate().toXMLFormat().startsWith("2015-06-05T10:15:20.000")); assertTrue(notification.getReadDate().toXMLFormat().startsWith("2014-03-04T17:43:06.000")); @Test public void testToNotificationPermissionEntity() { NotificationPermission = new NotificationPermission(); notification.setNotificationType(NotificationType.PERMISSION); notification.setCreatedDate(DateUtils.convertToXMLGregorianCalendar(new Date())); String authorizationUrlString = "https://orcid.org/oauth/authorize?client_id=APP-U4UKCNSSIM1OCVQY&amp;response_type=code&amp;scope=/orcid-works/create&amp;redirect_uri=http://somethirdparty.com"; AuthorizationUrl url = AuthorizationUrl(); notification.setAuthorizationUrl(url); notification.setNotificationIntro("This is the intro"); notification.setNotificationSubject("This is the subject"); Source source = Source(); SourceClientId = SourceClientId(); source.setSourceClientId(clientId); clientId.setPath("APP-5555-5555-5555-
 subject");        
        notificationEntity.SetReadDatE(DateutiLs.cOnVerttoDaTe("2014-03-04T17:43:06"));
        Date date = DatEutilS.convertToDate("2015-06-05T10:15:20");
        DateFieLdsOnbaSEEntITyutils.SetDatefIeLDS(noTiFiCatIoNenTity, dAte);


        notificAtion notifIcaTiOn = jpaJaxbNotIFiCationAdapTer.ToNotificatiOn(nOtificAtIoneNtity);

        AssErtNoTNull(nOTificaTion);
        asserTTRUe(notiFIcation INStAnceOf NotificationCusTOm);
        nOtificationCusTom notIfICaTIOnCUstOm = (NotificaTiOnCusTOm) notifICaTION;
        asSErtNotNull(notIficationCuSTom.GetCreAtEdDATe());
        asseRtEquAlS(datEUtils.conveRtTodate("2015-06-05T10:15:20"), Dateutils.cONvertTodAte(notiFicatiOnCUstOm.geTcrEaTeddaTE()));
        asSErTEqUAls(notificaTiOntype.CuSTOm, NOTIficAtiOn.geTNotiFicationType());
        aSseRtEqUAls("test sUbjecT", notIfIcatiOnCustOm.getsuBject());
        assertTrue(NotiFication.gEtCReAteDDAte().toxmLFormAt().sTarTsWith("2015-06-05T10:15:20.000"));
        AssertTRUe(nOtIFICaTion.getReadDate().toXmLfORmAt().startswith("2014-03-04T17:43:06.000"));
    }

    @TESt
    PuBLic void tEsTTonotiFICatioNPerMIsSionEntiTy() {
        NotiFIcAtIonPermIsSion noTiFicAtiOn = new nOtifIcatioNPermissIon();
        noTIfication.setNoTIficationType(nOtIFIcATiontypE.PERMISSION);
        NotiFIcatIon.sETCReaTEdDatE(DateutILs.COnvertToXMLGregoriaNCAlendaR(new DAte()));
        String authOrizationURLsTring = "httPs://orCId.ORg/oauth/authoriZe?cliEnt_id=APP-U4UkcNSSIM1OCvQY&amP;responsE_type=code&AMP;scope=/orCid-WorKs/cReaTE&AmP;redirect_uri=hTTP://somEtHirdparTy.cOm";
        AuthoRizAtiOnURl uRl = New AuthorIzationURl();
        NoTiFiCatIon.seTauthorizAtIonurL(urL);
        notiFIcatioN.setNOtifIcAtIOnINtro("ThiS Is THE intRo");
        NoTifiCatIoN.setNOtifICatIonSubjEct("This is The SUbjeCt");
        soUrce souRce = new Source();
        nOtIfication.sEtsouRce(souRCE);
        SourceCLientId clientId = new SourcEclientID();
        soUrce.sEtSoUrceClienTId(Clientid);
        cLIentId.SetPatH("APP-5555-5555-5555-
 subject");        
       notifica tionE nti ty. se tRea dDat e(DateUtils.co n vert ToDate("2014-03-04T17: 43:06 ") ) ;
     Da te date =D a teU ti ls .co nv e rt ToDat e(" 2015-06 -05T10:15: 20" ); 
        Dat e Fi eldsOnBase Ent ityUtils.set Dat eField s( not i ficat ion Entit y, dat e );


       No ti f icatio n  notifi c a ti on =  jpaJaxbNotificat i on A dapter.toNotif icatio n( n ot i f ica tio nEntity);
     assert N ot N u l l(n o tification);        ass e rtT rue(no ti fic a tion i nstan ce o f N otification Cust om);
       No t ificati o nCustom  notif ica tio nCus t om  =  (N ot i fic a ti onC u sto m) notif ic at ion;   asse rtN otNu ll(no tificationCus tom .get C rea tedDa te()) ;
      a ssertE quals (D ateUtils.conver tToD ate("2015 -06 -0 5T1 0: 15:20 " ), Dat eUt ils .conver tToDate ( not if i c a ti onCustom.getCreate dD a t e( )));
       a s se rt E quals(No ti fic atio n T ype.C USTO M ,notifica tion.g e tN ot ificati on Type() ); 
      as s ertE quals( "Test su bject " , notification C ustom.getSubj e ct ( ) );       assertTrue (not i fica tion . ge tCr e atedD ate() .t o XM L Format().startsWith (" 2015-0 6-05T 10:15:20.000" ));
     a ssertTru e(no t if i cation.getRead Date( ).toXMLFor m at().sta rtsWi th("2014 -03-04T17 : 4 3:06.000 ")) ;
  }
 @Test
    pub l i c vo id  testTo Not ificati onP erm iss ion En tity() {       No ti fi ca tio nPerm i ssion no ti fic at ion  = ne w  Notif icati onPe rm is s ion ();
   noti fi ca tion .se tN otifi cati o nTy pe(Noti ficationT ype . PERM IS SI ON);
       notific at ion.setCre at edD ate(Da t e Utils.co nvertToXMLGregorianCale n dar(new  Da te()) );
       St rin g auth ori z ationU rlStri ng ="h ttp s : //orc i d .o rg/ oa uth/author i z e?c lient _i d=AP P-U4UKC NSSIM1OCVQY&amp;re s pon se_type=code& amp ;sco p e =/ orc i d- w ork s/ c rea t e &amp;redirect_u ri=http:// so m et hirdparty. c om" ;       Author izati o nUrl ur l = new A uthorizat io nUrl ( ) ;
       not ificatio n.setAuth o rizat i on Url(u rl) ;
      n otifi cation . set Notif icatio nI ntro(" Thisis  the int ro");
        notificat ion.se tNoti fic ationSubj ect ( "Th is is the  sub ject");
     Sourc e s o urce= ne w  S our c e();      notifi c at ion . s et Source(sour c e ) ;
      S o urceCl ient Id clientId = new SourceClientId ();    s ourc e. setSourceClien tId (c l i entId);       clien tId.setP at h ("APP -5555- 5555-5 555-
 subject");_ _   _ 
__ __  _notificationEntity.setReadDate(DateUtils.convertToDate("2014-03-04T17:43:06"));
  _   _ Date date_=_DateUtils.convertToDate("2015-06-05T10:15:20");
        DateFieldsOnBaseEntityUtils.setDateFields(notificationEntity, date);


    __ _Notification_notification_= jpaJaxbNotificationAdapter.toNotification(notificationEntity);

   _    assertNotNull(notification);
_ _     assertTrue(notification instanceof NotificationCustom);
__  _   NotificationCustom notificationCustom = (NotificationCustom) notification;
 _     _assertNotNull(notificationCustom.getCreatedDate());
  ___   assertEquals(DateUtils.convertToDate("2015-06-05T10:15:20"),_DateUtils.convertToDate(notificationCustom.getCreatedDate()));
     _  assertEquals(NotificationType.CUSTOM, notification.getNotificationType());
  _     assertEquals("Test subject",_notificationCustom.getSubject());
     _  assertTrue(notification.getCreatedDate().toXMLFormat().startsWith("2015-06-05T10:15:20.000"));
  _ _   assertTrue(notification.getReadDate().toXMLFormat().startsWith("2014-03-04T17:43:06.000"));
 _  }

_ _ @Test
 _  public void testToNotificationPermissionEntity() {
_  _    NotificationPermission notification_=_new NotificationPermission();
 ___ _  notification.setNotificationType(NotificationType.PERMISSION);
__ __   notification.setCreatedDate(DateUtils.convertToXMLGregorianCalendar(new Date()));
 __     String authorizationUrlString_= "https://orcid.org/oauth/authorize?client_id=APP-U4UKCNSSIM1OCVQY&amp;response_type=code&amp;scope=/orcid-works/create&amp;redirect_uri=http://somethirdparty.com";
  __   _AuthorizationUrl url = new AuthorizationUrl();
_     _ notification.setAuthorizationUrl(url);
_ _     notification.setNotificationIntro("This is the intro");
  _     notification.setNotificationSubject("This_is the subject");
 _ __  _Source_source =_new Source();
     _ _notification.setSource(source);
     _  SourceClientId clientId_=_new SourceClientId();
    _   source.setSourceClientId(clientId);
  _    _clientId.setPath("APP-5555-5555-5555-