@Test public void returnsConnectionBetweenTwoLayers() { Set<Layer> layers = new HashSet<Layer>(); Layer topLayer = new Layer(); Layer middleLayer = new Layer(); Connections firstConnection = new FullyConnected(topLayer, middleLayer, 0, 0); topLayer.addConnection(firstConnection); layers.add(topLayer); layers.add(middleLayer); network.setLayers(layers); assertEquals(firstConnection, network.getConnection(topLayer, middleLayer)); assertEquals(firstConnection, network.getConnection(middleLayer, topLayer)); }
@Test public void returnsNullWhenThereIsntAConnectingLayer() { Set<Layer> layers = new HashSet<Layer>(); Layer topLayer = new Layer(); Layer middleLayer = new Layer(); Layer bottomLayer = new Layer(); Connections firstConnection = new FullyConnected(topLayer, middleLayer, 0, 0); topLayer.addConnection(firstConnection); layers.add(topLayer); layers.add(middleLayer); network.setLayers(layers); assertNull(network.getConnection(topLayer, bottomLayer)); assertNull(network.getConnection(bottomLayer, topLayer)); }