mil.dod.th.ose.test/src/mil/dod/th/ose/test/EventAdminVerifier.java
public static void assertOnlyGivenEvents(EventAdmin admin, 
            List<String> expectedTopics, List<Map<String, Object>> expectedProperties)
    {
        ArgumentCaptor<Event> evtCaptor = ArgumentCaptor.forClass(Event.class);
        verify(admin, Mockito.atLeast(expectedTopics.size())).postEvent(evtCaptor.capture());
        
        for (Event event : evtCaptor.getAllValues())
        {
            for (int i = 0; i < expectedTopics.size(); i++)
            {
                if (expectedTopics.get(i).equals(event.getTopic()))
                {
                    verifyGivenProperties(event, expectedTopics.get(i), expectedProperties.get(i));
                    break;
                }
            }
        }
    }
/**
     * Method to assert only the given topics regardless of other posted events. Order of expected topics
     * does not matter but it is expected that topic and properties lists correspond. Only given properties
     * will be checked.
     * @param admin
     *  the event admin to use
     * @param expectedTopics
     *  the expected topics to check for
     * @param expectedProperties
     *  the expected properties that correspond to the given expected topics
     */
Method to assert only the given topics regardless of other posted events. Order of expected topics
does not matter but it is expected that topic and properties lists correspond. Only given properties
will be checked.
@param admin
the event admin to use
@param expectedTopics
the expected topics to check for
@param expectedProperties
the expected properties that correspond to the given expected topics
Method to assert only the given topics regardless of other posted events . Order of expected topics does not matter but it is expected that topic and properties lists correspond . Only given properties will be checked . @param admin the event admin to use @param expectedTopics the expected topics to check for @param expectedProperties the expected properties that correspond to the given expected topics
public static void assertOnlyGivenEvents(EventAdmin admin, 
            List<String> expectedTopics, List<Map<String, Object>> expectedProperties)
    {
        ArgumentCaptor<Event> evtCaptor = ArgumentCaptor.forClass(Event.class);
        verify(admin, Mockito.atLeast(expectedTopics.size())).postEvent(evtCaptor.capture());
        for (Event event : evtCaptor.getAllValues())
        {
            for (int i = 0; i < expectedTopics.size(); i++)
            {
                if (expectedTopics.get(i).equals(event.getTopic()))
                {
                    verifyGivenProperties(event, expectedTopics.get(i), expectedProperties.get(i));
                    break;
                }
            }
        }
    }
public static void assertOnlyGivenEvents ( EventAdmin admin , List < String > expectedTopics , List < Map < String , Object > > expectedProperties ) { ArgumentCaptor < Event > evtCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( admin , Mockito . atLeast ( expectedTopics . size ( ) ) ) . postEvent ( evtCaptor . capture ( ) ) ; for ( Event event : evtCaptor . getAllValues ( ) ) { for ( int i = 0 ; i < expectedTopics . size ( ) ; i ++ ) { if ( expectedTopics . get ( i ) . equals ( event . getTopic ( ) ) ) { verifyGivenProperties ( event , expectedTopics . get ( i ) , expectedProperties . get ( i ) ) ; break ; } } } }
Method to assert only the given topics regardless of other posted events.
Method to assert only the given topics regardless of other posted events .