Project

General

Profile

« Previous | Next » 

Revision 6698

catch all possible exceptions

View differences:

test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java
783 783
  public void testGetLogRecords() {
784 784
    printTestHeader("testLogRecords");
785 785

  
786
    Log log = null;
787
    Session session = getTestSession();
788
    Date fromDate = new Date();
789
    Calendar calendar = Calendar.getInstance();
790
    calendar.setTime(fromDate);
791
    calendar.roll(Calendar.YEAR, false);
792
    fromDate = calendar.getTime();
793
    Date toDate = new Date();
794
    Event event = Event.CREATE;
795
    int start = 0;
796
    int count = 1;
786
    try {
787
	    Log log = null;
788
	    Session session = getTestSession();
789
	    Date fromDate = new Date();
790
	    Calendar calendar = Calendar.getInstance();
791
	    calendar.setTime(fromDate);
792
	    calendar.roll(Calendar.YEAR, false);
793
	    fromDate = calendar.getTime();
794
	    Date toDate = new Date();
795
	    Event event = Event.CREATE;
796
	    int start = 0;
797
	    int count = 1;
797 798
    
798
    try {
799 799
      log = MNodeService.getInstance(request).getLogRecords(session, fromDate, toDate, 
800 800
        event, start, count);
801 801
      
......
804 804
      assertTrue(log.getStart() == start);
805 805
      assertTrue(log.getTotal() >= 1);
806 806
        
807
    } catch (InvalidToken e) {
807
    } catch (Exception e) {
808 808
      e.printStackTrace();
809 809
      fail("Unexpected error: " + e.getMessage());
810 810

  
811
    } catch (ServiceFailure e) {
812
      e.printStackTrace();
813
      fail("Unexpected error: " + e.getMessage());
814
      
815
    } catch (NotAuthorized e) {
816
      e.printStackTrace();
817
      fail("Unexpected error: " + e.getMessage());
818
      
819
    } catch (InvalidRequest e) {
820
      e.printStackTrace();
821
      fail("Unexpected error: " + e.getMessage());
822
      
823
    } catch (NotImplemented e) {
824
      e.printStackTrace();
825
      fail("Unexpected error: " + e.getMessage());
826
      
827 811
    }
828 812
  }
829 813

  

Also available in: Unified diff