@Test public void shouldReturnGNSSstatusUnavailable() { JsonNode testBitString = JsonUtils.newNode().put("status", "10000000"); String elementTested = "unavailable"; J2735BitString actualBitString = BitStringBuilder.genericBitString(testBitString.get("status"), J2735GNSSstatusNames.values()); for (Map.Entry<String, Boolean> curVal : actualBitString.entrySet()) { if (curVal.getKey() == elementTested) { assertTrue("Expected " + curVal.getKey() + " to be true", curVal.getValue()); } else { assertFalse("Expected " + curVal.getKey() + " to be false", curVal.getValue()); } } }
public static J2735BitString genericBitString(JsonNode jsonNode, Enum<?>[] enumValues) { J2735BitString bitString = new J2735BitString(); char[] chars = jsonNode.asText().trim().toCharArray(); for (char i = 0; i < chars.length; i++) { String bitName = enumValues[i].name(); Boolean bitStatus = (chars[i] == '1'); bitString.put(bitName, bitStatus); } return bitString; }
BitStringBuilder { public static J2735BitString genericBitString(JsonNode jsonNode, Enum<?>[] enumValues) { J2735BitString bitString = new J2735BitString(); char[] chars = jsonNode.asText().trim().toCharArray(); for (char i = 0; i < chars.length; i++) { String bitName = enumValues[i].name(); Boolean bitStatus = (chars[i] == '1'); bitString.put(bitName, bitStatus); } return bitString; } }
BitStringBuilder { public static J2735BitString genericBitString(JsonNode jsonNode, Enum<?>[] enumValues) { J2735BitString bitString = new J2735BitString(); char[] chars = jsonNode.asText().trim().toCharArray(); for (char i = 0; i < chars.length; i++) { String bitName = enumValues[i].name(); Boolean bitStatus = (chars[i] == '1'); bitString.put(bitName, bitStatus); } return bitString; } private  BitStringBuilder(); }
BitStringBuilder { public static J2735BitString genericBitString(JsonNode jsonNode, Enum<?>[] enumValues) { J2735BitString bitString = new J2735BitString(); char[] chars = jsonNode.asText().trim().toCharArray(); for (char i = 0; i < chars.length; i++) { String bitName = enumValues[i].name(); Boolean bitStatus = (chars[i] == '1'); bitString.put(bitName, bitStatus); } return bitString; } private  BitStringBuilder(); static J2735BitString genericBitString(JsonNode jsonNode, Enum<?>[] enumValues); }
BitStringBuilder { public static J2735BitString genericBitString(JsonNode jsonNode, Enum<?>[] enumValues) { J2735BitString bitString = new J2735BitString(); char[] chars = jsonNode.asText().trim().toCharArray(); for (char i = 0; i < chars.length; i++) { String bitName = enumValues[i].name(); Boolean bitStatus = (chars[i] == '1'); bitString.put(bitName, bitStatus); } return bitString; } private  BitStringBuilder(); static J2735BitString genericBitString(JsonNode jsonNode, Enum<?>[] enumValues);  }