@Test
public void testGetGridRectangle_variableRankIncorrect() {

    final Variable mockVariable = mock(Variable.class);
    when(mockVariable.getRank()).thenReturn(1);
    try {
        NcTools.getGridRectangle(netcdfFile, mockVariable, GridDef.createGlobal(2.9));
        fail("IOException expected");
    } catch (IOException expected) {
    }
    verify(mockVariable, times(1)).getRank();
    verify(netcdfFile, times(1)).getLocation();
    verifyNoMoreInteractions(netcdfFile);
}