void () { MessageCounter counter = new MessageCounter(); counter.increment(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.increment(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 2, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 2, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.increment(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 0, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 3, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.increment(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.SIMPLE, new ProjectSystemId("anotherBuildSystem")); assertEquals(counter.toString(), 2, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.remove(GROUP2, NotificationSource.PROJECT_SYNC, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 2, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.remove(null, NotificationSource.PROJECT_SYNC, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 0, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); }