TagAddProcessor implements ContextProcessor { @Override public void process(String host, String value, ApplicationId applicationId, ApplicationSubmissionContext submissionContext) { Set<String> applicationTags = submissionContext.getApplicationTags(); if (applicationTags == null) { applicationTags = new HashSet<>(); } else { applicationTags = new HashSet<>(applicationTags); } applicationTags.add(value); submissionContext.setApplicationTags(applicationTags); }  @Override void process(String host, String value, ApplicationId applicationId,
      ApplicationSubmissionContext submissionContext);  }
@Test public void testTagAddProcessor() { ContextProcessor tagAddProcessor = new TagAddProcessor(); ApplicationId app = ApplicationId.newInstance(123456, 111); ApplicationSubmissionContext applicationSubmissionContext = mock(ApplicationSubmissionContext.class); when(applicationSubmissionContext.getApplicationId()).thenReturn(app); tagAddProcessor.process("host.cluster2.com", "cluster:cluster1", app, applicationSubmissionContext); Set<String> applicationTags = new HashSet<String>(); applicationTags.add("cluster:cluster1"); verify(applicationSubmissionContext, times(1)) .setApplicationTags(applicationTags); }