ContextRx { public String toString() { return "Context: " + "Sequence: " + sequence + " " + (ketone() ? " KETONE " : "") + (hasSecondaryFlags ? " SECONDARY FLAGS " : "") + (hasMealType ? " MEALTYPE: " + mealType + " " : "") + (hasCarbInfo ? " CARB INFO " : ""); } ContextRx(byte[] packet); boolean ketone(); boolean normalRecord(); String toString(); final ByteBuffer data; final byte flags; public byte secondaryFlags; public byte carbFlags; public int carbInfo; public int mealType; final int sequence; final boolean hasSecondaryFlags; final boolean hasMealType; final boolean hasCarbInfo; }
@Test public void toStringTest() { ContextRx contextRx = new ContextRx(JoH.hexStringToByteArray("02040006")); assertEquals("Context: Sequence: 4 KETONE MEALTYPE: 6 ", contextRx.toString()); }