### Question:
SignalManager { public static String getNormalizedConstraints(Constraints constraints) { if (constraints.isUnbounded()) { return UNBOUNDED_CONSTRAINT; } Map<String, String> orderedConstraints = constraints.toNormalizedQueryMap(); List<String> parts = new ArrayList<String>(); for (Map.Entry<String, String> entry : orderedConstraints.entrySet()) { StringBuilder builder = new StringBuilder(); String key = entry.getKey(); String value = entry.getValue(); builder.append(key); builder.append("="); if (value != null) { builder.append(value); } parts.add(builder.toString()); } return Joiner.on('&').join(parts); } SignalManager(FileSystem fileSystem, Path signalDirectory); void signalReady(Constraints viewConstraints); long getReadyTimestamp(Constraints viewConstraints); static String getNormalizedConstraints(Constraints constraints);  }### Answer:
@Test public void testNormalizeConstraints() throws IOException { Constraints constraints = new Constraints(DatasetTestUtilities.USER_SCHEMA). with("email", "user@domain.com"); String normalizedConstraints = SignalManager.getNormalizedConstraints(constraints); Assert.assertEquals("email=user%40domain.com", normalizedConstraints); }
@Test public void testNormalizeConstraintsUnbounded() throws IOException { Constraints constraints = new Constraints(DatasetTestUtilities.USER_SCHEMA); String normalizedConstraints = SignalManager.getNormalizedConstraints(constraints); Assert.assertEquals("unbounded", normalizedConstraints); }
@Test public void testNormalizeConstraintsValueExists() throws IOException { Constraints constraints = new Constraints(DatasetTestUtilities.USER_SCHEMA). with("email", ""); String normalizedConstraints = SignalManager.getNormalizedConstraints(constraints); Assert.assertEquals("email=in()", normalizedConstraints); }
@Test public void testNormalizeConstraintsOrderedSets() throws IOException { Constraints constraints = new Constraints(DatasetTestUtilities.OLD_VALUE_SCHEMA). with("value", 7L,2L,3L); String normalizedConstraints = SignalManager.getNormalizedConstraints(constraints); Assert.assertEquals("value=2,3,7", normalizedConstraints); }
@Test public void testNormalizeConstraintsIntervals() throws IOException { Constraints constraints = new Constraints(DatasetTestUtilities.OLD_VALUE_SCHEMA). toBefore("value", 12L); String normalizedConstraints = SignalManager.getNormalizedConstraints(constraints); Assert.assertEquals("value=(,12)", normalizedConstraints); }
@Test public void testNormalizeConstraintsOrderedKeys() throws IOException { Constraints constraints = new Constraints(DatasetTestUtilities.USER_SCHEMA). with("username", "kite").with("email", "kite@domain.com"); String normalizedConstraints = SignalManager.getNormalizedConstraints(constraints); Assert.assertEquals("email=kite%40domain.com&username=kite", normalizedConstraints); }