only:reducing duplication

This commit is contained in:
Andrey 2023-07-20 14:03:01 -04:00
parent 5c8939637d
commit cce7991e37
1 changed files with 12 additions and 10 deletions

View File

@ -46,19 +46,21 @@ public class VariableRegistryTest {
@Test @Test
public void testPrepend() { public void testPrepend() {
VariableRegistry registry = new VariableRegistry(); VariableRegistry registry = new VariableRegistry();
registry.register("key_string", "value_1"); String stringKey = "key_string";
assertEquals("value_1", registry.get("key_string")); registry.register(stringKey, "value_1");
assertEquals("value_1", registry.get(stringKey));
registry.register("key_string", "value_2"); registry.register(stringKey, "value_2");
assertEquals("value_1", registry.get("key_string")); assertEquals("value_1", registry.get(stringKey));
registry.register("key_int", 1); String intKey = "key_int";
assertEquals("1", registry.get("key_int")); registry.register(intKey, 1);
assertEquals("1", registry.get("key_int" + _HEX_SUFFIX)); assertEquals("1", registry.get(intKey));
assertEquals("1", registry.get(intKey + _HEX_SUFFIX));
registry.register("key_int", 2); registry.register(intKey, 2);
assertEquals("1", registry.get("key_int")); assertEquals("1", registry.get(intKey));
assertEquals("1", registry.get("key_int" + _HEX_SUFFIX)); assertEquals("1", registry.get(intKey + _HEX_SUFFIX));
} }
@Test @Test