### Question:
BackPropagation extends LMS { protected void calculateErrorAndUpdateHiddenNeurons() { List<Layer> layers = neuralNetwork.getLayers(); for (int layerIdx = layers.size() - 2; layerIdx > 0; layerIdx--) { for (Neuron neuron : layers.get(layerIdx).getNeurons()) { final double delta = calculateHiddenNeuronError(neuron); neuron.setDelta(delta); calculateWeightChanges(neuron); } } } BackPropagation();   }### Answer:
@Test public void testCalculateErrorAndUpdateHiddenNeurons() { NeuralNetwork<BackPropagation> nn = new NeuralNetwork<>(); nn.setInputNeurons(new ArrayList<Neuron>() { { add(new Neuron()); add(new Neuron()); } }); nn.setOutputNeurons(new ArrayList<Neuron>() { { add(new Neuron()); } }); nn.setLearningRule(instance); Layer l1 = new Layer(); Layer l2 = new Layer(); Layer l3 = new Layer(); Neuron n = new Neuron(); n.setDelta(0.5); Neuron n1 = new Neuron(); Linear transfer = new Linear(); n1.setTransferFunction(transfer); double weigth = 2; n.addInputConnection(new Connection(n1, n, weigth)); assertTrue(0 == n1.getDelta()); nn.addLayer(l1); nn.addLayer(l2); nn.addLayer(l3); l2.addNeuron(n1); instance.calculateErrorAndUpdateHiddenNeurons(); assertTrue(instance.calculateHiddenNeuronError(n1) == n1.getDelta()); }