GeneratorUtil { static boolean isConstantInTO(final String constName, final GeneratedTransferObject genTO) { if (constName == null || genTO == null) { throw new IllegalArgumentException(); } List<Constant> consts = genTO.getConstantDefinitions(); for (Constant cons : consts) { if (cons.getName().equals(constName)) { return true; } } return false; } private  GeneratorUtil();   }
@Test(expected = IllegalArgumentException.class) public void isConstantToExceptionTest() throws Exception { GeneratorUtil.isConstantInTO(null, null); }
@Test public void isConstantToTest() throws Exception { final Constant constant = mock(Constant.class); doReturn("tst2").when(constant).getName(); doReturn(ImmutableList.of(constant)).when(enclosedType).getConstantDefinitions(); assertFalse(GeneratorUtil.isConstantInTO("tst", enclosedType)); }