### Question:
WebHookBuildStateConverter { public static BuildState convert(Integer oldState){ BuildState newStates = new BuildState(); newStates.setEnabled(BuildStateEnum.CHANGES_LOADED, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_STARTED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_ADDED_TO_QUEUE, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_STARTED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_REMOVED_FROM_QUEUE, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_STARTED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_STARTED, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_STARTED, oldState)); newStates.setEnabled(BuildStateEnum.BEFORE_BUILD_FINISHED, OldStyleBuildState.enabled(OldStyleBuildState.BEFORE_BUILD_FINISHED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_INTERRUPTED, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_INTERRUPTED, oldState)); newStates.setEnabled(BuildStateEnum.RESPONSIBILITY_CHANGED, OldStyleBuildState.enabled(OldStyleBuildState.RESPONSIBILITY_CHANGED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_FINISHED, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_FINISHED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_SUCCESSFUL, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_FINISHED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_FAILED, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_FINISHED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_PINNED, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_FINISHED, oldState)); newStates.setEnabled(BuildStateEnum.BUILD_UNPINNED, OldStyleBuildState.enabled(OldStyleBuildState.BUILD_FINISHED, oldState)); return newStates; } private  WebHookBuildStateConverter(); static BuildState convert(Integer oldState);  }### Answer:
@Test public void testConvert_01() { BuildState state = WebHookBuildStateConverter.convert(OldStyleBuildState.ALL_ENABLED); assertEquals(true, state.allEnabled()); }
@Test public void testConvert_02() { BuildState state = WebHookBuildStateConverter.convert(Integer.parseInt("11111011",2)); assertTrue(state.allEnabled()); }
@Test public void testConvert_03() { assertTrue(WebHookBuildStateConverter.convert(OldStyleBuildState.BUILD_STARTED).enabled(BuildStateEnum.BUILD_STARTED)); assertTrue(WebHookBuildStateConverter.convert(OldStyleBuildState.BUILD_FINISHED).enabled(BuildStateEnum.BUILD_FINISHED)); assertTrue(WebHookBuildStateConverter.convert(OldStyleBuildState.BUILD_FINISHED).enabled(BuildStateEnum.BUILD_SUCCESSFUL)); assertTrue(WebHookBuildStateConverter.convert(OldStyleBuildState.BUILD_FINISHED).enabled(BuildStateEnum.BUILD_FAILED)); assertTrue(WebHookBuildStateConverter.convert(OldStyleBuildState.BEFORE_BUILD_FINISHED).enabled(BuildStateEnum.BEFORE_BUILD_FINISHED)); assertTrue(WebHookBuildStateConverter.convert(OldStyleBuildState.RESPONSIBILITY_CHANGED).enabled(BuildStateEnum.RESPONSIBILITY_CHANGED)); assertTrue(WebHookBuildStateConverter.convert(OldStyleBuildState.BUILD_INTERRUPTED).enabled(BuildStateEnum.BUILD_INTERRUPTED)); }