### Question:
XmiReader { protected static final Occurs getOccurs(final XMLStreamReader reader, final XmiAttributeName name) { final int value = Integer.valueOf(reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName())); switch (value) { case 0: { return Occurs.ZERO; } case 1: { return Occurs.ONE; } case -1: { return Occurs.UNBOUNDED; } default: { throw new AssertionError(value); } } }  static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model readModel(final String fileName);  }### Answer:
@Test public void testGetOccursHappyPath() { when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("1"); assertTrue(XmiReader.getOccurs(mockReader, sampleAttribute) == Occurs.ONE); when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("0"); assertTrue(XmiReader.getOccurs(mockReader, sampleAttribute) == Occurs.ZERO); when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("-1"); assertTrue(XmiReader.getOccurs(mockReader, sampleAttribute) == Occurs.UNBOUNDED); }
@Test(expected = AssertionError.class) public void testGetOccursSadPath() { when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("123"); XmiReader.getOccurs(mockReader, sampleAttribute); }