### Question:
Connection implements Serializable { public final void setWeight(Weight weight) { if (weight == null) { throw new IllegalArgumentException("Connection Weight cant be null!"); } else { this.weight = weight; } } Connection(Neuron fromNeuron, Neuron toNeuron);  Connection(Neuron fromNeuron, Neuron toNeuron, Weight weight);  Connection(Neuron fromNeuron, Neuron toNeuron, double weightVal); final Weight getWeight(); final void setWeight(Weight weight); double getInput(); final double getWeightedInput(); final Neuron getFromNeuron(); final Neuron getToNeuron(); @Override Object clone(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testSetWeight() { Weight weight = new Weight(0.88); Connection instance = new Connection(fromNeuron, toNeuron); instance.setWeight(weight); assertEquals(weight, instance.getWeight()); }
@Test(expected = IllegalArgumentException.class) public void throwsExceptionWhenWeightIsSetToNull() { Weight weight = null; Connection instance = new Connection(fromNeuron, toNeuron); instance.setWeight(weight); }