### Question:
NwpTool extends BasicTool { static int getMatchupCount(Array sensorPatterns, int wantedPattern) { int matchupCount = 0; for (int i = 0; i < sensorPatterns.getSize(); ++i) { if ((sensorPatterns.getInt(i) & wantedPattern) == wantedPattern) { matchupCount++; } } return matchupCount; } NwpTool(); static void main(String[] args); @Override void initialize();  }### Answer:
@Test public void testGetMatchupCount_noInputData() { final Array array = mock(Array.class); when(array.getSize()).thenReturn(0L); final int matchupCount = NwpTool.getMatchupCount(array, 800); assertEquals(0, matchupCount); }
@Test public void testGetMatchupCount_noMatchingPattern() { final Array array = mock(Array.class); when(array.getSize()).thenReturn(3L); when(array.getInt(0)).thenReturn(200); when(array.getInt(1)).thenReturn(1600); when(array.getInt(2)).thenReturn(400); final int matchupCount = NwpTool.getMatchupCount(array, 800); assertEquals(0, matchupCount); }
@Test public void testGetMatchupCount_matchingPattern() { final Array array = mock(Array.class); when(array.getSize()).thenReturn(4L); when(array.getInt(0)).thenReturn(400); when(array.getInt(1)).thenReturn(1600); when(array.getInt(2)).thenReturn(800); when(array.getInt(3)).thenReturn(8); final int matchupCount = NwpTool.getMatchupCount(array, 800); assertEquals(1, matchupCount); }