SfcGeniusUtils { public static BigInteger getDpnIdFromLowerLayerIfList(List<String> lowerLayerIfList) { if (lowerLayerIfList == null || lowerLayerIfList.size() != 1) { throw new SfcGeniusRuntimeException( new IllegalArgumentException("Expected 1 and only 1 item in lower layer interface list")); } long nodeId = MDSALUtil.getDpnIdFromPortName(new NodeConnectorId(lowerLayerIfList.get(0))); if (nodeId < 0L) { throw new SfcGeniusRuntimeException( new IllegalArgumentException("Unexpected format of lower layer interface list")); } return BigInteger.valueOf(nodeId); } private  SfcGeniusUtils(); static CompletableFuture<T> toCompletableFuture(final ListenableFuture<T> listenableFuture,
            Executor executor); static BigInteger getDpnIdFromLowerLayerIfList(List<String> lowerLayerIfList);  }
@Test public void getDpnIdFromLowerLayerIfListTooManyItems() throws Exception { try { SfcGeniusUtils.getDpnIdFromLowerLayerIfList(Arrays.asList("Item1", "Item2")); } catch (Exception e) { assertThat(e, is(instanceOf(SfcGeniusRuntimeException.class))); assertThat(e.getCause(), is(instanceOf(IllegalArgumentException.class))); } }
@Test public void getDpnIdFromLowerLayerIfListBadItem() throws Exception { try { SfcGeniusUtils.getDpnIdFromLowerLayerIfList(Collections.singletonList("")); } catch (Exception e) { assertThat(e, is(instanceOf(SfcGeniusRuntimeException.class))); assertThat(e.getCause(), is(instanceOf(IllegalArgumentException.class))); } }
@Test public void getDpnIdFromNullLowerLayerIfList() throws Exception { try { SfcGeniusUtils.getDpnIdFromLowerLayerIfList(null); } catch (Exception e) { assertThat(e, is(instanceOf(SfcGeniusRuntimeException.class))); assertThat(e.getCause(), is(instanceOf(IllegalArgumentException.class))); } }