@Test public void testGetBoolean() { boolean defaultBoolean; defaultBoolean = false; when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("true"); assertTrue(XmiReader.getBoolean(sampleAttribute, defaultBoolean, mockReader)); defaultBoolean = true; when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("false"); assertFalse(XmiReader.getBoolean(sampleAttribute, defaultBoolean, mockReader)); defaultBoolean = false; when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn(null); assertFalse(XmiReader.getBoolean(sampleAttribute, defaultBoolean, mockReader)); defaultBoolean = true; when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn(null); assertTrue(XmiReader.getBoolean(sampleAttribute, defaultBoolean, mockReader)); }
protected static final boolean getBoolean(final XmiAttributeName name, final boolean defaultValue, final XMLStreamReader reader) { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName()); if (value != null) { return Boolean.valueOf(value); } else { return defaultValue; } }
XmiReader { protected static final boolean getBoolean(final XmiAttributeName name, final boolean defaultValue, final XMLStreamReader reader) { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName()); if (value != null) { return Boolean.valueOf(value); } else { return defaultValue; } } }
XmiReader { protected static final boolean getBoolean(final XmiAttributeName name, final boolean defaultValue, final XMLStreamReader reader) { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName()); if (value != null) { return Boolean.valueOf(value); } else { return defaultValue; } }  }
XmiReader { protected static final boolean getBoolean(final XmiAttributeName name, final boolean defaultValue, final XMLStreamReader reader) { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName()); if (value != null) { return Boolean.valueOf(value); } else { return defaultValue; } }  static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model readModel(final String fileName); }
XmiReader { protected static final boolean getBoolean(final XmiAttributeName name, final boolean defaultValue, final XMLStreamReader reader) { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName()); if (value != null) { return Boolean.valueOf(value); } else { return defaultValue; } }  static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model readModel(final String fileName);  }