OneCollectorChannelListener extends AbstractChannelListener { @Override public boolean shouldFilter(@NonNull Log log) { return isOneCollectorCompatible(log); } OneCollectorChannelListener(@NonNull Channel channel, @NonNull LogSerializer logSerializer, @NonNull HttpClient httpClient, @NonNull UUID installId); @VisibleForTesting  OneCollectorChannelListener(@NonNull OneCollectorIngestion ingestion, @NonNull Channel channel, @NonNull LogSerializer logSerializer, @NonNull UUID installId); void setLogUrl(@NonNull String logUrl); @Override void onGroupAdded(@NonNull String groupName, Channel.GroupListener groupListener, long batchTimeInterval); @Override void onGroupRemoved(@NonNull String groupName); @Override void onPreparedLog(@NonNull Log log, @NonNull String groupName, int flags); @Override boolean shouldFilter(@NonNull Log log); @Override void onClear(@NonNull String groupName); @Override void onPaused(@NonNull String groupName, String targetToken); @Override void onResumed(@NonNull String groupName, String targetToken); @Override void onGloballyEnabled(boolean isEnabled);  }
@Test public void shouldFilterAppCenterLog() { Channel channel = mock(Channel.class); OneCollectorChannelListener listener = new OneCollectorChannelListener(channel, mock(LogSerializer.class), createHttpClient(mock(Context.class)), UUID.randomUUID()); Log log = mock(Log.class); assertFalse(listener.shouldFilter(log)); when(log.getTransmissionTargetTokens()).thenReturn(new HashSet<>(Collections.singletonList("token"))); assertTrue(listener.shouldFilter(log)); assertFalse(listener.shouldFilter(mock(CommonSchemaLog.class))); }