Package com.jitcaforwin.trackinfoanalyzer.printout.filter

Examples of com.jitcaforwin.trackinfoanalyzer.printout.filter.LogPrintoutFilter


public class LogPrinterTest {

  @Test
  public void testPrintingWithFilter() throws IOException {
    InternalLog logMock = EasyMock.createMock(InternalLog.class);
    LogPrintoutFilter filterMock = EasyMock.createMock(LogPrintoutFilter.class);
    OutputStream outputStreamMock = EasyMock.createMock(OutputStream.class);

    logMock.print(EasyMock.anyObject(BufferedLogPrinter.class), EasyMock.eq(filterMock));
    EasyMock.expectLastCall();
    outputStreamMock.close();
View Full Code Here


public class OnlyExceptionsFilterTest {

  @Test
  public void testOkLog(){
    LogPrintoutFilter filter = LogPrintoutFilterFactory.getFilterForExceptionsOnly();
    Log logMock = EasyMock.createMock(Log.class);
    EasyMock.expect(logMock.getStatus()).andReturn(new com.jitcaforwin.trackinfoanalyzer.log.status.Ok());
    EasyMock.replay(logMock);
    assertFalse(filter.isPrintAllowed(logMock));
    EasyMock.verify(logMock);
  }
View Full Code Here

    EasyMock.verify(logMock);
  }
 
  @Test
  public void testUsualErrorLog(){
    LogPrintoutFilter filter = LogPrintoutFilterFactory.getFilterForExceptionsOnly();
    Log logMock = EasyMock.createMock(Log.class);
    EasyMock.expect(logMock.getStatus()).andReturn(new com.jitcaforwin.trackinfoanalyzer.log.status.Error());
    EasyMock.replay(logMock);
    assertFalse(filter.isPrintAllowed(logMock));
    EasyMock.verify(logMock);
  }
View Full Code Here

    this.testLogClass(EasyMock.createMock(AnalysisNotPossibleLogEntry.class));
    this.testLogClass(EasyMock.createMock(AnalysisNotPossibleBecauseOfExceptionLog.class));
  }
 
  private void testLogClass(Log logMock){
    LogPrintoutFilter filter = LogPrintoutFilterFactory.getFilterForExceptionsOnly();
    EasyMock.expect(logMock.getStatus()).andReturn(new com.jitcaforwin.trackinfoanalyzer.log.status.Error());
    EasyMock.replay(logMock);
    assertTrue(filter.isPrintAllowed(logMock));
    EasyMock.verify(logMock);
  }
View Full Code Here

public class OnlyErrorsFilterTest {

  @Test
  public void testErrorLog(){
    LogPrintoutFilter filter = LogPrintoutFilterFactory.getFilterForErrorMessagesOnly();
    Log logMock = EasyMock.createMock(Log.class);
    EasyMock.expect(logMock.getStatus()).andReturn(new com.jitcaforwin.trackinfoanalyzer.log.status.Error());
    EasyMock.replay(logMock);
    assertTrue(filter.isPrintAllowed(logMock));
    EasyMock.verify(logMock);
  }
View Full Code Here

    EasyMock.verify(logMock);
  }
 
  @Test
  public void testWarningLog(){
    LogPrintoutFilter filter = LogPrintoutFilterFactory.getFilterForErrorMessagesOnly();
    Log logMock = EasyMock.createMock(Log.class);
    EasyMock.expect(logMock.getStatus()).andReturn(new com.jitcaforwin.trackinfoanalyzer.log.status.Warning());
    EasyMock.replay(logMock);
    assertFalse(filter.isPrintAllowed(logMock));
    EasyMock.verify(logMock);
  }
View Full Code Here

    EasyMock.verify(logMock);
  }
 
  @Test
  public void testOkLog(){
    LogPrintoutFilter filter = LogPrintoutFilterFactory.getFilterForErrorMessagesOnly();
    Log logMock = EasyMock.createMock(Log.class);
    EasyMock.expect(logMock.getStatus()).andReturn(new com.jitcaforwin.trackinfoanalyzer.log.status.Ok());
    EasyMock.replay(logMock);
    assertFalse(filter.isPrintAllowed(logMock));
    EasyMock.verify(logMock);
  }
View Full Code Here

    EasyMock.verify(logMock);
  }
 
  @Test
  public void testUnknownLog(){
    LogPrintoutFilter filter = LogPrintoutFilterFactory.getFilterForErrorMessagesOnly();
    Log logMock = EasyMock.createMock(Log.class);
    EasyMock.expect(logMock.getStatus()).andReturn(new Unkown());
    EasyMock.replay(logMock);
    assertFalse(filter.isPrintAllowed(logMock));
    EasyMock.verify(logMock);
  }
View Full Code Here

public class MultiFilterTest {
 
  @Test
  public void testFactoryMethod(){
    LogPrintoutFilter filterMock = EasyMock.createMock(LogPrintoutFilter.class);
    assertEquals(MultiFilterAND.class, MultiFilter.createMultiFilterAND(filterMock).getClass());
    assertEquals(MultiFilterOR.class, MultiFilter.createMultiFilterOR(filterMock).getClass());
  }
View Full Code Here

    assertEquals(MultiFilterOR.class, MultiFilter.createMultiFilterOR(filterMock).getClass());
  }
 
  @Test
  public void testAND(){
    LogPrintoutFilter filterMock1 = EasyMock.createMock(LogPrintoutFilter.class);
    LogPrintoutFilter filterMock2 = EasyMock.createMock(LogPrintoutFilter.class);
    LogPrintoutFilter filterMock3 = EasyMock.createMock(LogPrintoutFilter.class);
    LogPrintoutFilter filter = MultiFilter.createMultiFilterAND(filterMock1, filterMock2, filterMock3);
    Log logMock = EasyMock.createMock(Log.class);
   
    EasyMock.expect(filterMock1.isPrintAllowed(EasyMock.anyObject(Log.class))).andReturn(true).times(0,1);
    EasyMock.expect(filterMock2.isPrintAllowed(EasyMock.anyObject(Log.class))).andReturn(false).times(1);
    EasyMock.expect(filterMock3.isPrintAllowed(EasyMock.anyObject(Log.class))).andReturn(true).times(0,1);
    EasyMock.replay(filterMock1, filterMock2, filterMock3, logMock);
   
    assertFalse(filter.isPrintAllowed(logMock));
   
    EasyMock.verify(filterMock1, filterMock2, filterMock3, logMock);
  }
View Full Code Here

TOP

Related Classes of com.jitcaforwin.trackinfoanalyzer.printout.filter.LogPrintoutFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.