@Test public void testGetName() throws Exception { Range range; Multiplicity multiplicity; final Identifier id = Identifier.fromString("1234"); AssociationEnd mockEnd; final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Type type = Mockito.mock(Type.class); Uml2XsdSyntheticHasName test; Mockito.when(mockIndex.getType(id)).thenReturn(type); Mockito.when(type.getName()).thenReturn("test"); range = new Range(Occurs.ZERO, Occurs.ONE); multiplicity = new Multiplicity(range); mockEnd = new AssociationEnd(multiplicity, "test", true, id, "test"); test = new Uml2XsdSyntheticHasName(mockEnd, mockIndex); String actual = test.getName(); String expected = "test"; Assert.assertEquals(actual, expected); range = new Range(Occurs.ZERO, Occurs.ZERO); multiplicity = new Multiplicity(range); mockEnd = new AssociationEnd(multiplicity, "test", true, id, "test"); test = new Uml2XsdSyntheticHasName(mockEnd, mockIndex); actual = test.getName(); expected = "test"; Assert.assertEquals(actual, expected); range = new Range(Occurs.ZERO, Occurs.UNBOUNDED); multiplicity = new Multiplicity(range); mockEnd = new AssociationEnd(multiplicity, "test", true, id, "test"); test = new Uml2XsdSyntheticHasName(mockEnd, mockIndex); actual = test.getName(); expected = "tests"; Assert.assertEquals(actual, expected); }
@Override public String getName() { final Occurs upperBound = end.getMultiplicity().getRange().getUpper(); final boolean plural = Occurs.UNBOUNDED.equals(upperBound); return adjustPlurality(Uml2XsdTools.camelCase(lookup.getType(end.getType()).getName()), plural); }
Uml2XsdSyntheticHasName implements HasName { @Override public String getName() { final Occurs upperBound = end.getMultiplicity().getRange().getUpper(); final boolean plural = Occurs.UNBOUNDED.equals(upperBound); return adjustPlurality(Uml2XsdTools.camelCase(lookup.getType(end.getType()).getName()), plural); } }
Uml2XsdSyntheticHasName implements HasName { @Override public String getName() { final Occurs upperBound = end.getMultiplicity().getRange().getUpper(); final boolean plural = Occurs.UNBOUNDED.equals(upperBound); return adjustPlurality(Uml2XsdTools.camelCase(lookup.getType(end.getType()).getName()), plural); } Uml2XsdSyntheticHasName(final AssociationEnd end, final ModelIndex lookup); }
Uml2XsdSyntheticHasName implements HasName { @Override public String getName() { final Occurs upperBound = end.getMultiplicity().getRange().getUpper(); final boolean plural = Occurs.UNBOUNDED.equals(upperBound); return adjustPlurality(Uml2XsdTools.camelCase(lookup.getType(end.getType()).getName()), plural); } Uml2XsdSyntheticHasName(final AssociationEnd end, final ModelIndex lookup); @Override String getName(); }
Uml2XsdSyntheticHasName implements HasName { @Override public String getName() { final Occurs upperBound = end.getMultiplicity().getRange().getUpper(); final boolean plural = Occurs.UNBOUNDED.equals(upperBound); return adjustPlurality(Uml2XsdTools.camelCase(lookup.getType(end.getType()).getName()), plural); } Uml2XsdSyntheticHasName(final AssociationEnd end, final ModelIndex lookup); @Override String getName();  }