@Test public void testGetType() throws IOException { Cell c = Mockito.mock(Cell.class); Mockito.when(c.getType()).thenCallRealMethod(); for (Cell.Type type : Cell.Type.values()) { Mockito.when(c.getTypeByte()).thenReturn(type.getCode()); assertEquals(type, c.getType()); } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } }
@Test public void testGetType() throws IOException { Cell c = Mockito.mock(Cell.class); Mockito.when(c.getType()).thenCallRealMethod(); for (Cell.Type type : Cell.Type.values()) { Mockito.when(c.getTypeByte()).thenReturn(type.getCode()); assertEquals(type, c.getType()); } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } }
@Test public void testGetType() throws IOException { Cell c = Mockito.mock(Cell.class); Mockito.when(c.getType()).thenCallRealMethod(); for (Cell.Type type : Cell.Type.values()) { Mockito.when(c.getTypeByte()).thenReturn(type.getCode()); assertEquals(type, c.getType()); } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } try { Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode()); c.getType(); fail("The code of Maximum can't be handled by Cell.Type"); } catch(UnsupportedOperationException e) { } }