### Question:
CompositeKeyGeneratorWithoutLast extends CompositeKeyGenerator { @Override public Object generate(Object target, Method method, Object... params) { if (params.length == 0) throw new IllegalArgumentException("At least one argument with value is required"); return super.generate(target, method, Arrays.copyOf(params, params.length - 1)); }  @Override Object generate(Object target, Method method, Object... params);  }### Answer:
@Test public void testGenerate() { CompositeKeyGeneratorWithoutLast kg = new CompositeKeyGeneratorWithoutLast(); assertEquals( new CompositeKey("a", "b"), kg.generate(null, null, new Object[] {"a", "b", "c"}) ); assertEquals( new CompositeKey(), kg.generate(null, null, new Object[] {"a"}) ); try { kg.generate(null, null); } catch (IllegalArgumentException e) { assertEquals("At least one argument with value is required", e.getMessage()); } }