Edge { public Bond bond() { return bond; } Edge(final int u, final int v, final Bond bond);   Edge(Edge e); int either(); int other(final int x); Bond bond(); Bond bond(final int x); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString();  }
@Test public void bond() throws Exception { assertThat(new Edge(2, 3, Bond.SINGLE).bond(), is(Bond.SINGLE)); assertThat(new Edge(2, 3, Bond.UP).bond(), is(Bond.UP)); assertThat(new Edge(2, 3, Bond.DOWN).bond(), is(Bond.DOWN)); }
@Test public void relativeBond() throws Exception { assertThat(new Edge(2, 3, Bond.SINGLE).bond(2), is(Bond.SINGLE)); assertThat(new Edge(2, 3, Bond.SINGLE).bond(3), is(Bond.SINGLE)); assertThat(new Edge(2, 3, Bond.UP).bond(2), is(Bond.UP)); assertThat(new Edge(2, 3, Bond.UP).bond(3), is(Bond.DOWN)); assertThat(new Edge(2, 3, Bond.DOWN).bond(2), is(Bond.DOWN)); assertThat(new Edge(2, 3, Bond.DOWN).bond(3), is(Bond.UP)); }
@Test(expected = IllegalArgumentException.class) public void invalidRelativeBond() throws Exception { new Edge(2, 3, Bond.IMPLICIT).bond(1); }