### Question:
DiffLineFilter extends AutomaticBean implements Filter { @Override public boolean accept(AuditEvent event) { List<Edit> editList = fileEditMap.get(event.getFileName()); if (CollectionUtils.isEmpty(editList)) { return false; } for (Edit edit : editList) { if (edit.getBeginB() < event.getLine() && edit.getEndB() >= event.getLine()) { return true; } if (isEmptyLineSeparatorCheck(event) && event.getLine() == edit.getEndB() + 1) { return true; } } return false; } DiffLineFilter(List<DiffEntryWrapper> diffEntryList); @Override boolean accept(AuditEvent event);  }### Answer:
@Test public void testAccept() { String fileName = "test"; int lineNum = 10; int beginB = 5; int endB = 12; AuditEvent event = PowerMockito.mock(AuditEvent.class); PowerMockito.doReturn(fileName).when(event).getFileName(); PowerMockito.doReturn(lineNum).when(event).getLine(); Edit edit = PowerMockito.mock(Edit.class); PowerMockito.doReturn(beginB).when(edit).getBeginB(); PowerMockito.doReturn(endB).when(edit).getEndB(); DiffEntryWrapper wrapper = PowerMockito.mock(DiffEntryWrapper.class); PowerMockito.doReturn(fileName).when(wrapper).getAbsoluteNewPath(); PowerMockito.doReturn(Arrays.asList(edit)).when(wrapper).getEditList(); DiffLineFilter filter = new DiffLineFilter(Arrays.asList(wrapper)); Assert.assertTrue(filter.accept(event)); }
@Test public void testAcceptWithEmptyLineSeparator() { String fileName = "test"; int lineNum = 10; int beginB = 5; int endB = 9; LocalizedMessage message = PowerMockito.mock(LocalizedMessage.class); PowerMockito.doReturn(EmptyLineSeparatorCheck.class.getName()).when(message).getSourceName(); AuditEvent event = PowerMockito.mock(AuditEvent.class); PowerMockito.doReturn(fileName).when(event).getFileName(); PowerMockito.doReturn(lineNum).when(event).getLine(); PowerMockito.doReturn(message).when(event).getLocalizedMessage(); Edit edit = PowerMockito.mock(Edit.class); PowerMockito.doReturn(beginB).when(edit).getBeginB(); PowerMockito.doReturn(endB).when(edit).getEndB(); DiffEntryWrapper wrapper = PowerMockito.mock(DiffEntryWrapper.class); PowerMockito.doReturn(fileName).when(wrapper).getAbsoluteNewPath(); PowerMockito.doReturn(Arrays.asList(edit)).when(wrapper).getEditList(); DiffLineFilter filter = new DiffLineFilter(Arrays.asList(wrapper)); Assert.assertTrue(filter.accept(event)); }