@Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(this.hashingStrategy); out.writeInt(this.set.size()); try { this.set.forEach(new CheckedProcedure<T>() { public void safeValue(T value) throws IOException { out.writeObject(value); } }); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } }
@Override public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(this.set.size()); try { this.set.forEach(new CheckedProcedure<T>() { public void safeValue(T value) throws IOException { out.writeObject(value); } }); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } }
@Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(this.hashingStrategy); out.writeInt(this.set.size()); try { this.set.forEach(new CheckedProcedure<T>() { public void safeValue(T value) throws IOException { out.writeObject(value); } }); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } }
@Override public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(this.set.size()); try { this.set.forEach(new CheckedProcedure<T>() { public void safeValue(T value) throws IOException { out.writeObject(value); } }); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } }
/** * Assert the size of the given {@link ImmutableSet}. */ public static void assertSize(String immutableSetName, int expectedSize, ImmutableSet<?> actualImmutableSet) { try { int actualSize = actualImmutableSet.size(); if (actualSize != expectedSize) { Assert.fail("Incorrect size for " + immutableSetName + "; expected:<" + expectedSize + "> but was:<" + actualSize + '>'); } } catch (AssertionError e) { Verify.throwMangledException(e); } }
@Override public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(this.set.size()); try { this.set.forEach(new CheckedProcedure<T>() { public void safeValue(T value) throws IOException { out.writeObject(value); } }); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } }
@Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(this.hashingStrategy); out.writeInt(this.set.size()); try { this.set.forEach(new CheckedProcedure<T>() { public void safeValue(T value) throws IOException { out.writeObject(value); } }); } catch (RuntimeException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw e; } }
/** * Assert the size of the given {@link ImmutableSet}. */ public static void assertSize(String immutableSetName, int expectedSize, ImmutableSet<?> actualImmutableSet) { try { int actualSize = actualImmutableSet.size(); if (actualSize != expectedSize) { Assert.fail("Incorrect size for " + immutableSetName + "; expected:<" + expectedSize + "> but was:<" + actualSize + '>'); } } catch (AssertionError e) { Verify.throwMangledException(e); } }
@Test public void testBaselineMismatchScenario() { DbDeployerAppContext appContext = DbEnvironmentFactory.getInstance().readOneFromSourcePath("baselineutil/BaselineValidatorMain/uc1", "test") .buildAppContext(); BaselineValidatorMain main = new BaselineValidatorMain(); ImmutableSet<CompareBreak> compareBreaks = main.calculateBaselineBreaks(appContext); System.out.println("BREAKS\n" + compareBreaks.makeString("\n")); assertEquals(2, compareBreaks.size()); ObjectCompareBreak objectBreak = (ObjectCompareBreak) compareBreaks.detect(Predicates .instanceOf(ObjectCompareBreak.class)); FieldCompareBreak dataTypeBreak = (FieldCompareBreak) compareBreaks.select( Predicates.instanceOf(FieldCompareBreak.class)).detect(new Predicate<CompareBreak>() { @Override public boolean accept(CompareBreak each) { return ((FieldCompareBreak) each).getFieldName().equalsIgnoreCase("columnDataType"); } }); assertNotNull(objectBreak); assertNotNull(dataTypeBreak); } }