target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void hashHelloWorld() { byte[] input = "Hello World".getBytes(); String output = hashing.hash(input); String expected = "99514329186b2f6ae4a1329e7ee6c610a729636335174ac6b740f9028396fcc803d0e93863a7c3d90f86beee782f4f3f"; assertThat(output).isEqualTo(expected); } | @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } | SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } } | SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } } | SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } @Ov... | SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } @Ov... |
@Test public void hashPublicKey() throws IOException { try (InputStream inputStream = getClass().getResourceAsStream("/key/public-key.pub")) { byte[] input = IOUtils.toByteArray(inputStream); String output = hashing.hash(input); String expected = "0eea0c8acf694a8bf86e5c11873bd9aa1b4ab630d27b0ee434c885e4e0d198936ee10770... | @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } | SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } } | SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } } | SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } @Ov... | SHA384Hashing extends AbstractHashing { @Override public String hash(byte[] data) { try { if (isEmpty(data)) { return null; } MessageDigest digest = MessageDigest.getInstance("SHA-384"); return new String(Hex.encode(digest.digest(data))); } catch (NoSuchAlgorithmException ex) { LOG.warn(null, ex); return null; } } @Ov... |
@Test public void sholdBe32Characters() { String input = "Hello World"; String output = shortHashing.hash(input.getBytes()); System.out.println("output => " + output); assertTrue(shortHashing.matches(input.getBytes(), output)); } | @Override public String hash(byte[] data) { return subString(hashing.hash(data)); } | ShortHashing extends AbstractHashing { @Override public String hash(byte[] data) { return subString(hashing.hash(data)); } } | ShortHashing extends AbstractHashing { @Override public String hash(byte[] data) { return subString(hashing.hash(data)); } ShortHashing(Hashing hashing, int length); } | ShortHashing extends AbstractHashing { @Override public String hash(byte[] data) { return subString(hashing.hash(data)); } ShortHashing(Hashing hashing, int length); @Override String hash(byte[] data); } | ShortHashing extends AbstractHashing { @Override public String hash(byte[] data) { return subString(hashing.hash(data)); } ShortHashing(Hashing hashing, int length); @Override String hash(byte[] data); } |
@Test public void maxInactiveIntervalShouldBe1800_whenNewInstance() { CustomSession session = new CustomSession(); int maxInactiveInterval = session.getMaxInactiveIntervalInSeconds(); int expected = 1800; assertThat(maxInactiveInterval).isEqualTo(expected); } | @Override public int getMaxInactiveIntervalInSeconds() { return this.maxInactiveInterval; } | CustomSession implements ExpiringSession, Serializable { @Override public int getMaxInactiveIntervalInSeconds() { return this.maxInactiveInterval; } } | CustomSession implements ExpiringSession, Serializable { @Override public int getMaxInactiveIntervalInSeconds() { return this.maxInactiveInterval; } CustomSession(); CustomSession(int maxInactiveInterval); } | CustomSession implements ExpiringSession, Serializable { @Override public int getMaxInactiveIntervalInSeconds() { return this.maxInactiveInterval; } CustomSession(); CustomSession(int maxInactiveInterval); void setMaxInactiveInterval(int interval); @Override void setMaxInactiveIntervalInSeconds(int interval); @Overrid... | CustomSession implements ExpiringSession, Serializable { @Override public int getMaxInactiveIntervalInSeconds() { return this.maxInactiveInterval; } CustomSession(); CustomSession(int maxInactiveInterval); void setMaxInactiveInterval(int interval); @Override void setMaxInactiveIntervalInSeconds(int interval); @Overrid... |
@Test public void attributesShouldBeEmpty_whenNewInstance() { CustomSession session = new CustomSession(); Map<String, Object> attributes = session.getAttributes(); Map<String, Object> empty = new HashMap<>(); assertThat(attributes).isEqualTo(empty); } | public Map<String, Object> getAttributes() { return new HashMap<>(this.attributes); } | CustomSession implements ExpiringSession, Serializable { public Map<String, Object> getAttributes() { return new HashMap<>(this.attributes); } } | CustomSession implements ExpiringSession, Serializable { public Map<String, Object> getAttributes() { return new HashMap<>(this.attributes); } CustomSession(); CustomSession(int maxInactiveInterval); } | CustomSession implements ExpiringSession, Serializable { public Map<String, Object> getAttributes() { return new HashMap<>(this.attributes); } CustomSession(); CustomSession(int maxInactiveInterval); void setMaxInactiveInterval(int interval); @Override void setMaxInactiveIntervalInSeconds(int interval); @Override int ... | CustomSession implements ExpiringSession, Serializable { public Map<String, Object> getAttributes() { return new HashMap<>(this.attributes); } CustomSession(); CustomSession(int maxInactiveInterval); void setMaxInactiveInterval(int interval); @Override void setMaxInactiveIntervalInSeconds(int interval); @Override int ... |
@Test public void shouldBeNotExpire_whenNewInstance() { CustomSession session = new CustomSession(); boolean output = session.isExpired(); boolean expected = false; assertThat(output).isEqualTo(expected); } | @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } | CustomSession implements ExpiringSession, Serializable { @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } } | CustomSession implements ExpiringSession, Serializable { @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } CustomSession(); CustomSession(int maxInactiveInterval); } | CustomSession implements ExpiringSession, Serializable { @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } CustomSession(); CustomSession(int maxInactiveInterval); void setMaxInactiveInterval(int interval); @Override void setMaxInactiveIntervalInSeconds(int interval); @Override int g... | CustomSession implements ExpiringSession, Serializable { @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } CustomSession(); CustomSession(int maxInactiveInterval); void setMaxInactiveInterval(int interval); @Override void setMaxInactiveIntervalInSeconds(int interval); @Override int g... |
@Test public void shouldBeNotExpire_whenMaxInactiveIntervalIsNegativeValue() { CustomSession session = new CustomSession(-1); boolean output = session.isExpired(); boolean expected = false; assertThat(output).isEqualTo(expected); } | @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } | CustomSession implements ExpiringSession, Serializable { @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } } | CustomSession implements ExpiringSession, Serializable { @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } CustomSession(); CustomSession(int maxInactiveInterval); } | CustomSession implements ExpiringSession, Serializable { @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } CustomSession(); CustomSession(int maxInactiveInterval); void setMaxInactiveInterval(int interval); @Override void setMaxInactiveIntervalInSeconds(int interval); @Override int g... | CustomSession implements ExpiringSession, Serializable { @Override public boolean isExpired() { return isExpired(convert2Timestamp(now())); } CustomSession(); CustomSession(int maxInactiveInterval); void setMaxInactiveInterval(int interval); @Override void setMaxInactiveIntervalInSeconds(int interval); @Override int g... |
@Test public void shouldBeOk_whenInputLocalDateTimeIs20170101T010101_ofConvert2Date() { LocalDateTime input = createLocalDateTime("2017-01-01T01:01:01"); Date output = DateConverterUtils.convert2Date(input); Date expected = createDate("2017-01-01T01:01:01"); assertThat(output).isEqualTo(expected); } | public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); } | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime c... | DateConverterUtils { public static Date convert2Date(LocalDate localDate) { if (localDate == null) { return null; } return convert2Date(localDate.atStartOfDay()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime c... |
@Test public void shouldBeNull_whenInputDateIsNull_ofConvert2LocalDate() { Date input = null; LocalDate output = DateConverterUtils.convert2LocalDate(input); LocalDate expected = null; assertThat(output).isEqualTo(expected); } | public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } | DateConverterUtils { public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } } | DateConverterUtils { public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } private DateConverterUtils(); } | DateConverterUtils { public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime con... | DateConverterUtils { public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime con... |
@Test public void shouldBeOk_whenInputDateIs20170101T010101_ofConvert2LocalDate() { Date input = createDate("2017-01-01T01:01:01"); LocalDate output = DateConverterUtils.convert2LocalDate(input); LocalDate expected = createLocalDate("2017-01-01T00:00:00"); assertThat(output).isEqualTo(expected); } | public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } | DateConverterUtils { public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } } | DateConverterUtils { public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } private DateConverterUtils(); } | DateConverterUtils { public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime con... | DateConverterUtils { public static LocalDate convert2LocalDate(Date date) { if (date == null) { return null; } return convert2LocalDateTime(date).toLocalDate(); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDateTime); static LocalDateTime con... |
@Test public void shouldBeNull_whenInputDateIsNull_ofConvert2LocalDateTime() { Date input = null; LocalDateTime output = DateConverterUtils.convert2LocalDateTime(input); LocalDateTime expected = null; assertThat(output).isEqualTo(expected); } | public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } | DateConverterUtils { public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } } | DateConverterUtils { public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } private DateConverterUtils(); } | DateConverterUtils { public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDat... | DateConverterUtils { public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDat... |
@Test public void shouldBeOk_whenInputDateIs20170101T010101_ofConvert2LocalDateTime() { Date input = createDate("2017-01-01T01:01:01"); LocalDateTime output = DateConverterUtils.convert2LocalDateTime(input); LocalDateTime expected = createLocalDateTime("2017-01-01T01:01:01"); assertThat(output).isEqualTo(expected); } | public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } | DateConverterUtils { public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } } | DateConverterUtils { public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } private DateConverterUtils(); } | DateConverterUtils { public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDat... | DateConverterUtils { public static LocalDateTime convert2LocalDateTime(Date date) { if (date == null) { return null; } return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } private DateConverterUtils(); static Date convert2Date(LocalDate localDate); static Date convert2Date(LocalDateTime localDat... |
@Test public void shouldBeNull_whenEncodeNullString() { String input = null; String output = Base64Utils.encode(input); String expected = null; assertThat(output).isEqualTo(expected); } | public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data); } |
@Test public void shouldBeNull_whenEncodeNullByte() { byte[] input = null; String output = Base64Utils.encode(input); String expected = null; assertThat(output).isEqualTo(expected); } | public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data); } | Base64Utils { public static String encode(byte[] data) { if (data == null) { return null; } return Base64.getEncoder().encodeToString(data); } private Base64Utils(); static String encode(byte[] data); static String encode(String data); static String decode(byte[] data); static String decode(String data); } |
@Test(expected = Exception.class) public void classicalDelete() throws Exception { CurrentUserHolder.set("frank"); productService.classicalDelete(1L); } | public void classicalDelete(Long id) { authService.checkAccess(); System.out.println("Delete Product."); } | ProductService { public void classicalDelete(Long id) { authService.checkAccess(); System.out.println("Delete Product."); } } | ProductService { public void classicalDelete(Long id) { authService.checkAccess(); System.out.println("Delete Product."); } } | ProductService { public void classicalDelete(Long id) { authService.checkAccess(); System.out.println("Delete Product."); } void insert(Product product); void classicalDelete(Long id); void baseAopDelete(Long id); @AdminOnly void annoAopDelete(Long id); } | ProductService { public void classicalDelete(Long id) { authService.checkAccess(); System.out.println("Delete Product."); } void insert(Product product); void classicalDelete(Long id); void baseAopDelete(Long id); @AdminOnly void annoAopDelete(Long id); } |
@Test public void baseAopDelete() throws Exception { CurrentUserHolder.set("frank"); productService.baseAopDelete(1L); } | public void baseAopDelete(Long id) { System.out.println("Delete Product."); } | ProductService { public void baseAopDelete(Long id) { System.out.println("Delete Product."); } } | ProductService { public void baseAopDelete(Long id) { System.out.println("Delete Product."); } } | ProductService { public void baseAopDelete(Long id) { System.out.println("Delete Product."); } void insert(Product product); void classicalDelete(Long id); void baseAopDelete(Long id); @AdminOnly void annoAopDelete(Long id); } | ProductService { public void baseAopDelete(Long id) { System.out.println("Delete Product."); } void insert(Product product); void classicalDelete(Long id); void baseAopDelete(Long id); @AdminOnly void annoAopDelete(Long id); } |
@Test(expected = Exception.class) public void annoAopDelete() throws Exception { CurrentUserHolder.set("frank"); productService.baseAopDelete(1L); } | @AdminOnly public void annoAopDelete(Long id) { System.out.println("Delete Product."); } | ProductService { @AdminOnly public void annoAopDelete(Long id) { System.out.println("Delete Product."); } } | ProductService { @AdminOnly public void annoAopDelete(Long id) { System.out.println("Delete Product."); } } | ProductService { @AdminOnly public void annoAopDelete(Long id) { System.out.println("Delete Product."); } void insert(Product product); void classicalDelete(Long id); void baseAopDelete(Long id); @AdminOnly void annoAopDelete(Long id); } | ProductService { @AdminOnly public void annoAopDelete(Long id) { System.out.println("Delete Product."); } void insert(Product product); void classicalDelete(Long id); void baseAopDelete(Long id); @AdminOnly void annoAopDelete(Long id); } |
@Test public void demonstrateTest() { CaseStudy.demonstrate(); String expected = String.format("The lecturer%s", System.lineSeparator()); String obtained = out.toString(); assertEquals(obtained, expected); } | public static void demonstrate() { String code = "The code"; Course course = Courses.findByCode(code); Lecturer lecturer = course.getLecturer(); String name = lecturer.getName(); System.out.println(name); } | CaseStudy { public static void demonstrate() { String code = "The code"; Course course = Courses.findByCode(code); Lecturer lecturer = course.getLecturer(); String name = lecturer.getName(); System.out.println(name); } } | CaseStudy { public static void demonstrate() { String code = "The code"; Course course = Courses.findByCode(code); Lecturer lecturer = course.getLecturer(); String name = lecturer.getName(); System.out.println(name); } } | CaseStudy { public static void demonstrate() { String code = "The code"; Course course = Courses.findByCode(code); Lecturer lecturer = course.getLecturer(); String name = lecturer.getName(); System.out.println(name); } static void demonstrate(); } | CaseStudy { public static void demonstrate() { String code = "The code"; Course course = Courses.findByCode(code); Lecturer lecturer = course.getLecturer(); String name = lecturer.getName(); System.out.println(name); } static void demonstrate(); } |
@Test public void meanWithNegatives() { List<Double> numbers = Arrays.asList(-1d,1d); double mean = App.mean(numbers); assertEquals(0, mean, 0); } | public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } | App { public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } } | App { public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } } | App { public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } static void main(String[] args); static List<Double> compute(); static List<Double> loadFromFile(String filepath); static double mean(List<Double> numbers); static double std(Li... | App { public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } static void main(String[] args); static List<Double> compute(); static List<Double> loadFromFile(String filepath); static double mean(List<Double> numbers); static double std(Li... |
@Test public void zeroStd() { List<Double> zeroes = Arrays.asList(0d,0d,0d,0d); double std = App.std(zeroes, 0); assertEquals(0, std, 0); } | public static double std(List<Double> numbers, double mean) { double sumSquare = 0; for (double f : numbers) { double diff = f - mean; sumSquare += diff * diff; } return Math.sqrt(sumSquare / numbers.size()); } | App { public static double std(List<Double> numbers, double mean) { double sumSquare = 0; for (double f : numbers) { double diff = f - mean; sumSquare += diff * diff; } return Math.sqrt(sumSquare / numbers.size()); } } | App { public static double std(List<Double> numbers, double mean) { double sumSquare = 0; for (double f : numbers) { double diff = f - mean; sumSquare += diff * diff; } return Math.sqrt(sumSquare / numbers.size()); } } | App { public static double std(List<Double> numbers, double mean) { double sumSquare = 0; for (double f : numbers) { double diff = f - mean; sumSquare += diff * diff; } return Math.sqrt(sumSquare / numbers.size()); } static void main(String[] args); static List<Double> compute(); static List<Double> loadFromFile(Strin... | App { public static double std(List<Double> numbers, double mean) { double sumSquare = 0; for (double f : numbers) { double diff = f - mean; sumSquare += diff * diff; } return Math.sqrt(sumSquare / numbers.size()); } static void main(String[] args); static List<Double> compute(); static List<Double> loadFromFile(Strin... |
@Test public void computeYieldsCorrectResult() throws FileNotFoundException { List<Double> normalized = App.compute(); List<Double> expected = Arrays.asList( -1.5666989036012806, -1.2185435916898848, -0.8703882797784892, -0.5222329678670935, -0.17407765595569785, 0.17407765595569785, 0.5222329678670935, 0.8703882797784... | public static List<Double> compute() throws FileNotFoundException { File file = new File("data"); List<Double> normalized = new ArrayList<>(); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } dou... | App { public static List<Double> compute() throws FileNotFoundException { File file = new File("data"); List<Double> normalized = new ArrayList<>(); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number);... | App { public static List<Double> compute() throws FileNotFoundException { File file = new File("data"); List<Double> normalized = new ArrayList<>(); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number);... | App { public static List<Double> compute() throws FileNotFoundException { File file = new File("data"); List<Double> normalized = new ArrayList<>(); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number);... | App { public static List<Double> compute() throws FileNotFoundException { File file = new File("data"); List<Double> normalized = new ArrayList<>(); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number);... |
@Test(expected = PreconditionError.class) public void fibOnNegativeFails() { RecursiveFibonacci fib = new RecursiveFibonacci(); fib.apply(-1); } | @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } | RecursiveFibonacci { @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } } | RecursiveFibonacci { @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } } | RecursiveFibonacci { @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } @Requires("0 <= n") @Ensures("0 <= result") int apply(int n); } | RecursiveFibonacci { @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } @Requires("0 <= n") @Ensures("0 <= result") int apply(int n); } |
@Test public void fibOf4() { RecursiveFibonacci fib = new RecursiveFibonacci(); assertEquals(3, fib.apply(4)); } | @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } | RecursiveFibonacci { @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } } | RecursiveFibonacci { @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } } | RecursiveFibonacci { @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } @Requires("0 <= n") @Ensures("0 <= result") int apply(int n); } | RecursiveFibonacci { @Requires("0 <= n") @Ensures("0 <= result") public int apply(int n) { if (0 == n || 1 == n) { return n; } else { return apply(n - 1) + apply(n - 2); } } @Requires("0 <= n") @Ensures("0 <= result") int apply(int n); } |
@Test void appHasAGreeting() { App classUnderTest = new App(); assertNotNull(classUnderTest.getGreeting(), "app should have a greeting"); } | public String getGreeting() { return "Hello world."; } | App { public String getGreeting() { return "Hello world."; } } | App { public String getGreeting() { return "Hello world."; } } | App { public String getGreeting() { return "Hello world."; } String getGreeting(); static void main(String[] args); } | App { public String getGreeting() { return "Hello world."; } String getGreeting(); static void main(String[] args); } |
@Test public void testTermLoanNoPayments() { Loan termLoan = Loan.createTermLoan(2.0, 1, Date.from(Instant.now())); assertNotNull(termLoan); System.out.println("Test term loan"); } | public static Loan createTermLoan(double commitment, int riskTaking, Date maturity){ return new Loan(null, commitment, 0.00, riskTaking, maturity, null); } | Loan { public static Loan createTermLoan(double commitment, int riskTaking, Date maturity){ return new Loan(null, commitment, 0.00, riskTaking, maturity, null); } } | Loan { public static Loan createTermLoan(double commitment, int riskTaking, Date maturity){ return new Loan(null, commitment, 0.00, riskTaking, maturity, null); } private Loan(CapitalStrategy capitalStrategy, double commitment, double outstanding, int riskTaking, Date maturity, Date expiry); } | Loan { public static Loan createTermLoan(double commitment, int riskTaking, Date maturity){ return new Loan(null, commitment, 0.00, riskTaking, maturity, null); } private Loan(CapitalStrategy capitalStrategy, double commitment, double outstanding, int riskTaking, Date maturity, Date expiry); static Loan createTermLoan... | Loan { public static Loan createTermLoan(double commitment, int riskTaking, Date maturity){ return new Loan(null, commitment, 0.00, riskTaking, maturity, null); } private Loan(CapitalStrategy capitalStrategy, double commitment, double outstanding, int riskTaking, Date maturity, Date expiry); static Loan createTermLoan... |
@Test public void testRevolverLoan() { Loan revolverLoan = Loan.createRevolverLoan(2.0, 1.0, 1, Date.from(Instant.now()), Date.from(Instant.now())); assertNotNull(revolverLoan); System.out.println("Test revolver loan"); } | public static Loan createRevolverLoan(double commitment, double outstanding, int customerRating, Date maturity, Date expiry){ return new Loan(null, commitment, outstanding, customerRating, maturity, expiry); } | Loan { public static Loan createRevolverLoan(double commitment, double outstanding, int customerRating, Date maturity, Date expiry){ return new Loan(null, commitment, outstanding, customerRating, maturity, expiry); } } | Loan { public static Loan createRevolverLoan(double commitment, double outstanding, int customerRating, Date maturity, Date expiry){ return new Loan(null, commitment, outstanding, customerRating, maturity, expiry); } private Loan(CapitalStrategy capitalStrategy, double commitment, double outstanding, int riskTaking, D... | Loan { public static Loan createRevolverLoan(double commitment, double outstanding, int customerRating, Date maturity, Date expiry){ return new Loan(null, commitment, outstanding, customerRating, maturity, expiry); } private Loan(CapitalStrategy capitalStrategy, double commitment, double outstanding, int riskTaking, D... | Loan { public static Loan createRevolverLoan(double commitment, double outstanding, int customerRating, Date maturity, Date expiry){ return new Loan(null, commitment, outstanding, customerRating, maturity, expiry); } private Loan(CapitalStrategy capitalStrategy, double commitment, double outstanding, int riskTaking, D... |
@Test public void computeYieldsCorrectResult() throws FileNotFoundException { List<Double> normalized = App.compute(); List<Double> expected = Arrays.asList( -1.5666989036012806, -1.2185435916898848, -0.8703882797784892, -0.5222329678670935, -0.17407765595569785, 0.17407765595569785, 0.5222329678670935, 0.8703882797784... | public static List<Double> compute() throws FileNotFoundException { List<Double> numbers = loadFromFile("data"); double mean = mean(numbers); double std = std(numbers, mean); List<Double> normalized = normalize(numbers, mean, std); System.out.println(normalized); writeToFile(normalized); return normalized; } | App { public static List<Double> compute() throws FileNotFoundException { List<Double> numbers = loadFromFile("data"); double mean = mean(numbers); double std = std(numbers, mean); List<Double> normalized = normalize(numbers, mean, std); System.out.println(normalized); writeToFile(normalized); return normalized; } } | App { public static List<Double> compute() throws FileNotFoundException { List<Double> numbers = loadFromFile("data"); double mean = mean(numbers); double std = std(numbers, mean); List<Double> normalized = normalize(numbers, mean, std); System.out.println(normalized); writeToFile(normalized); return normalized; } } | App { public static List<Double> compute() throws FileNotFoundException { List<Double> numbers = loadFromFile("data"); double mean = mean(numbers); double std = std(numbers, mean); List<Double> normalized = normalize(numbers, mean, std); System.out.println(normalized); writeToFile(normalized); return normalized; } sta... | App { public static List<Double> compute() throws FileNotFoundException { List<Double> numbers = loadFromFile("data"); double mean = mean(numbers); double std = std(numbers, mean); List<Double> normalized = normalize(numbers, mean, std); System.out.println(normalized); writeToFile(normalized); return normalized; } sta... |
@Test public void loadCorrectFile() throws FileNotFoundException { List<Double> expected = Arrays.asList(1d,2d,3d,4d,5d,6d,7d,8d,9d,10d); List<Double> loaded = App.loadFromFile("data"); assertEquals(expected, loaded); } | public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); return nu... | App { public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); ret... | App { public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); ret... | App { public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); ret... | App { public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); ret... |
@Test public void loadWrongFileThrows() throws FileNotFoundException { assertThrows(FileNotFoundException.class, () -> { App.loadFromFile("loremipsum"); }); } | public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); return nu... | App { public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); ret... | App { public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); ret... | App { public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); ret... | App { public static List<Double> loadFromFile(String filepath) throws FileNotFoundException { File file = new File(filepath); Scanner scanner = new Scanner(file); List<Double> numbers = new ArrayList<>(); while (scanner.hasNextDouble()) { double number = scanner.nextDouble(); numbers.add(number); } scanner.close(); ret... |
@Test public void zeroMean() { List<Double> zeroes = Arrays.asList(0d,0d,0d,0d); double mean = App.mean(zeroes); assertEquals(0, mean, 0); } | public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } | App { public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } } | App { public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } } | App { public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } static void main(String[] args); static List<Double> compute(); static List<Double> loadFromFile(String filepath); static double mean(List<Double> numbers); static double std(Li... | App { public static double mean(List<Double> numbers) { double sum = 0; for (double f : numbers) { sum += f; } return sum / numbers.size(); } static void main(String[] args); static List<Double> compute(); static List<Double> loadFromFile(String filepath); static double mean(List<Double> numbers); static double std(Li... |
@Test public void getHighestQualityAudioTest() throws Exception { assertEquals(320, Utils.getHighestQualityAudio(audioStreamsTestList).avgBitrate); } | public static AudioStream getHighestQualityAudio(List<AudioStream> audioStreams) { int highestQualityIndex = 0; for (int i = 1; i < audioStreams.size(); i++) { AudioStream audioStream = audioStreams.get(i); if (audioStream.avgBitrate > audioStreams.get(highestQualityIndex).avgBitrate) highestQualityIndex = i; } return ... | Utils { public static AudioStream getHighestQualityAudio(List<AudioStream> audioStreams) { int highestQualityIndex = 0; for (int i = 1; i < audioStreams.size(); i++) { AudioStream audioStream = audioStreams.get(i); if (audioStream.avgBitrate > audioStreams.get(highestQualityIndex).avgBitrate) highestQualityIndex = i; }... | Utils { public static AudioStream getHighestQualityAudio(List<AudioStream> audioStreams) { int highestQualityIndex = 0; for (int i = 1; i < audioStreams.size(); i++) { AudioStream audioStream = audioStreams.get(i); if (audioStream.avgBitrate > audioStreams.get(highestQualityIndex).avgBitrate) highestQualityIndex = i; }... | Utils { public static AudioStream getHighestQualityAudio(List<AudioStream> audioStreams) { int highestQualityIndex = 0; for (int i = 1; i < audioStreams.size(); i++) { AudioStream audioStream = audioStreams.get(i); if (audioStream.avgBitrate > audioStreams.get(highestQualityIndex).avgBitrate) highestQualityIndex = i; }... | Utils { public static AudioStream getHighestQualityAudio(List<AudioStream> audioStreams) { int highestQualityIndex = 0; for (int i = 1; i < audioStreams.size(); i++) { AudioStream audioStream = audioStreams.get(i); if (audioStream.avgBitrate > audioStreams.get(highestQualityIndex).avgBitrate) highestQualityIndex = i; }... |
@Test public void getSortedStreamVideosListTest() throws Exception { List<VideoStream> result = Utils.getSortedStreamVideosList(MediaFormat.MPEG_4, true, videoStreamsTestList, videoOnlyStreamsTestList, true); List<String> expected = Arrays.asList("144p", "240p", "360p", "480p", "720p", "720p60", "1080p", "1080p60", "14... | public static ArrayList<VideoStream> getSortedStreamVideosList(Context context, List<VideoStream> videoStreams, List<VideoStream> videoOnlyStreams, boolean ascendingOrder) { boolean showHigherResolutions = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.show_higher_resolutio... | Utils { public static ArrayList<VideoStream> getSortedStreamVideosList(Context context, List<VideoStream> videoStreams, List<VideoStream> videoOnlyStreams, boolean ascendingOrder) { boolean showHigherResolutions = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.show_higher_r... | Utils { public static ArrayList<VideoStream> getSortedStreamVideosList(Context context, List<VideoStream> videoStreams, List<VideoStream> videoOnlyStreams, boolean ascendingOrder) { boolean showHigherResolutions = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.show_higher_r... | Utils { public static ArrayList<VideoStream> getSortedStreamVideosList(Context context, List<VideoStream> videoStreams, List<VideoStream> videoOnlyStreams, boolean ascendingOrder) { boolean showHigherResolutions = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.show_higher_r... | Utils { public static ArrayList<VideoStream> getSortedStreamVideosList(Context context, List<VideoStream> videoStreams, List<VideoStream> videoOnlyStreams, boolean ascendingOrder) { boolean showHigherResolutions = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.show_higher_r... |
@Test void writeLosslessUntiled() throws Exception { OpenJp2ImageWriteParam param = (OpenJp2ImageWriteParam) writer.getDefaultWriteParam(); compressAndCompare("lenna_defaults.jp2", param); } | @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override ... | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override ... |
@Test void writeLossyUntiledDefaultQuality() throws Exception { OpenJp2ImageWriteParam param = (OpenJp2ImageWriteParam) writer.getDefaultWriteParam(); param.setCompressionType("lossy"); compressAndCompare("lenna_lossy.jp2", param); } | @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override ... | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override ... |
@Test void writeLossyUntiledCustomQuality() throws Exception { OpenJp2ImageWriteParam param = (OpenJp2ImageWriteParam) writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(0.9f); compressAndCompare("lenna_lossy_r10.jp2", param); } | @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override ... | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override ... |
@Test void writeLossyTiledCustomQuality() throws Exception { OpenJp2ImageWriteParam param = (OpenJp2ImageWriteParam) writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(0.9f); param.setTilingMode(ImageWriteParam.MODE_EXPLICIT); param.setTiling(128, 128, 0,... | @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); } | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override ... | OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override ... |
@Test public void testRead() throws IOException { ImageReader reader = getReader("rgb.jpg"); BufferedImage img = reader.read(0, null); assertThat(img).hasDimensions(512, 512); } | @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotation = ((TurboJpegImageReadParam) param).get... | TurboJpegImageReader extends ImageReader { @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotat... | TurboJpegImageReader extends ImageReader { @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotat... | TurboJpegImageReader extends ImageReader { @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotat... | TurboJpegImageReader extends ImageReader { @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotat... |
@Test public void testReadScaled() throws IOException { BufferedImage img = getReader("rgb.jpg").read(2, null); assertThat(img).hasDimensions(384, 384); } | @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotation = ((TurboJpegImageReadParam) param).get... | TurboJpegImageReader extends ImageReader { @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotat... | TurboJpegImageReader extends ImageReader { @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotat... | TurboJpegImageReader extends ImageReader { @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotat... | TurboJpegImageReader extends ImageReader { @Override public BufferedImage read(int imageIndex, ImageReadParam param) throws IOException { checkIndex(imageIndex); ByteBuffer data = jpegData; try { int rotation = 0; Rectangle region = null; Rectangle extraCrop = null; if (param instanceof TurboJpegImageReadParam) { rotat... |
@Test(expectedExceptions = IllegalArgumentException.class) public void failOnWrongTableName() { createTable("CREATE TABLE namenamenamenamename (id_pk INTEGER PRIMARY KEY, age INT)"); lSql.table("wrongwrongwrongwrongwrong"); } | Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.append("... | Table { Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.... | Table { Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.... | Table { Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.... | Table { Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.... |
@Test() public void outConverterConfiguration() { addConfigHook(testConfig -> { testConfig.getDialect().getConverterRegistry().addTypeAlias("ai", new AtomicIntegerConverter()); }); setup(); String sql = "-- column age: ai\nselect age from person where id = 1;"; AnnotatedSqlStatement as = new AnnotatedSqlStatement( this... | public Map<String, Converter> getOutConverters() { return outConverters; } | AnnotatedSqlStatement { public Map<String, Converter> getOutConverters() { return outConverters; } } | AnnotatedSqlStatement { public Map<String, Converter> getOutConverters() { return outConverters; } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); } | AnnotatedSqlStatement { public Map<String, Converter> getOutConverters() { return outConverters; } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName(); String getStatementName(); String... | AnnotatedSqlStatement { public Map<String, Converter> getOutConverters() { return outConverters; } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName(); String getStatementName(); String... |
@Test public void execute() { createTable("CREATE TABLE table1 (name TEXT, age INT)"); lSql.executeRawSql("INSERT INTO table1 (name, age) VALUES ('cus1', 20)"); } | public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } | LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } } | LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } LSql(Class<? extends Config> configClass, Callable<Connection> connectionProvider); LSql(Class<? extends Config> configClass, DataSource dataSource)... | LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } LSql(Class<? extends Config> configClass, Callable<Connection> connectionProvider); LSql(Class<? extends Config> configClass, DataSource dataSource)... | LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } LSql(Class<? extends Config> configClass, Callable<Connection> connectionProvider); LSql(Class<? extends Config> configClass, DataSource dataSource)... |
@Test(expectedExceptions = RuntimeException.class) public void executeShouldThrowRuntimeExceptionOnWrongStatement() { lSql.executeRawSql("CREATE TABLE table1 (name TEXT, age INT)"); lSql.executeRawSql("INSERT INTO tableX (name, age) VALUES ('cus1', 20)"); } | public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } | LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } } | LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } LSql(Class<? extends Config> configClass, Callable<Connection> connectionProvider); LSql(Class<? extends Config> configClass, DataSource dataSource)... | LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } LSql(Class<? extends Config> configClass, Callable<Connection> connectionProvider); LSql(Class<? extends Config> configClass, DataSource dataSource)... | LSql { public void executeRawSql(String sql) { Statement st = this.createStatement(); try { st.execute(sql); } catch (SQLException e) { throw new RuntimeException(e); } } LSql(Class<? extends Config> configClass, Callable<Connection> connectionProvider); LSql(Class<? extends Config> configClass, DataSource dataSource)... |
@Test public void save() { createTable("CREATE TABLE table1 (id INTEGER PRIMARY KEY, age INT)"); Table table1 = lSql.table("table1"); LinkedRow row1 = table1.newLinkedRow(); row1.addKeyVals("id", 1, "age", 1); Optional<?> row1Id = row1.save(); assertTrue(row1Id.isPresent()); assertEquals(row1Id.get(), 1); LinkedRow que... | public Optional<?> save() { return table.save(this); } | LinkedRow extends Row { public Optional<?> save() { return table.save(this); } } | LinkedRow extends Row { public Optional<?> save() { return table.save(this); } } | LinkedRow extends Row { public Optional<?> save() { return table.save(this); } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(Object revision); void removeIdAndRevision(); @Override Object put(String key, Object value); LinkedRow putAllKnown(Row from); Optional<?> inser... | LinkedRow extends Row { public Optional<?> save() { return table.save(this); } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(Object revision); void removeIdAndRevision(); @Override Object put(String key, Object value); LinkedRow putAllKnown(Row from); Optional<?> inser... |
@Test public void delete() { createTable("CREATE TABLE table1 (id INTEGER PRIMARY KEY, age INT)"); Table table1 = lSql.table("table1"); LinkedRow row1 = table1.newLinkedRow(); row1.addKeyVals("id", 1, "age", 1); row1.save(); assertEquals(table1.load(1).get().getInt("age"), (Integer) 1); row1.delete(); assertFalse(table... | public void delete() { Object id = get(table.getPrimaryKeyColumn().get()); if (id == null) { throw new IllegalStateException("Can not delete this LinkedRow because the primary key value is not present."); } table.delete(this); } | LinkedRow extends Row { public void delete() { Object id = get(table.getPrimaryKeyColumn().get()); if (id == null) { throw new IllegalStateException("Can not delete this LinkedRow because the primary key value is not present."); } table.delete(this); } } | LinkedRow extends Row { public void delete() { Object id = get(table.getPrimaryKeyColumn().get()); if (id == null) { throw new IllegalStateException("Can not delete this LinkedRow because the primary key value is not present."); } table.delete(this); } } | LinkedRow extends Row { public void delete() { Object id = get(table.getPrimaryKeyColumn().get()); if (id == null) { throw new IllegalStateException("Can not delete this LinkedRow because the primary key value is not present."); } table.delete(this); } Table getTable(); Object getId(); void setId(Object id); Object ge... | LinkedRow extends Row { public void delete() { Object id = get(table.getPrimaryKeyColumn().get()); if (id == null) { throw new IllegalStateException("Can not delete this LinkedRow because the primary key value is not present."); } table.delete(this); } Table getTable(); Object getId(); void setId(Object id); Object ge... |
@Test public void newLinkedRowCopiesDataWithIdAndRevisionColumn() { createTable("CREATE TABLE table1 (id INTEGER PRIMARY KEY, age INT, revision INT DEFAULT 0)"); Table table1 = lSql.table("table1"); table1.enableRevisionSupport(); table1.insert(Row.fromKeyVals("id", 1, "age", 1)); LinkedRow row = table1.load(1).get(); ... | public Optional<?> insert() { return table.insert(this); } | LinkedRow extends Row { public Optional<?> insert() { return table.insert(this); } } | LinkedRow extends Row { public Optional<?> insert() { return table.insert(this); } } | LinkedRow extends Row { public Optional<?> insert() { return table.insert(this); } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(Object revision); void removeIdAndRevision(); @Override Object put(String key, Object value); LinkedRow putAllKnown(Row from); Optional<?> i... | LinkedRow extends Row { public Optional<?> insert() { return table.insert(this); } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(Object revision); void removeIdAndRevision(); @Override Object put(String key, Object value); LinkedRow putAllKnown(Row from); Optional<?> i... |
@Test public void removeIdAndRevision() { createTable("CREATE TABLE table1 (id INTEGER PRIMARY KEY, age INT, revision INT DEFAULT 0)"); Table table1 = lSql.table("table1"); table1.enableRevisionSupport(); LinkedRow row = table1.newLinkedRow( "id", 1, "age", 1, "revision", 1 ); row.removeIdAndRevision(); assertFalse(row... | public void removeIdAndRevision() { remove(table.getPrimaryKeyColumn().get()); if (table.getRevisionColumn().isPresent()) { remove(table.getRevisionColumn().get().getColumnName()); } } | LinkedRow extends Row { public void removeIdAndRevision() { remove(table.getPrimaryKeyColumn().get()); if (table.getRevisionColumn().isPresent()) { remove(table.getRevisionColumn().get().getColumnName()); } } } | LinkedRow extends Row { public void removeIdAndRevision() { remove(table.getPrimaryKeyColumn().get()); if (table.getRevisionColumn().isPresent()) { remove(table.getRevisionColumn().get().getColumnName()); } } } | LinkedRow extends Row { public void removeIdAndRevision() { remove(table.getPrimaryKeyColumn().get()); if (table.getRevisionColumn().isPresent()) { remove(table.getRevisionColumn().get().getColumnName()); } } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(Object revisio... | LinkedRow extends Row { public void removeIdAndRevision() { remove(table.getPrimaryKeyColumn().get()); if (table.getRevisionColumn().isPresent()) { remove(table.getRevisionColumn().get().getColumnName()); } } Table getTable(); Object getId(); void setId(Object id); Object getRevision(); void setRevision(Object revisio... |
@Test public void addKeyVals() { Row r = new Row().addKeyVals("a", 1, "b", "val"); assertEquals(r.get("a"), 1); assertEquals(r.get("b"), "val"); } | public Row addKeyVals(Object... keyVals) { checkArgument( keyVals.length == 0 || keyVals.length % 2 == 0, "content must be a list of iterant key value pairs."); Iterable<List<Object>> partition = Iterables.partition(newArrayList(keyVals), 2); for (List<Object> objects : partition) { Object key = objects.get(0); checkAr... | Row extends ForwardingMap<String, Object> { public Row addKeyVals(Object... keyVals) { checkArgument( keyVals.length == 0 || keyVals.length % 2 == 0, "content must be a list of iterant key value pairs."); Iterable<List<Object>> partition = Iterables.partition(newArrayList(keyVals), 2); for (List<Object> objects : parti... | Row extends ForwardingMap<String, Object> { public Row addKeyVals(Object... keyVals) { checkArgument( keyVals.length == 0 || keyVals.length % 2 == 0, "content must be a list of iterant key value pairs."); Iterable<List<Object>> partition = Iterables.partition(newArrayList(keyVals), 2); for (List<Object> objects : parti... | Row extends ForwardingMap<String, Object> { public Row addKeyVals(Object... keyVals) { checkArgument( keyVals.length == 0 || keyVals.length % 2 == 0, "content must be a list of iterant key value pairs."); Iterable<List<Object>> partition = Iterables.partition(newArrayList(keyVals), 2); for (List<Object> objects : parti... | Row extends ForwardingMap<String, Object> { public Row addKeyVals(Object... keyVals) { checkArgument( keyVals.length == 0 || keyVals.length % 2 == 0, "content must be a list of iterant key value pairs."); Iterable<List<Object>> partition = Iterables.partition(newArrayList(keyVals), 2); for (List<Object> objects : parti... |
@Test public void getJavaCodeNameTests() { assertEquals(getJavaCodeName( "a", false, false), "a"); assertEquals(getJavaCodeName( "a", false, true), "A"); assertEquals(getJavaCodeName( "abc_def", false, false), "abcDef"); assertEquals(getJavaCodeName( "abc_def", false, true), "AbcDef"); assertEquals(getJavaCodeName( "ab... | public static String getJavaCodeName(String str, boolean insertUnderscoreOnCaseChange, boolean startUppercase) { if (str.length() == 0) { return str; } StringBuilder result = new StringBuilder(); String firstChar = str.substring(0, 1); result.append(startUppercase ? firstChar.toUpperCase() : firstChar); int idx = 1; wh... | CodeGenUtils { public static String getJavaCodeName(String str, boolean insertUnderscoreOnCaseChange, boolean startUppercase) { if (str.length() == 0) { return str; } StringBuilder result = new StringBuilder(); String firstChar = str.substring(0, 1); result.append(startUppercase ? firstChar.toUpperCase() : firstChar); ... | CodeGenUtils { public static String getJavaCodeName(String str, boolean insertUnderscoreOnCaseChange, boolean startUppercase) { if (str.length() == 0) { return str; } StringBuilder result = new StringBuilder(); String firstChar = str.substring(0, 1); result.append(startUppercase ? firstChar.toUpperCase() : firstChar); ... | CodeGenUtils { public static String getJavaCodeName(String str, boolean insertUnderscoreOnCaseChange, boolean startUppercase) { if (str.length() == 0) { return str; } StringBuilder result = new StringBuilder(); String firstChar = str.substring(0, 1); result.append(startUppercase ? firstChar.toUpperCase() : firstChar); ... | CodeGenUtils { public static String getJavaCodeName(String str, boolean insertUnderscoreOnCaseChange, boolean startUppercase) { if (str.length() == 0) { return str; } StringBuilder result = new StringBuilder(); String firstChar = str.substring(0, 1); result.append(startUppercase ? firstChar.toUpperCase() : firstChar); ... |
@Test public void save() throws SQLException { createTable("CREATE TABLE table1 (id SERIAL PRIMARY KEY, name TEXT)"); Table table1 = lSql.table("table1"); Row row = Row.fromKeyVals("name", "Max"); Object id = table1.save(row).get(); assertEquals(id, row.get(table1.getPrimaryKeyColumn().get())); LinkedRow queriedRow = t... | public Optional<?> save(Row row) { return this.save(row, RowSerializer.INSTANCE_SPECIAL_ROWKEY, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } | Table { public Optional<?> save(Row row) { return this.save(row, RowSerializer.INSTANCE_SPECIAL_ROWKEY, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } } | Table { public Optional<?> save(Row row) { return this.save(row, RowSerializer.INSTANCE_SPECIAL_ROWKEY, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } Table(LSql lSql, String sqlSchemaAndTableName); Table(LSql lSql,
String sqlSchemaName,
String sqlTableName,
String primaryKeyColumn); } | Table { public Optional<?> save(Row row) { return this.save(row, RowSerializer.INSTANCE_SPECIAL_ROWKEY, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } Table(LSql lSql, String sqlSchemaAndTableName); Table(LSql lSql,
String sqlSchemaName,
String sqlTableName,
String primaryKeyColumn); LSql g... | Table { public Optional<?> save(Row row) { return this.save(row, RowSerializer.INSTANCE_SPECIAL_ROWKEY, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } Table(LSql lSql, String sqlSchemaAndTableName); Table(LSql lSql,
String sqlSchemaName,
String sqlTableName,
String primaryKeyColumn); LSql g... |
@Test public void delete() throws SQLException { createTable("CREATE TABLE table1 (id SERIAL PRIMARY KEY, name TEXT)"); Table table1 = lSql.table("table1"); Row row = new Row().addKeyVals("name", "Max"); table1.insert(row).get(); int tableSize = lSql.executeRawQuery("SELECT * FROM table1;").toList().size(); assertEqual... | public void delete(Object id) { this.delete(id, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } | Table { public void delete(Object id) { this.delete(id, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } } | Table { public void delete(Object id) { this.delete(id, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } Table(LSql lSql, String sqlSchemaAndTableName); Table(LSql lSql,
String sqlSchemaName,
String sqlTableName,
String primaryKeyColumn); } | Table { public void delete(Object id) { this.delete(id, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } Table(LSql lSql, String sqlSchemaAndTableName); Table(LSql lSql,
String sqlSchemaName,
String sqlTableName,
String primaryKeyColumn); LSql getlSql(); String getSqlSchemaAndTableName(); Str... | Table { public void delete(Object id) { this.delete(id, RowDeserializer.INSTANCE_SPECIAL_ROWKEY); } Table(LSql lSql, String sqlSchemaAndTableName); Table(LSql lSql,
String sqlSchemaName,
String sqlTableName,
String primaryKeyColumn); LSql getlSql(); String getSqlSchemaAndTableName(); Str... |
@Test public void fetchMetaWithRecursiveFkTable() { createTable("CREATE TABLE table1 (id SERIAL PRIMARY KEY, ref INT REFERENCES table1(id))"); lSql.table("table1"); } | Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.append("... | Table { Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.... | Table { Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.... | Table { Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.... | Table { Table(LSql lSql, String sqlSchemaAndTableName) { this.lSql = lSql; this.sqlSchemaAndTableName = sqlSchemaAndTableName; fetchMeta(); if (logger.isDebugEnabled()) { StringBuilder msg = new StringBuilder("Read schema for table '" + this.sqlSchemaAndTableName + "':\n"); for (Column column : columns.values()) { msg.... |
@Test public void statementQueryParameter() { setup(); AnnotatedSqlStatementToQuery<PlainQuery> statement = lSql.createSqlStatement("SELECT * FROM \n" + "person \n" + "WHERE \n" + "id = 99999 \n" + "and age = 11 \n;"); ImmutableMap<String, List<AnnotatedSqlStatement.Parameter>> params = statement.getParameters(); asser... | public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... |
@Test() public void queryParameterTypeAnnotations1() { setup(); AnnotatedSqlStatementToQuery<PlainQuery> statement = lSql.createSqlStatement( "select * from person where age > 18 ;"); AnnotatedSqlStatement.Parameter param = statement.getParameters().get("age").get(0); assertEquals(param.getJavaTypeAlias(), "int"); } | public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... |
@Test() public void queryParameterTypeAnnotations2() { setup(); AnnotatedSqlStatementToQuery<PlainQuery> statement = lSql.createSqlStatement( "select * from person where age > 18 ;"); AnnotatedSqlStatement.Parameter param = statement.getParameters().get("age").get(0); assertEquals(param.getJavaTypeAlias(), "int"); } | public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... |
@Test() public void queryParameterTypeAnnotations3() { setup(); AnnotatedSqlStatementToQuery<PlainQuery> statement = lSql.createSqlStatement( "select * from person where age > 18 ;"); AnnotatedSqlStatement.Parameter param = statement.getParameters().get("p1").get(0); assertEquals(param.getJavaTypeAlias(), "int"); } | public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... |
@Test() public void queryParameterTypeAnnotations4() { setup(); AnnotatedSqlStatementToQuery<PlainQuery> statement = lSql.createSqlStatement( "select * from person where age > 18 ;"); AnnotatedSqlStatement.Parameter param = statement.getParameters().get("p1").get(0); assertEquals(param.getJavaTypeAlias(), "int"); } | public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... |
@Test() public void queryParameterTypeAnnotations5() { setup(); AnnotatedSqlStatementToQuery<PlainQuery> statement = lSql.createSqlStatement( "select * from person where age > 18 ;"); AnnotatedSqlStatement.Parameter param = statement.getParameters().get("p1").get(0); assertEquals(param.getJavaTypeAlias(), "int"); } | public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); } | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... | AnnotatedSqlStatement { public ImmutableMap<String, List<Parameter>> getParameters() { return ImmutableMap.copyOf(this.parameters); } AnnotatedSqlStatement(LSql lSql, String statementSourceName, String statementName, String typeAnnotation, String sqlString); com.w11k.lsql.LSql getlSql(); String getStatementSourceName()... |
@Test public void getModule() { GodEye.instance().uninstall(); try { GodEye.instance().getModule(null); fail(); } catch (UninstallException ignore) { } try { GodEye.instance().getModule(""); fail(); } catch (UninstallException ignore) { } try { GodEye.instance().getModule(GodEye.ModuleName.STARTUP); fail(); } catch (Un... | public synchronized <T> T getModule(@ModuleName String moduleName) throws UninstallException { Object moduleObj = mModules.get(moduleName); if (moduleObj == null) { throw new UninstallException("module [" + moduleName + "] is not installed."); } try { return (T) moduleObj; } catch (Throwable e) { throw new UnexpectExce... | GodEye { public synchronized <T> T getModule(@ModuleName String moduleName) throws UninstallException { Object moduleObj = mModules.get(moduleName); if (moduleObj == null) { throw new UninstallException("module [" + moduleName + "] is not installed."); } try { return (T) moduleObj; } catch (Throwable e) { throw new Une... | GodEye { public synchronized <T> T getModule(@ModuleName String moduleName) throws UninstallException { Object moduleObj = mModules.get(moduleName); if (moduleObj == null) { throw new UninstallException("module [" + moduleName + "] is not installed."); } try { return (T) moduleObj; } catch (Throwable e) { throw new Une... | GodEye { public synchronized <T> T getModule(@ModuleName String moduleName) throws UninstallException { Object moduleObj = mModules.get(moduleName); if (moduleObj == null) { throw new UninstallException("module [" + moduleName + "] is not installed."); } try { return (T) moduleObj; } catch (Throwable e) { throw new Une... | GodEye { public synchronized <T> T getModule(@ModuleName String moduleName) throws UninstallException { Object moduleObj = mModules.get(moduleName); if (moduleObj == null) { throw new UninstallException("module [" + moduleName + "] is not installed."); } try { return (T) moduleObj; } catch (Throwable e) { throw new Une... |
@Test public void onAppStartEndWhenNotInstalled() { try { GodEye.instance().uninstall(); GodEyeHelper.onAppStartEnd(null); fail(); } catch (UninstallException ignore) { } } | public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChan... | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChan... |
@Test public void onAppStartEndWhenNull() { try { GodEye.instance().uninstall(); GodEye.instance().install(GodEyeConfig.noneConfigBuilder().withStartupConfig(new StartupConfig()).build()); GodEyeHelper.onAppStartEnd(null); } catch (NullPointerException ignore) { } catch (UninstallException e) { fail(); } } | public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChan... | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChan... |
@Test public void onAppStartEndSuccess() { try { GodEye.instance().uninstall(); GodEye.instance().install(GodEyeConfig.noneConfigBuilder().withStartupConfig(new StartupConfig()).build()); StartupInfo startupInfo = new StartupInfo(StartupInfo.StartUpType.COLD, 3000); GodEyeHelper.onAppStartEnd(startupInfo); TestObserver... | public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } } | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChan... | GodEyeHelper { public static void onAppStartEnd(StartupInfo startupInfo) throws UninstallException { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(startupInfo); L.d("GodEyeHelper onAppStartEnd: " + startupInfo); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChan... |
@Test public void onNetworkEndWhenNotInstalled() { try { GodEye.instance().uninstall(); GodEyeHelper.onNetworkEnd(null); fail(); } catch (UninstallException ignore) { } } | public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } static void onPageLoaded(Object... | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } static void onPageLoaded(Object... |
@Test public void onNetworkEndWhenNull() { try { GodEye.instance().uninstall(); GodEye.instance().install(GodEyeConfig.noneConfigBuilder().withNetworkConfig(new NetworkConfig()).build()); GodEyeHelper.onNetworkEnd(null); } catch (NullPointerException ignore) { } catch (UninstallException e) { fail(); } } | public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } static void onPageLoaded(Object... | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } static void onPageLoaded(Object... |
@Test public void onNetworkEndSuccess() { try { GodEye.instance().uninstall(); GodEye.instance().install(GodEyeConfig.noneConfigBuilder().withNetworkConfig(new NetworkConfig()).build()); NetworkInfo<NetworkContent> networkInfo = new NetworkInfo<>(); networkInfo.isSuccessful = true; networkInfo.message = "message"; GodE... | public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } } | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } static void onPageLoaded(Object... | GodEyeHelper { public static void onNetworkEnd(NetworkInfo networkInfo) throws UninstallException { GodEye.instance().<Network>getModule(GodEye.ModuleName.NETWORK).produce(networkInfo); L.d("GodEyeHelper onNetworkEnd: %s", networkInfo == null ? "null" : networkInfo.toSummaryString()); } static void onPageLoaded(Object... |
@Test public void startMethodCanaryRecordingWhenNotInstalled() { try { GodEye.instance().uninstall(); GodEyeHelper.startMethodCanaryRecording("tag"); fail(); } catch (UninstallException ignore) { } } | public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } | GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } } | GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } } | GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Object... | GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Object... |
@Test public void startMethodCanaryRecordingSuccess() { try { GodEye.instance().uninstall(); GodEye.instance().install(GodEyeConfig.noneConfigBuilder().withMethodCanaryConfig(new MethodCanaryConfig()).build()); GodEyeHelper.startMethodCanaryRecording("tag"); } catch (UninstallException ignore) { fail(); } } | public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } | GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } } | GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } } | GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Object... | GodEyeHelper { public static void startMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.startMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Object... |
@Test public void stopMethodCanaryRecordingWhenNotInstalled() { try { GodEye.instance().uninstall(); GodEyeHelper.stopMethodCanaryRecording("tag"); fail(); } catch (UninstallException ignore) { } } | public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } | GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } } | GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } } | GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Object f... | GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Object f... |
@Test public void stopMethodCanaryRecordingSuccess() { try { GodEye.instance().uninstall(); GodEye.instance().install(GodEyeConfig.noneConfigBuilder().withMethodCanaryConfig(new MethodCanaryConfig()).build()); GodEyeHelper.stopMethodCanaryRecording("tag"); } catch (UninstallException ignore) { fail(); } } | public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } | GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } } | GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } } | GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Object f... | GodEyeHelper { public static void stopMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); methodCanary.stopMonitor(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Object f... |
@Test public void moduleObservable() { GodEye.instance().uninstall(); try { GodEye.instance().moduleObservable(null); fail(); } catch (UninstallException ignore) { } try { GodEye.instance().moduleObservable(""); fail(); } catch (UninstallException ignore) { } try { GodEye.instance().moduleObservable(GodEye.ModuleName.S... | public <S extends SubjectSupport<M>, M> Observable<M> moduleObservable(@ModuleName String moduleName) throws UninstallException { return this.<S>getModule(moduleName).subject(); } | GodEye { public <S extends SubjectSupport<M>, M> Observable<M> moduleObservable(@ModuleName String moduleName) throws UninstallException { return this.<S>getModule(moduleName).subject(); } } | GodEye { public <S extends SubjectSupport<M>, M> Observable<M> moduleObservable(@ModuleName String moduleName) throws UninstallException { return this.<S>getModule(moduleName).subject(); } private GodEye(); } | GodEye { public <S extends SubjectSupport<M>, M> Observable<M> moduleObservable(@ModuleName String moduleName) throws UninstallException { return this.<S>getModule(moduleName).subject(); } private GodEye(); static GodEye instance(); synchronized GodEye install(final GodEyeConfig godEyeConfig, NotificationConfig notifi... | GodEye { public <S extends SubjectSupport<M>, M> Observable<M> moduleObservable(@ModuleName String moduleName) throws UninstallException { return this.<S>getModule(moduleName).subject(); } private GodEye(); static GodEye instance(); synchronized GodEye install(final GodEyeConfig godEyeConfig, NotificationConfig notifi... |
@Test public void isMethodCanaryRecordingWhenNotInstalled() { try { GodEye.instance().uninstall(); GodEyeHelper.isMethodCanaryRecording("tag"); fail(); } catch (UninstallException ignore) { } } | public static boolean isMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); return methodCanary.isRunning(tag); } | GodEyeHelper { public static boolean isMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); return methodCanary.isRunning(tag); } } | GodEyeHelper { public static boolean isMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); return methodCanary.isRunning(tag); } } | GodEyeHelper { public static boolean isMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); return methodCanary.isRunning(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Ob... | GodEyeHelper { public static boolean isMethodCanaryRecording(String tag) throws UninstallException { final MethodCanary methodCanary = GodEye.instance().getModule(GodEye.ModuleName.METHOD_CANARY); return methodCanary.isRunning(tag); } static void onPageLoaded(Object page); static void onFragmentPageVisibilityChange(Ob... |
@Test public void getAppHeapInfo() { HeapInfo heapInfo = MemoryUtil.getAppHeapInfo(); Assert.assertTrue(heapInfo.allocatedKb > 0); Assert.assertTrue(heapInfo.freeMemKb > 0); Assert.assertTrue(heapInfo.maxMemKb > 0); } | public static HeapInfo getAppHeapInfo() { Runtime runtime = Runtime.getRuntime(); HeapInfo heapInfo = new HeapInfo(); heapInfo.freeMemKb = runtime.freeMemory() / 1024; heapInfo.maxMemKb = Runtime.getRuntime().maxMemory() / 1024; heapInfo.allocatedKb = (Runtime.getRuntime().totalMemory() - runtime.freeMemory()) / 1024; ... | MemoryUtil { public static HeapInfo getAppHeapInfo() { Runtime runtime = Runtime.getRuntime(); HeapInfo heapInfo = new HeapInfo(); heapInfo.freeMemKb = runtime.freeMemory() / 1024; heapInfo.maxMemKb = Runtime.getRuntime().maxMemory() / 1024; heapInfo.allocatedKb = (Runtime.getRuntime().totalMemory() - runtime.freeMemor... | MemoryUtil { public static HeapInfo getAppHeapInfo() { Runtime runtime = Runtime.getRuntime(); HeapInfo heapInfo = new HeapInfo(); heapInfo.freeMemKb = runtime.freeMemory() / 1024; heapInfo.maxMemKb = Runtime.getRuntime().maxMemory() / 1024; heapInfo.allocatedKb = (Runtime.getRuntime().totalMemory() - runtime.freeMemor... | MemoryUtil { public static HeapInfo getAppHeapInfo() { Runtime runtime = Runtime.getRuntime(); HeapInfo heapInfo = new HeapInfo(); heapInfo.freeMemKb = runtime.freeMemory() / 1024; heapInfo.maxMemKb = Runtime.getRuntime().maxMemory() / 1024; heapInfo.allocatedKb = (Runtime.getRuntime().totalMemory() - runtime.freeMemor... | MemoryUtil { public static HeapInfo getAppHeapInfo() { Runtime runtime = Runtime.getRuntime(); HeapInfo heapInfo = new HeapInfo(); heapInfo.freeMemKb = runtime.freeMemory() / 1024; heapInfo.maxMemKb = Runtime.getRuntime().maxMemory() / 1024; heapInfo.allocatedKb = (Runtime.getRuntime().totalMemory() - runtime.freeMemor... |
@Test public void getAppPssInfo() { try { PssInfo pssInfo = MemoryUtil.getAppPssInfo(GodEye.instance().getApplication()); } catch (NullPointerException ignore) { } catch (Throwable e) { Assert.fail(); } } | public static PssInfo getAppPssInfo(Context context) { final int pid = ProcessUtils.getCurrentPid(); if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } Debug.MemoryInfo memoryInfo = sActivityManager.getProcessMemoryInfo(new int[]{pid})[0]; PssInfo ... | MemoryUtil { public static PssInfo getAppPssInfo(Context context) { final int pid = ProcessUtils.getCurrentPid(); if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } Debug.MemoryInfo memoryInfo = sActivityManager.getProcessMemoryInfo(new int[]{pid})... | MemoryUtil { public static PssInfo getAppPssInfo(Context context) { final int pid = ProcessUtils.getCurrentPid(); if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } Debug.MemoryInfo memoryInfo = sActivityManager.getProcessMemoryInfo(new int[]{pid})... | MemoryUtil { public static PssInfo getAppPssInfo(Context context) { final int pid = ProcessUtils.getCurrentPid(); if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } Debug.MemoryInfo memoryInfo = sActivityManager.getProcessMemoryInfo(new int[]{pid})... | MemoryUtil { public static PssInfo getAppPssInfo(Context context) { final int pid = ProcessUtils.getCurrentPid(); if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } Debug.MemoryInfo memoryInfo = sActivityManager.getProcessMemoryInfo(new int[]{pid})... |
@Test public void getRamInfo() { RamInfo ramInfo = MemoryUtil.getRamInfo(GodEye.instance().getApplication()); Assert.assertNotNull(ramInfo); } | public static RamInfo getRamInfo(Context context) { if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } final ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); sActivityManager.getMemoryInfo(mi); final RamInfo ramMemoryInfo = new Ram... | MemoryUtil { public static RamInfo getRamInfo(Context context) { if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } final ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); sActivityManager.getMemoryInfo(mi); final RamInfo ramMemoryI... | MemoryUtil { public static RamInfo getRamInfo(Context context) { if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } final ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); sActivityManager.getMemoryInfo(mi); final RamInfo ramMemoryI... | MemoryUtil { public static RamInfo getRamInfo(Context context) { if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } final ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); sActivityManager.getMemoryInfo(mi); final RamInfo ramMemoryI... | MemoryUtil { public static RamInfo getRamInfo(Context context) { if (sActivityManager == null) { sActivityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); } final ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); sActivityManager.getMemoryInfo(mi); final RamInfo ramMemoryI... |
@Test public void convertToMethodsRecordInfo() { Map<ThreadInfo, List<MethodEvent>> methodEventMap = mockMethodEventMap(); MethodsRecordInfo methodsRecordInfo = mockMethodsRecordInfo(methodEventMap); Gson gson = new Gson(); String c = gson.toJson(methodsRecordInfo); System.out.println("methodsRecordInfo:\n" + c); asser... | static MethodsRecordInfo convertToMethodsRecordInfo(long startMillis, long stopMillis, Map<ThreadInfo, List<MethodEvent>> methodEventMap) { MethodsRecordInfo methodsRecordInfo = new MethodsRecordInfo(startMillis, stopMillis, new ArrayList<>()); if (methodEventMap == null || methodEventMap.isEmpty()) { return methodsRec... | MethodCanaryConverter { static MethodsRecordInfo convertToMethodsRecordInfo(long startMillis, long stopMillis, Map<ThreadInfo, List<MethodEvent>> methodEventMap) { MethodsRecordInfo methodsRecordInfo = new MethodsRecordInfo(startMillis, stopMillis, new ArrayList<>()); if (methodEventMap == null || methodEventMap.isEmpt... | MethodCanaryConverter { static MethodsRecordInfo convertToMethodsRecordInfo(long startMillis, long stopMillis, Map<ThreadInfo, List<MethodEvent>> methodEventMap) { MethodsRecordInfo methodsRecordInfo = new MethodsRecordInfo(startMillis, stopMillis, new ArrayList<>()); if (methodEventMap == null || methodEventMap.isEmpt... | MethodCanaryConverter { static MethodsRecordInfo convertToMethodsRecordInfo(long startMillis, long stopMillis, Map<ThreadInfo, List<MethodEvent>> methodEventMap) { MethodsRecordInfo methodsRecordInfo = new MethodsRecordInfo(startMillis, stopMillis, new ArrayList<>()); if (methodEventMap == null || methodEventMap.isEmpt... | MethodCanaryConverter { static MethodsRecordInfo convertToMethodsRecordInfo(long startMillis, long stopMillis, Map<ThreadInfo, List<MethodEvent>> methodEventMap) { MethodsRecordInfo methodsRecordInfo = new MethodsRecordInfo(startMillis, stopMillis, new ArrayList<>()); if (methodEventMap == null || methodEventMap.isEmpt... |
@Test public void inspectInner() { ActivityController<TestViewCanaryActivity> activityController = Robolectric.buildActivity(TestViewCanaryActivity.class).create().start().resume(); ViewCanaryInternal viewCanaryInternal = new ViewCanaryInternal(); Map<Activity, List<List<ViewIdWithSize>>> recentLayoutListRecords = new ... | @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ViewCanary viewCanary, ViewCanaryConfig config, Map<Activity, List<List<ViewIdWithSize>>> recentLayoutListRecords) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWindow().getDecorView(); ... | ViewCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ViewCanary viewCanary, ViewCanaryConfig config, Map<Activity, List<List<ViewIdWithSize>>> recentLayoutListRecords) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWind... | ViewCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ViewCanary viewCanary, ViewCanaryConfig config, Map<Activity, List<List<ViewIdWithSize>>> recentLayoutListRecords) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWind... | ViewCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ViewCanary viewCanary, ViewCanaryConfig config, Map<Activity, List<List<ViewIdWithSize>>> recentLayoutListRecords) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWind... | ViewCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ViewCanary viewCanary, ViewCanaryConfig config, Map<Activity, List<List<ViewIdWithSize>>> recentLayoutListRecords) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWind... |
@Test public void work() { try { NetworkInfo networkInfo0 = new NetworkInfo(); networkInfo0.message = "networkInfo0"; networkInfo0.networkTime = new NetworkTime(); networkInfo0.networkTime.totalTimeMillis = 1000; networkInfo0.networkTime.networkTimeMillisMap = new LinkedHashMap<>(); networkInfo0.networkTime.networkTime... | @Override public void produce(NetworkInfo data) { if (mConfig == null) { L.d("Network is not installed, produce data fail."); return; } super.produce(data); } | Network extends ProduceableSubject<NetworkInfo> implements Install<NetworkConfig> { @Override public void produce(NetworkInfo data) { if (mConfig == null) { L.d("Network is not installed, produce data fail."); return; } super.produce(data); } } | Network extends ProduceableSubject<NetworkInfo> implements Install<NetworkConfig> { @Override public void produce(NetworkInfo data) { if (mConfig == null) { L.d("Network is not installed, produce data fail."); return; } super.produce(data); } } | Network extends ProduceableSubject<NetworkInfo> implements Install<NetworkConfig> { @Override public void produce(NetworkInfo data) { if (mConfig == null) { L.d("Network is not installed, produce data fail."); return; } super.produce(data); } @Override synchronized boolean install(NetworkConfig config); @Override sync... | Network extends ProduceableSubject<NetworkInfo> implements Install<NetworkConfig> { @Override public void produce(NetworkInfo data) { if (mConfig == null) { L.d("Network is not installed, produce data fail."); return; } super.produce(data); } @Override synchronized boolean install(NetworkConfig config); @Override sync... |
@Test public void work() { try { GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(new StartupInfo(StartupInfo.StartUpType.COLD, 1)); GodEye.instance().<Startup>getModule(GodEye.ModuleName.STARTUP).produce(new StartupInfo(StartupInfo.StartUpType.HOT, 2)); TestObserver<StartupInfo> testObserver = G... | @Override public void produce(StartupInfo data) { if (mConfig == null) { L.d("Startup is not installed, produce data fail."); return; } super.produce(data); } | Startup extends ProduceableSubject<StartupInfo> implements Install<StartupConfig> { @Override public void produce(StartupInfo data) { if (mConfig == null) { L.d("Startup is not installed, produce data fail."); return; } super.produce(data); } } | Startup extends ProduceableSubject<StartupInfo> implements Install<StartupConfig> { @Override public void produce(StartupInfo data) { if (mConfig == null) { L.d("Startup is not installed, produce data fail."); return; } super.produce(data); } } | Startup extends ProduceableSubject<StartupInfo> implements Install<StartupConfig> { @Override public void produce(StartupInfo data) { if (mConfig == null) { L.d("Startup is not installed, produce data fail."); return; } super.produce(data); } @Override synchronized boolean install(StartupConfig config); @Override sync... | Startup extends ProduceableSubject<StartupInfo> implements Install<StartupConfig> { @Override public void produce(StartupInfo data) { if (mConfig == null) { L.d("Startup is not installed, produce data fail."); return; } super.produce(data); } @Override synchronized boolean install(StartupConfig config); @Override sync... |
@Test public void isMatch() { Assert.assertTrue(PageLifecycleMethodEventTypes.isMatch(ActivityLifecycleEvent.ON_CREATE, ActivityLifecycleEvent.ON_CREATE)); Assert.assertFalse(PageLifecycleMethodEventTypes.isMatch(FragmentLifecycleEvent.ON_CREATE, ActivityLifecycleEvent.ON_CREATE)); } | static boolean isMatch(LifecycleEvent lifecycleEvent0, LifecycleEvent lifecycleEvent1) { return lifecycleEvent0.equals(lifecycleEvent1); } | PageLifecycleMethodEventTypes { static boolean isMatch(LifecycleEvent lifecycleEvent0, LifecycleEvent lifecycleEvent1) { return lifecycleEvent0.equals(lifecycleEvent1); } } | PageLifecycleMethodEventTypes { static boolean isMatch(LifecycleEvent lifecycleEvent0, LifecycleEvent lifecycleEvent1) { return lifecycleEvent0.equals(lifecycleEvent1); } } | PageLifecycleMethodEventTypes { static boolean isMatch(LifecycleEvent lifecycleEvent0, LifecycleEvent lifecycleEvent1) { return lifecycleEvent0.equals(lifecycleEvent1); } } | PageLifecycleMethodEventTypes { static boolean isMatch(LifecycleEvent lifecycleEvent0, LifecycleEvent lifecycleEvent1) { return lifecycleEvent0.equals(lifecycleEvent1); } } |
@Test public void convert() { Assert.assertNull(PageLifecycleMethodEventTypes.convert(PageType.ACTIVITY, mock("class0", "desc0"))); Assert.assertNull(PageLifecycleMethodEventTypes.convert(PageType.ACTIVITY, mock("onCreate", "(Landroid/os/Bundle;)"))); Assert.assertEquals(ActivityLifecycleEvent.ON_CREATE, PageLifecycleM... | static LifecycleEvent convert(PageType pageType, MethodEvent lifecycleMethodEvent) { return sPairsOfLifecycleAndMethods.get(new MethodInfoForLifecycle(pageType, lifecycleMethodEvent)); } | PageLifecycleMethodEventTypes { static LifecycleEvent convert(PageType pageType, MethodEvent lifecycleMethodEvent) { return sPairsOfLifecycleAndMethods.get(new MethodInfoForLifecycle(pageType, lifecycleMethodEvent)); } } | PageLifecycleMethodEventTypes { static LifecycleEvent convert(PageType pageType, MethodEvent lifecycleMethodEvent) { return sPairsOfLifecycleAndMethods.get(new MethodInfoForLifecycle(pageType, lifecycleMethodEvent)); } } | PageLifecycleMethodEventTypes { static LifecycleEvent convert(PageType pageType, MethodEvent lifecycleMethodEvent) { return sPairsOfLifecycleAndMethods.get(new MethodInfoForLifecycle(pageType, lifecycleMethodEvent)); } } | PageLifecycleMethodEventTypes { static LifecycleEvent convert(PageType pageType, MethodEvent lifecycleMethodEvent) { return sPairsOfLifecycleAndMethods.get(new MethodInfoForLifecycle(pageType, lifecycleMethodEvent)); } } |
@Test public void observeModule() { GodEye.instance().init(ApplicationProvider.getApplicationContext()); GodEye.instance().uninstall(); try { GodEye.instance().observeModule(null, null); fail(); } catch (UninstallException ignore) { } try { GodEye.instance().observeModule("", null); fail(); } catch (UninstallException ... | public <S extends SubjectSupport<M>, M> Disposable observeModule(@ModuleName String moduleName, Consumer<M> consumer) throws UninstallException { return this.<S>getModule(moduleName).subject().subscribeOn(Schedulers.computation()).observeOn(Schedulers.computation()).subscribe(consumer); } | GodEye { public <S extends SubjectSupport<M>, M> Disposable observeModule(@ModuleName String moduleName, Consumer<M> consumer) throws UninstallException { return this.<S>getModule(moduleName).subject().subscribeOn(Schedulers.computation()).observeOn(Schedulers.computation()).subscribe(consumer); } } | GodEye { public <S extends SubjectSupport<M>, M> Disposable observeModule(@ModuleName String moduleName, Consumer<M> consumer) throws UninstallException { return this.<S>getModule(moduleName).subject().subscribeOn(Schedulers.computation()).observeOn(Schedulers.computation()).subscribe(consumer); } private GodEye(); } | GodEye { public <S extends SubjectSupport<M>, M> Disposable observeModule(@ModuleName String moduleName, Consumer<M> consumer) throws UninstallException { return this.<S>getModule(moduleName).subject().subscribeOn(Schedulers.computation()).observeOn(Schedulers.computation()).subscribe(consumer); } private GodEye(); st... | GodEye { public <S extends SubjectSupport<M>, M> Disposable observeModule(@ModuleName String moduleName, Consumer<M> consumer) throws UninstallException { return this.<S>getModule(moduleName).subject().subscribeOn(Schedulers.computation()).observeOn(Schedulers.computation()).subscribe(consumer); } private GodEye(); st... |
@Test public void work() { try { ApplicationLeak applicationLeak0 = new ApplicationLeak(Arrays.asList(new LeakTrace(LeakTrace.GcRootType.JNI_GLOBAL, new ArrayList<>(), new LeakTraceObject(LeakTraceObject.ObjectType.ARRAY, "", new ArraySet<>(), LeakTraceObject.LeakingStatus.LEAKING, ""), 0))); ApplicationLeak applicatio... | public static LeakDetector instance() { return LeakDetector.InstanceHolder.sINSTANCE; } | LeakDetector extends ProduceableSubject<LeakQueue.LeakMemoryInfo> implements Install<LeakConfig> { public static LeakDetector instance() { return LeakDetector.InstanceHolder.sINSTANCE; } } | LeakDetector extends ProduceableSubject<LeakQueue.LeakMemoryInfo> implements Install<LeakConfig> { public static LeakDetector instance() { return LeakDetector.InstanceHolder.sINSTANCE; } private LeakDetector(); } | LeakDetector extends ProduceableSubject<LeakQueue.LeakMemoryInfo> implements Install<LeakConfig> { public static LeakDetector instance() { return LeakDetector.InstanceHolder.sINSTANCE; } private LeakDetector(); static LeakDetector instance(); @Override synchronized boolean install(LeakConfig config); @Override synchro... | LeakDetector extends ProduceableSubject<LeakQueue.LeakMemoryInfo> implements Install<LeakConfig> { public static LeakDetector instance() { return LeakDetector.InstanceHolder.sINSTANCE; } private LeakDetector(); static LeakDetector instance(); @Override synchronized boolean install(LeakConfig config); @Override synchro... |
@Test(timeout = 5000) @Config(sdk = Build.VERSION_CODES.LOLLIPOP) public void getAppSizeLowerO() { CountDownLatch countDownLatch = new CountDownLatch(1); final AppSizeInfo[] appSizeInfo = new AppSizeInfo[1]; AppSizeUtil.getAppSize(ApplicationProvider.getApplicationContext(), new AppSizeUtil.OnGetSizeListener() { @Overr... | @SuppressWarnings("JavaReflectionMemberAccess") private static void getAppSizeLowerO(Context context, @NonNull final OnGetSizeListener listener) { try { Method method = PackageManager.class.getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class); method.invoke(context.getPackageManager(), context.get... | AppSizeUtil { @SuppressWarnings("JavaReflectionMemberAccess") private static void getAppSizeLowerO(Context context, @NonNull final OnGetSizeListener listener) { try { Method method = PackageManager.class.getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class); method.invoke(context.getPackageManager(... | AppSizeUtil { @SuppressWarnings("JavaReflectionMemberAccess") private static void getAppSizeLowerO(Context context, @NonNull final OnGetSizeListener listener) { try { Method method = PackageManager.class.getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class); method.invoke(context.getPackageManager(... | AppSizeUtil { @SuppressWarnings("JavaReflectionMemberAccess") private static void getAppSizeLowerO(Context context, @NonNull final OnGetSizeListener listener) { try { Method method = PackageManager.class.getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class); method.invoke(context.getPackageManager(... | AppSizeUtil { @SuppressWarnings("JavaReflectionMemberAccess") private static void getAppSizeLowerO(Context context, @NonNull final OnGetSizeListener listener) { try { Method method = PackageManager.class.getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class); method.invoke(context.getPackageManager(... |
@Test public void formatSize() { final long oneByte = 1; final long oneKByte = 1 * 1024; final long oneMByte = 1 * 1024 * 1024; final long oneGByte = 1 * 1024 * 1024 * 1024; Assert.assertEquals("2B", AppSizeUtil.formatSize(oneByte * 2)); Assert.assertEquals("2KB", AppSizeUtil.formatSize(oneKByte * 2 + oneByte)); Assert... | static String formatSize(long size) { if (size / (1024 * 1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 * 1024 * 1024); DecimalFormat df = new DecimalFormat("#.##"); return df.format(tmpSize) + "GB"; } else if (size / (1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 * 1024); Decim... | AppSizeUtil { static String formatSize(long size) { if (size / (1024 * 1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 * 1024 * 1024); DecimalFormat df = new DecimalFormat("#.##"); return df.format(tmpSize) + "GB"; } else if (size / (1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 ... | AppSizeUtil { static String formatSize(long size) { if (size / (1024 * 1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 * 1024 * 1024); DecimalFormat df = new DecimalFormat("#.##"); return df.format(tmpSize) + "GB"; } else if (size / (1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 ... | AppSizeUtil { static String formatSize(long size) { if (size / (1024 * 1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 * 1024 * 1024); DecimalFormat df = new DecimalFormat("#.##"); return df.format(tmpSize) + "GB"; } else if (size / (1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 ... | AppSizeUtil { static String formatSize(long size) { if (size / (1024 * 1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 * 1024 * 1024); DecimalFormat df = new DecimalFormat("#.##"); return df.format(tmpSize) + "GB"; } else if (size / (1024 * 1024) > 0) { float tmpSize = (float) (size) / (float) (1024 ... |
@Test public void setSmConfigCache() { GodEye.instance().uninstall(); GodEye.instance().install(GodEyeConfig.noneConfigBuilder().withSmConfig(new SmConfig()).build()); try { GodEye.instance().<Sm>getModule(GodEye.ModuleName.SM).setSmConfigCache(new SmConfig(true, 200, 150, 100)); Assert.assertEquals(200, GodEye.instanc... | public void setSmConfigCache(SmConfig smConfigCache) { if (smConfigCache == null || !smConfigCache.isValid()) { return; } SharedPreferences sharedPreferences = GodEye.instance().getApplication().getSharedPreferences("AndroidGodEye", 0); sharedPreferences.edit().putString("SmConfig", JsonUtil.toJson(smConfigCache)).appl... | Sm extends ProduceableSubject<BlockInfo> implements Install<SmConfig> { public void setSmConfigCache(SmConfig smConfigCache) { if (smConfigCache == null || !smConfigCache.isValid()) { return; } SharedPreferences sharedPreferences = GodEye.instance().getApplication().getSharedPreferences("AndroidGodEye", 0); sharedPrefe... | Sm extends ProduceableSubject<BlockInfo> implements Install<SmConfig> { public void setSmConfigCache(SmConfig smConfigCache) { if (smConfigCache == null || !smConfigCache.isValid()) { return; } SharedPreferences sharedPreferences = GodEye.instance().getApplication().getSharedPreferences("AndroidGodEye", 0); sharedPrefe... | Sm extends ProduceableSubject<BlockInfo> implements Install<SmConfig> { public void setSmConfigCache(SmConfig smConfigCache) { if (smConfigCache == null || !smConfigCache.isValid()) { return; } SharedPreferences sharedPreferences = GodEye.instance().getApplication().getSharedPreferences("AndroidGodEye", 0); sharedPrefe... | Sm extends ProduceableSubject<BlockInfo> implements Install<SmConfig> { public void setSmConfigCache(SmConfig smConfigCache) { if (smConfigCache == null || !smConfigCache.isValid()) { return; } SharedPreferences sharedPreferences = GodEye.instance().getApplication().getSharedPreferences("AndroidGodEye", 0); sharedPrefe... |
@Test public void parse() { String deviceCpu0 = "800%cpu 0%user 0%nice 0%sys 800%idle 0%iow 0%irq 0%sirq 0%host"; String appCpu0 = "[7m PID USER PR NI VIRT RES SHR S[%CPU] %MEM TIME+ ARGS \u001B[0m"; try { CpuSnapshot cpuSnapshot = CpuUsage.parse(deviceCpu0, appCpu0); Assert.fail(); } catch (NumberFormatException ignor... | @VisibleForTesting static CpuSnapshot parse(String cpuRate, String pidCpuRate) { String[] cpuInfoArray = cpuRate.split("\\s+"); if (cpuInfoArray.length < 9) { throw new IllegalStateException("cpu info array size must great than 9"); } long user = Long.parseLong(cpuInfoArray[2]); long nice = Long.parseLong(cpuInfoArray[... | CpuUsage { @VisibleForTesting static CpuSnapshot parse(String cpuRate, String pidCpuRate) { String[] cpuInfoArray = cpuRate.split("\\s+"); if (cpuInfoArray.length < 9) { throw new IllegalStateException("cpu info array size must great than 9"); } long user = Long.parseLong(cpuInfoArray[2]); long nice = Long.parseLong(cp... | CpuUsage { @VisibleForTesting static CpuSnapshot parse(String cpuRate, String pidCpuRate) { String[] cpuInfoArray = cpuRate.split("\\s+"); if (cpuInfoArray.length < 9) { throw new IllegalStateException("cpu info array size must great than 9"); } long user = Long.parseLong(cpuInfoArray[2]); long nice = Long.parseLong(cp... | CpuUsage { @VisibleForTesting static CpuSnapshot parse(String cpuRate, String pidCpuRate) { String[] cpuInfoArray = cpuRate.split("\\s+"); if (cpuInfoArray.length < 9) { throw new IllegalStateException("cpu info array size must great than 9"); } long user = Long.parseLong(cpuInfoArray[2]); long nice = Long.parseLong(cp... | CpuUsage { @VisibleForTesting static CpuSnapshot parse(String cpuRate, String pidCpuRate) { String[] cpuInfoArray = cpuRate.split("\\s+"); if (cpuInfoArray.length < 9) { throw new IllegalStateException("cpu info array size must great than 9"); } long user = Long.parseLong(cpuInfoArray[2]); long nice = Long.parseLong(cp... |
@Test public void parseCpuRateOfAppByShell() { String line2 = "800%cpu 0%user 0%nice 0%sys 800%idle 0%iow 0%irq 0%sirq 0%host"; String line3 = "[7m PID USER PR NI VIRT RES SHR S[%CPU] %MEM TIME+ ARGS \u001B[0m"; String line4 = "0 u0_a591 10 -10 5.4G 131M 80M S 16.0 1.7 0:02.98 cn.hikyson.andr+"; String line5 = "0wfwf f... | @VisibleForTesting static float parseCpuRateOfAppByShell(String line, int cpuIndex, Float cpuTotal) { if (line.startsWith(String.valueOf(android.os.Process.myPid()))) { if (cpuIndex == -1) { throw new IllegalStateException("parseCpuRateOfAppByShell but cpuIndex == -1:" + line); } String[] param = line.split("\\s+"); if... | CpuUsage { @VisibleForTesting static float parseCpuRateOfAppByShell(String line, int cpuIndex, Float cpuTotal) { if (line.startsWith(String.valueOf(android.os.Process.myPid()))) { if (cpuIndex == -1) { throw new IllegalStateException("parseCpuRateOfAppByShell but cpuIndex == -1:" + line); } String[] param = line.split(... | CpuUsage { @VisibleForTesting static float parseCpuRateOfAppByShell(String line, int cpuIndex, Float cpuTotal) { if (line.startsWith(String.valueOf(android.os.Process.myPid()))) { if (cpuIndex == -1) { throw new IllegalStateException("parseCpuRateOfAppByShell but cpuIndex == -1:" + line); } String[] param = line.split(... | CpuUsage { @VisibleForTesting static float parseCpuRateOfAppByShell(String line, int cpuIndex, Float cpuTotal) { if (line.startsWith(String.valueOf(android.os.Process.myPid()))) { if (cpuIndex == -1) { throw new IllegalStateException("parseCpuRateOfAppByShell but cpuIndex == -1:" + line); } String[] param = line.split(... | CpuUsage { @VisibleForTesting static float parseCpuRateOfAppByShell(String line, int cpuIndex, Float cpuTotal) { if (line.startsWith(String.valueOf(android.os.Process.myPid()))) { if (cpuIndex == -1) { throw new IllegalStateException("parseCpuRateOfAppByShell but cpuIndex == -1:" + line); } String[] param = line.split(... |
@Test public void parseCpuRateOfDeviceAndTotalByShell() { String line0 = "[s\u001B[999C\u001B[999B\u001B[6n\u001B[u\u001B[H\u001B[J\u001B[?25l\u001B[H\u001B[J\u001B[s\u001B[999C\u001B[999B\u001B[6n\u001B[uTasks: 2 total, 1 running, 1 sleeping, 0 stopped, 0 zombie"; String line1 = "Mem: 7.2G total, 7.0G used, 266M free,... | @VisibleForTesting static Map<String, Float> parseCpuRateOfDeviceAndTotalByShell(String line) { if (line.matches("^\\d+%\\w+.+\\d+%\\w+")) { String lineLowerCase = line.toLowerCase(Locale.US); String[] cpuList = lineLowerCase.split("\\s+"); Map<String, Float> cpuMap = new HashMap<>(); for (String s : cpuList) { String[... | CpuUsage { @VisibleForTesting static Map<String, Float> parseCpuRateOfDeviceAndTotalByShell(String line) { if (line.matches("^\\d+%\\w+.+\\d+%\\w+")) { String lineLowerCase = line.toLowerCase(Locale.US); String[] cpuList = lineLowerCase.split("\\s+"); Map<String, Float> cpuMap = new HashMap<>(); for (String s : cpuList... | CpuUsage { @VisibleForTesting static Map<String, Float> parseCpuRateOfDeviceAndTotalByShell(String line) { if (line.matches("^\\d+%\\w+.+\\d+%\\w+")) { String lineLowerCase = line.toLowerCase(Locale.US); String[] cpuList = lineLowerCase.split("\\s+"); Map<String, Float> cpuMap = new HashMap<>(); for (String s : cpuList... | CpuUsage { @VisibleForTesting static Map<String, Float> parseCpuRateOfDeviceAndTotalByShell(String line) { if (line.matches("^\\d+%\\w+.+\\d+%\\w+")) { String lineLowerCase = line.toLowerCase(Locale.US); String[] cpuList = lineLowerCase.split("\\s+"); Map<String, Float> cpuMap = new HashMap<>(); for (String s : cpuList... | CpuUsage { @VisibleForTesting static Map<String, Float> parseCpuRateOfDeviceAndTotalByShell(String line) { if (line.matches("^\\d+%\\w+.+\\d+%\\w+")) { String lineLowerCase = line.toLowerCase(Locale.US); String[] cpuList = lineLowerCase.split("\\s+"); Map<String, Float> cpuMap = new HashMap<>(); for (String s : cpuList... |
@Test public void parseCPUIndex() { String line0 = "[s\u001B[999C\u001B[999B\u001B[6n\u001B[u\u001B[H\u001B[J\u001B[?25l\u001B[H\u001B[J\u001B[s\u001B[999C\u001B[999B\u001B[6n\u001B[uTasks: 2 total, 1 running, 1 sleeping, 0 stopped, 0 zombie"; String line1 = "Mem: 7.2G total, 7.0G used, 266M free, 98M buffers"; String ... | @VisibleForTesting static int parseCPUIndex(String line) { if (line.contains("CPU")) { String[] titles = line.split("\\s+"); for (int i = 0; i < titles.length; i++) { if (titles[i].contains("CPU")) { return i; } } } return -1; } | CpuUsage { @VisibleForTesting static int parseCPUIndex(String line) { if (line.contains("CPU")) { String[] titles = line.split("\\s+"); for (int i = 0; i < titles.length; i++) { if (titles[i].contains("CPU")) { return i; } } } return -1; } } | CpuUsage { @VisibleForTesting static int parseCPUIndex(String line) { if (line.contains("CPU")) { String[] titles = line.split("\\s+"); for (int i = 0; i < titles.length; i++) { if (titles[i].contains("CPU")) { return i; } } } return -1; } } | CpuUsage { @VisibleForTesting static int parseCPUIndex(String line) { if (line.contains("CPU")) { String[] titles = line.split("\\s+"); for (int i = 0; i < titles.length; i++) { if (titles[i].contains("CPU")) { return i; } } } return -1; } static CpuInfo getCpuInfo(); } | CpuUsage { @VisibleForTesting static int parseCPUIndex(String line) { if (line.contains("CPU")) { String[] titles = line.split("\\s+"); for (int i = 0; i < titles.length; i++) { if (titles[i].contains("CPU")) { return i; } } } return -1; } static CpuInfo getCpuInfo(); } |
@Test public void inspectInner() { ActivityController<Test4ImageActivity> activityController = Robolectric.buildActivity(Test4ImageActivity.class).create().start().resume(); Test4ImageActivity activity = activityController.get(); ImageCanaryInternal imageCanaryInternal = new ImageCanaryInternal(new DefaultImageCanaryCo... | @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ImageCanary imageCanaryEngine, Set<ImageIssue> imageIssues) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWindow().getDecorView(); recursiveLoopChildren(p, parent, imageCanaryEngine, ima... | ImageCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ImageCanary imageCanaryEngine, Set<ImageIssue> imageIssues) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWindow().getDecorView(); recursiveLoopChildren(p, parent, ... | ImageCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ImageCanary imageCanaryEngine, Set<ImageIssue> imageIssues) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWindow().getDecorView(); recursiveLoopChildren(p, parent, ... | ImageCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ImageCanary imageCanaryEngine, Set<ImageIssue> imageIssues) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWindow().getDecorView(); recursiveLoopChildren(p, parent, ... | ImageCanaryInternal { @VisibleForTesting Runnable inspectInner(WeakReference<Activity> activity, ImageCanary imageCanaryEngine, Set<ImageIssue> imageIssues) { return () -> { try { Activity p = activity.get(); if (p != null) { ViewGroup parent = (ViewGroup) p.getWindow().getDecorView(); recursiveLoopChildren(p, parent, ... |
@Test public void accept() { try { new NotificationConsumer(null).accept(new NotificationContent("AndroidGodEye_message", null)); CountDownLatch countDownLatch = new CountDownLatch(1); final NotificationContent[] notificationContent0 = new NotificationContent[1]; new NotificationConsumer(new NotificationListener() { @O... | @Override public void accept(NotificationContent notificationContent) throws Exception { ThreadUtil.ensureWorkThread("NotificationConsumer"); if (mNotification == null) { return; } mNotification.onNotificationReceive(System.currentTimeMillis(), notificationContent); } | NotificationConsumer implements Consumer<NotificationContent> { @Override public void accept(NotificationContent notificationContent) throws Exception { ThreadUtil.ensureWorkThread("NotificationConsumer"); if (mNotification == null) { return; } mNotification.onNotificationReceive(System.currentTimeMillis(), notificatio... | NotificationConsumer implements Consumer<NotificationContent> { @Override public void accept(NotificationContent notificationContent) throws Exception { ThreadUtil.ensureWorkThread("NotificationConsumer"); if (mNotification == null) { return; } mNotification.onNotificationReceive(System.currentTimeMillis(), notificatio... | NotificationConsumer implements Consumer<NotificationContent> { @Override public void accept(NotificationContent notificationContent) throws Exception { ThreadUtil.ensureWorkThread("NotificationConsumer"); if (mNotification == null) { return; } mNotification.onNotificationReceive(System.currentTimeMillis(), notificatio... | NotificationConsumer implements Consumer<NotificationContent> { @Override public void accept(NotificationContent notificationContent) throws Exception { ThreadUtil.ensureWorkThread("NotificationConsumer"); if (mNotification == null) { return; } mNotification.onNotificationReceive(System.currentTimeMillis(), notificatio... |
@Test public void getApplication() { assertNotNull(GodEye.instance().getApplication()); } | public Application getApplication() { return mApplication; } | GodEye { public Application getApplication() { return mApplication; } } | GodEye { public Application getApplication() { return mApplication; } private GodEye(); } | GodEye { public Application getApplication() { return mApplication; } private GodEye(); static GodEye instance(); synchronized GodEye install(final GodEyeConfig godEyeConfig, NotificationConfig notificationConfig); GodEye install(final GodEyeConfig godEyeConfig); GodEye install(final GodEyeConfig godEyeConfig, boolean... | GodEye { public Application getApplication() { return mApplication; } private GodEye(); static GodEye instance(); synchronized GodEye install(final GodEyeConfig godEyeConfig, NotificationConfig notificationConfig); GodEye install(final GodEyeConfig godEyeConfig); GodEye install(final GodEyeConfig godEyeConfig, boolean... |
@Test public void start() { LocalNotificationListenerService.start("AndroidGodEye",false); LocalNotificationListenerService.start("AndroidGodEye",true); } | public static void start(String message, boolean isStartup) { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.putExtra("message", message); intent.putExtra("isStartup", isStartup); intent.setAction(ACTION_START); ContextCompat.startForegroundService(GodEye.... | LocalNotificationListenerService extends Service { public static void start(String message, boolean isStartup) { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.putExtra("message", message); intent.putExtra("isStartup", isStartup); intent.setAction(ACTION_S... | LocalNotificationListenerService extends Service { public static void start(String message, boolean isStartup) { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.putExtra("message", message); intent.putExtra("isStartup", isStartup); intent.setAction(ACTION_S... | LocalNotificationListenerService extends Service { public static void start(String message, boolean isStartup) { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.putExtra("message", message); intent.putExtra("isStartup", isStartup); intent.setAction(ACTION_S... | LocalNotificationListenerService extends Service { public static void start(String message, boolean isStartup) { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.putExtra("message", message); intent.putExtra("isStartup", isStartup); intent.setAction(ACTION_S... |
@Test public void stop() { LocalNotificationListenerService.stop(); } | public static void stop() { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.setAction(ACTION_STOP); GodEye.instance().getApplication().startService(intent); } | LocalNotificationListenerService extends Service { public static void stop() { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.setAction(ACTION_STOP); GodEye.instance().getApplication().startService(intent); } } | LocalNotificationListenerService extends Service { public static void stop() { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.setAction(ACTION_STOP); GodEye.instance().getApplication().startService(intent); } } | LocalNotificationListenerService extends Service { public static void stop() { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.setAction(ACTION_STOP); GodEye.instance().getApplication().startService(intent); } static void start(String message, boolean isSt... | LocalNotificationListenerService extends Service { public static void stop() { Intent intent = new Intent(GodEye.instance().getApplication(), LocalNotificationListenerService.class); intent.setAction(ACTION_STOP); GodEye.instance().getApplication().startService(intent); } static void start(String message, boolean isSt... |
@Test public void d() { CountDownLatch countDownLatch = new CountDownLatch(4); L.setProxy(new L.LogProxy() { @Override public void d(String msg) { countDownLatch.countDown(); if (countDownLatch.getCount() == 3) { Assert.assertEquals("AndroidGodEye-String", msg); } if (countDownLatch.getCount() == 2) { Assert.assertTrue... | public static void d(Object msg) { if (sLogProxy != null) { sLogProxy.d(o2String(msg)); } } | L { public static void d(Object msg) { if (sLogProxy != null) { sLogProxy.d(o2String(msg)); } } } | L { public static void d(Object msg) { if (sLogProxy != null) { sLogProxy.d(o2String(msg)); } } } | L { public static void d(Object msg) { if (sLogProxy != null) { sLogProxy.d(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeException e); } | L { public static void d(Object msg) { if (sLogProxy != null) { sLogProxy.d(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeException e); sta... |
@Test public void e() { L.setProxy(new L.LogProxy() { @Override public void d(String msg) { Assert.fail(); } @Override public void w(String msg) { } @Override public void e(String msg) { Assert.assertTrue(msg.contains("AndroidGodEye-Exception")); } @Override public void onRuntimeException(RuntimeException e) { Assert.f... | public static void e(Object msg) { if (sLogProxy != null) { sLogProxy.e(o2String(msg)); } } | L { public static void e(Object msg) { if (sLogProxy != null) { sLogProxy.e(o2String(msg)); } } } | L { public static void e(Object msg) { if (sLogProxy != null) { sLogProxy.e(o2String(msg)); } } } | L { public static void e(Object msg) { if (sLogProxy != null) { sLogProxy.e(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeException e); } | L { public static void e(Object msg) { if (sLogProxy != null) { sLogProxy.e(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeException e); sta... |
@Test public void w() { L.setProxy(new L.LogProxy() { @Override public void d(String msg) { Assert.fail(); } @Override public void w(String msg) { Assert.assertFalse(msg.isEmpty()); } @Override public void e(String msg) { Assert.fail(); } @Override public void onRuntimeException(RuntimeException e) { Assert.fail(); } }... | public static void w(Object msg) { if (sLogProxy != null) { sLogProxy.w(o2String(msg)); } } | L { public static void w(Object msg) { if (sLogProxy != null) { sLogProxy.w(o2String(msg)); } } } | L { public static void w(Object msg) { if (sLogProxy != null) { sLogProxy.w(o2String(msg)); } } } | L { public static void w(Object msg) { if (sLogProxy != null) { sLogProxy.w(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeException e); } | L { public static void w(Object msg) { if (sLogProxy != null) { sLogProxy.w(o2String(msg)); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeException(RuntimeException e); sta... |
@Test public void onRuntimeException() { L.setProxy(new L.LogProxy() { @Override public void d(String msg) { Assert.fail(); } @Override public void w(String msg) { } @Override public void e(String msg) { Assert.fail(); } @Override public void onRuntimeException(RuntimeException e) { Assert.assertEquals("AndroidGodEye-E... | public static void onRuntimeException(RuntimeException e) { if (sLogProxy != null) { sLogProxy.onRuntimeException(e); } } | L { public static void onRuntimeException(RuntimeException e) { if (sLogProxy != null) { sLogProxy.onRuntimeException(e); } } } | L { public static void onRuntimeException(RuntimeException e) { if (sLogProxy != null) { sLogProxy.onRuntimeException(e); } } } | L { public static void onRuntimeException(RuntimeException e) { if (sLogProxy != null) { sLogProxy.onRuntimeException(e); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeExce... | L { public static void onRuntimeException(RuntimeException e) { if (sLogProxy != null) { sLogProxy.onRuntimeException(e); } } static void setProxy(LogProxy logProxy); static void d(Object msg); static void d(String format, Object... msgs); static void e(Object msg); static void w(Object msg); static void onRuntimeExce... |
@Test public void convertToBase64() { String base642 = ImageUtil.convertToBase64(null, 5, 5); Assert.assertNull(base642); Bitmap bitmap = ShadowBitmapFactory.create("AndroidGodEye-Image", null, new Point(10, 10)); String base64 = ImageUtil.convertToBase64(bitmap, 5, 5); Assert.assertNotNull(base64); } | public static String convertToBase64(Bitmap bitmap, int maxWidth, int maxHeight) { if (bitmap == null) { return null; } long startTime = System.currentTimeMillis(); int[] targetSize = computeTargetSize(bitmap, maxWidth, maxHeight); Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, targetSize[0], targetSize[1])... | ImageUtil { public static String convertToBase64(Bitmap bitmap, int maxWidth, int maxHeight) { if (bitmap == null) { return null; } long startTime = System.currentTimeMillis(); int[] targetSize = computeTargetSize(bitmap, maxWidth, maxHeight); Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, targetSize[0], ta... | ImageUtil { public static String convertToBase64(Bitmap bitmap, int maxWidth, int maxHeight) { if (bitmap == null) { return null; } long startTime = System.currentTimeMillis(); int[] targetSize = computeTargetSize(bitmap, maxWidth, maxHeight); Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, targetSize[0], ta... | ImageUtil { public static String convertToBase64(Bitmap bitmap, int maxWidth, int maxHeight) { if (bitmap == null) { return null; } long startTime = System.currentTimeMillis(); int[] targetSize = computeTargetSize(bitmap, maxWidth, maxHeight); Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, targetSize[0], ta... | ImageUtil { public static String convertToBase64(Bitmap bitmap, int maxWidth, int maxHeight) { if (bitmap == null) { return null; } long startTime = System.currentTimeMillis(); int[] targetSize = computeTargetSize(bitmap, maxWidth, maxHeight); Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, targetSize[0], ta... |
@Test public void computeTargetSizeWidth1Height0() { Bitmap bitmap = ShadowBitmapFactory.create("AndroidGodEye", null, new Point(100, 20)); int[] targetSize0 = ImageUtil.computeTargetSize(bitmap, 30, 30); Assert.assertEquals(30, targetSize0[0]); Assert.assertEquals(6, targetSize0[1]); } | @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); float scaleH... | ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); ... | ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); ... | ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); ... | ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); ... |
@Test public void computeTargetSizeWidth1Height1() { Bitmap bitmap = ShadowBitmapFactory.create("AndroidGodEye", null, new Point(100, 50)); int[] targetSize0 = ImageUtil.computeTargetSize(bitmap, 30, 30); Assert.assertEquals(30, targetSize0[0]); Assert.assertEquals(15, targetSize0[1]); } | @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); float scaleH... | ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); ... | ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); ... | ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); ... | ImageUtil { @VisibleForTesting static int[] computeTargetSize(Bitmap bitmap, int maxWidth, int maxHeight) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); float targetWidth = width; float targetHeight = height; if (width > maxWidth || height > maxHeight) { float scaleWidth = (width * 1.0f / maxWidth); ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.