/** * Creates a float custom object for testing. * * @param <T> type of float custom object * @param type of float custom object * @return instance of float custom object */ public static <T extends FloatCustomObject> T createCustomObject(final Class<T> type) { // CheckStyle:MagicNumber OFF final Set<Float> s1 = new HashSet<Float>(); s1.add(601.6f); s1.add(602.6f); final T o1; try { o1 = type.newInstance(); } catch (InstantiationException e) { throw new IllegalStateException(e); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } o1.setFloatDn("cn=Float Entry,ou=people,dc=ldaptive,dc=org"); o1.setType1(100.1f); o1.writeType2(200.2f); o1.setType3(300.3f); o1.setTypeArray1(new Float[] {301.1f, 302.2f}); o1.writeTypeArray2(new Float[] {301.1f, 302.2f}); o1.setTypeCol1(Arrays.asList(501.5f, 502.5f)); o1.writeTypeCol2(Arrays.asList(501.5f, 502.5f)); o1.setTypeSet1(s1); o1.writeTypeSet2(s1); o1.setTypeList1(Arrays.asList(701.7f, 702.7f)); o1.writeTypeList2(Arrays.asList(701.7f, 702.7f)); return o1; // CheckStyle:MagicNumber ON }
/** * Creates a boolean custom object for testing. * * @param <T> type of boolean custom object * @param type of boolean custom object * @return instance of boolean custom object */ public static <T extends BooleanCustomObject> T createCustomObject(final Class<T> type) { final Set<Boolean> s1 = new HashSet<Boolean>(); s1.add(true); s1.add(false); final T o1; try { o1 = type.newInstance(); } catch (InstantiationException e) { throw new IllegalStateException(e); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } o1.setType1(true); o1.writeType2(false); o1.setType3(true); o1.setTypeArray1(new boolean[] {false, true}); o1.writeTypeArray2(new boolean[] {false, true}); o1.setTypeCol1(Arrays.asList(true, false)); o1.writeTypeCol2(Arrays.asList(false, true)); o1.setTypeSet1(s1); o1.writeTypeSet2(s1); o1.setTypeList1(Arrays.asList(false, true)); o1.writeTypeList2(Arrays.asList(true, false)); return o1; }